Skip to content

Commit e575aa0

Browse files
authored
ignore tokenization ut (#764)
1 parent 5fd612e commit e575aa0

File tree

4 files changed

+29
-32
lines changed

4 files changed

+29
-32
lines changed

examples/classification/bert_emotect_finetune.ipynb

+23-23
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
"\n",
2626
"from mindnlp.engine import Trainer, Evaluator\n",
2727
"from mindnlp.engine.callbacks import CheckpointCallback, BestModelCallback\n",
28-
"from mindnlp.metrics import Accuracy\n",
29-
"from mindnlp.dataset.transforms import PadTransform"
28+
"from mindnlp.metrics import Accuracy"
3029
]
3130
},
3231
{
@@ -73,16 +72,16 @@
7372
"name": "stdout",
7473
"output_type": "stream",
7574
"text": [
76-
"--2023-11-16 23:33:04-- https://baidu-nlp.bj.bcebos.com/emotion_detection-dataset-1.0.0.tar.gz\n",
75+
"--2023-11-30 16:11:36-- https://baidu-nlp.bj.bcebos.com/emotion_detection-dataset-1.0.0.tar.gz\n",
7776
"Resolving baidu-nlp.bj.bcebos.com (baidu-nlp.bj.bcebos.com)... 36.110.192.178, 2409:8c04:1001:1002:0:ff:b001:368a\n",
7877
"Connecting to baidu-nlp.bj.bcebos.com (baidu-nlp.bj.bcebos.com)|36.110.192.178|:443... connected.\n",
7978
"HTTP request sent, awaiting response... 200 OK\n",
8079
"Length: 1710581 (1.6M) [application/x-gzip]\n",
8180
"Saving to: ‘emotion_detection.tar.gz’\n",
8281
"\n",
83-
"emotion_detection.t 100%[===================>] 1.63M 2.29MB/s in 0.7s \n",
82+
"emotion_detection.t 100%[===================>] 1.63M 6.36MB/s in 0.3s \n",
8483
"\n",
85-
"2023-11-16 23:33:05 (2.29 MB/s) - ‘emotion_detection.tar.gz’ saved [1710581/1710581]\n",
84+
"2023-11-30 16:11:37 (6.36 MB/s) - ‘emotion_detection.tar.gz’ saved [1710581/1710581]\n",
8685
"\n",
8786
"data/\n",
8887
"data/test.tsv\n",
@@ -239,7 +238,7 @@
239238
"name": "stderr",
240239
"output_type": "stream",
241240
"text": [
242-
"Epoch 0: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 302/302 [00:41<00:00, 7.20it/s, loss=0.3326994]\n"
241+
"Epoch 0: 100%|███████████████████████████████████████| 302/302 [00:38<00:00, 7.85it/s, loss=0.35258844]\n"
243242
]
244243
},
245244
{
@@ -253,22 +252,22 @@
253252
"name": "stderr",
254253
"output_type": "stream",
255254
"text": [
256-
"Evaluate: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 34/34 [00:02<00:00, 14.57it/s]\n"
255+
"Evaluate: 100%|█████████████████████████████████████████████████████████| 34/34 [00:02<00:00, 15.66it/s]\n"
257256
]
258257
},
259258
{
260259
"name": "stdout",
261260
"output_type": "stream",
262261
"text": [
263-
"Evaluate Score: {'Accuracy': 0.937962962962963}\n",
262+
"Evaluate Score: {'Accuracy': 0.9046296296296297}\n",
264263
"---------------Best Model: 'bert_emotect_best.ckpt' has been saved in epoch: 0.---------------\n"
265264
]
266265
},
267266
{
268267
"name": "stderr",
269268
"output_type": "stream",
270269
"text": [
271-
"Epoch 1: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 302/302 [00:39<00:00, 7.64it/s, loss=0.1856075]\n"
270+
"Epoch 1: 100%|████████████████████████████████████████| 302/302 [00:35<00:00, 8.48it/s, loss=0.1903949]\n"
272271
]
273272
},
274273
{
@@ -282,22 +281,22 @@
282281
"name": "stderr",
283282
"output_type": "stream",
284283
"text": [
285-
"Evaluate: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 34/34 [00:02<00:00, 15.27it/s]\n"
284+
"Evaluate: 100%|█████████████████████████████████████████████████████████| 34/34 [00:01<00:00, 17.63it/s]\n"
286285
]
287286
},
288287
{
289288
"name": "stdout",
290289
"output_type": "stream",
291290
"text": [
292-
"Evaluate Score: {'Accuracy': 0.962037037037037}\n",
291+
"Evaluate Score: {'Accuracy': 0.9537037037037037}\n",
293292
"---------------Best Model: 'bert_emotect_best.ckpt' has been saved in epoch: 1.---------------\n"
294293
]
295294
},
296295
{
297296
"name": "stderr",
298297
"output_type": "stream",
299298
"text": [
300-
"Epoch 2: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 302/302 [00:38<00:00, 7.88it/s, loss=0.12356275]\n"
299+
"Epoch 2: 100%|███████████████████████████████████████| 302/302 [00:36<00:00, 8.39it/s, loss=0.13147199]\n"
301300
]
302301
},
303302
{
@@ -312,22 +311,22 @@
312311
"name": "stderr",
313312
"output_type": "stream",
314313
"text": [
315-
"Evaluate: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 34/34 [00:02<00:00, 16.79it/s]\n"
314+
"Evaluate: 100%|█████████████████████████████████████████████████████████| 34/34 [00:01<00:00, 17.65it/s]\n"
316315
]
317316
},
318317
{
319318
"name": "stdout",
320319
"output_type": "stream",
321320
"text": [
322-
"Evaluate Score: {'Accuracy': 0.9861111111111112}\n",
321+
"Evaluate Score: {'Accuracy': 0.9601851851851851}\n",
323322
"---------------Best Model: 'bert_emotect_best.ckpt' has been saved in epoch: 2.---------------\n"
324323
]
325324
},
326325
{
327326
"name": "stderr",
328327
"output_type": "stream",
329328
"text": [
330-
"Epoch 3: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 302/302 [00:39<00:00, 7.73it/s, loss=0.08384681]\n"
329+
"Epoch 3: 100%|██████████████████████████████████████| 302/302 [00:35<00:00, 8.39it/s, loss=0.096015364]\n"
331330
]
332331
},
333332
{
@@ -342,22 +341,22 @@
342341
"name": "stderr",
343342
"output_type": "stream",
344343
"text": [
345-
"Evaluate: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 34/34 [00:02<00:00, 16.15it/s]\n"
344+
"Evaluate: 100%|█████████████████████████████████████████████████████████| 34/34 [00:01<00:00, 17.74it/s]\n"
346345
]
347346
},
348347
{
349348
"name": "stdout",
350349
"output_type": "stream",
351350
"text": [
352-
"Evaluate Score: {'Accuracy': 0.9888888888888889}\n",
351+
"Evaluate Score: {'Accuracy': 0.9907407407407407}\n",
353352
"---------------Best Model: 'bert_emotect_best.ckpt' has been saved in epoch: 3.---------------\n"
354353
]
355354
},
356355
{
357356
"name": "stderr",
358357
"output_type": "stream",
359358
"text": [
360-
"Epoch 4: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 302/302 [00:36<00:00, 8.27it/s, loss=0.05979367]\n"
359+
"Epoch 4: 100%|███████████████████████████████████████| 302/302 [00:36<00:00, 8.23it/s, loss=0.06472951]\n"
361360
]
362361
},
363362
{
@@ -372,15 +371,16 @@
372371
"name": "stderr",
373372
"output_type": "stream",
374373
"text": [
375-
"Evaluate: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 34/34 [00:02<00:00, 16.09it/s]\n"
374+
"Evaluate: 100%|█████████████████████████████████████████████████████████| 34/34 [00:01<00:00, 17.69it/s]\n"
376375
]
377376
},
378377
{
379378
"name": "stdout",
380379
"output_type": "stream",
381380
"text": [
382-
"Evaluate Score: {'Accuracy': 0.9879629629629629}\n",
383-
"Loading best model from 'checkpoint' with '['Accuracy']': [0.9888888888888889]...\n",
381+
"Evaluate Score: {'Accuracy': 0.9953703703703703}\n",
382+
"---------------Best Model: 'bert_emotect_best.ckpt' has been saved in epoch: 4.---------------\n",
383+
"Loading best model from 'checkpoint' with '['Accuracy']': [0.9953703703703703]...\n",
384384
"---------------The model is already load the best model from 'bert_emotect_best.ckpt'.---------------\n"
385385
]
386386
}
@@ -401,14 +401,14 @@
401401
"name": "stderr",
402402
"output_type": "stream",
403403
"text": [
404-
"Evaluate: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 33/33 [00:02<00:00, 16.08it/s]"
404+
"Evaluate: 100%|█████████████████████████████████████████████████████████| 33/33 [00:01<00:00, 17.01it/s]"
405405
]
406406
},
407407
{
408408
"name": "stdout",
409409
"output_type": "stream",
410410
"text": [
411-
"Evaluate Score: {'Accuracy': 0.9083011583011583}\n"
411+
"Evaluate Score: {'Accuracy': 0.8841698841698842}\n"
412412
]
413413
},
414414
{

pytest.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[pytest]
22
# 指定要忽略的文件或目录
3-
addopts = --ignore=tests/ut/transformers/generation/test_utils.py
3+
addopts = --ignore=tests/ut/transformers/generation/test_utils.py -k "not tokenization"
44

55
# 设置测试用例的日志级别
66
log_cli = true

tests/ut/transformers/models/roberta/test_modeling_roberta.py

-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848

4949
ROBERTA_TINY = "sshleifer/tiny-distilroberta-base"
5050

51-
mindspore.set_context(pynative_synchronize=True)
52-
5351
class RobertaModelTester:
5452
def __init__(
5553
self,

tests/ut/transformers/models/t5/test_modeling_t5.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,11 @@ def test_v1_1_resize_embeddings(self):
707707
config = self.model_tester.prepare_config_and_inputs()[0]
708708
self.model_tester.check_resize_embeddings_t5_v1_1(config)
709709

710-
# @slow
711-
# def test_model_from_pretrained(self):
712-
# # for model_name in T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
713-
# # for model_name in T5_PRETRAINED_MODEL_ARCHIVE_LIST:
714-
# model = T5Model.from_pretrained('t5-11b', from_pt=True)
715-
# self.assertIsNotNone(model)
710+
@slow
711+
def test_model_from_pretrained(self):
712+
for model_name in T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
713+
model = T5Model.from_pretrained(model_name)
714+
self.assertIsNotNone(model)
716715

717716
def test_generate_with_head_masking(self):
718717
attention_names = ["encoder_attentions", "decoder_attentions", "cross_attentions"]

0 commit comments

Comments
 (0)