首页 PaddleNLP 帖子详情
UIE Slim 蒸馏evaluate_teacher_qm.py运行结果全部为0,运行train.py报错
收藏
快速回复
PaddleNLP 问答NLP 501 0
UIE Slim 蒸馏evaluate_teacher_qm.py运行结果全部为0,运行train.py报错
收藏
快速回复
PaddleNLP 问答NLP 501 0

%cd /home/aistudio/data_distill
!python evaluate_teacher_qm.py \
--task_type relation_extraction \
--test_path /home/aistudio/work/student_data/dev_data.json \
--label_maps_path /home/aistudio/work/student_data/label_maps.json \
--model_path /home/aistudio/checkpoint/model_qm \
--max_seq_len 64
/home/aistudio/data_distill
[2023-09-20 23:53:56,321] [ INFO] - We are using to load '/home/aistudio/checkpoint/model_qm'.
[2023-09-20 23:53:56,349] [ INFO] - We are using to load 'ernie-3.0-base-zh'.
[2023-09-20 23:53:56,349] [ INFO] - Already cached /home/aistudio/.paddlenlp/models/ernie-3.0-base-zh/ernie_3.0_base_zh_vocab.txt
[2023-09-20 23:53:56,373] [ INFO] - tokenizer config file saved in /home/aistudio/.paddlenlp/models/ernie-3.0-base-zh/tokenizer_config.json
[2023-09-20 23:53:56,374] [ INFO] - Special tokens file saved in /home/aistudio/.paddlenlp/models/ernie-3.0-base-zh/special_tokens_map.json
[2023-09-20 23:54:37,827] [ INFO] - Evaluation precision: {'entity_f1': 0.0, 'entity_precision': 0.0, 'entity_recall': 0.0, 'relation_f1': 0.0, 'relation_precision': 0.0, 'relation_recall': 0.0}

 

!python train.py \
--task_type relation_extraction \
--train_path /home/aistudio/work/student_data/train_data.json \
--dev_path /home/aistudio/work/student_data/dev_data.json \
--label_maps_path /home/aistudio/work/student_data/label_maps.json \
--num_epochs 10 \
--encoder ernie-3.0-mini-zh\
--device "gpu"\
--valid_steps 100\
--logging_steps 50\
--save_dir './checkpoint-qm'\
--batch_size 32
[2023-09-20 23:56:32,292] [ INFO] - We are using to load 'ernie-3.0-mini-zh'.
[2023-09-20 23:56:32,293] [ INFO] - Already cached /home/aistudio/.paddlenlp/models/ernie-3.0-mini-zh/ernie_3.0_mini_zh_vocab.txt
[2023-09-20 23:56:32,320] [ INFO] - tokenizer config file saved in /home/aistudio/.paddlenlp/models/ernie-3.0-mini-zh/tokenizer_config.json
[2023-09-20 23:56:32,321] [ INFO] - Special tokens file saved in /home/aistudio/.paddlenlp/models/ernie-3.0-mini-zh/special_tokens_map.json
[2023-09-20 23:56:32,324] [ INFO] - We are using to load 'ernie-3.0-mini-zh'.
[2023-09-20 23:56:32,325] [ INFO] - Model config ErnieConfig {
"attention_probs_dropout_prob": 0.1,
"enable_recompute": false,
"fuse": false,
"hidden_act": "gelu",
"hidden_dropout_prob": 0.1,
"hidden_size": 384,
"initializer_range": 0.02,
"intermediate_size": 1536,
"layer_norm_eps": 1e-12,
"max_position_embeddings": 2048,
"model_type": "ernie",
"num_attention_heads": 12,
"num_hidden_layers": 6,
"pad_token_id": 0,
"paddlenlp_version": null,
"pool_act": "tanh",
"task_id": 0,
"task_type_vocab_size": 16,
"type_vocab_size": 4,
"use_task_id": true,
"vocab_size": 40000
}

W0920 23:56:34.644626 19873 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 11.2, Runtime API Version: 11.2
W0920 23:56:34.647835 19873 gpu_resources.cc:149] device: 0, cuDNN Version: 8.2.
[2023-09-20 23:56:34,827] [ WARNING] - Some weights of the model checkpoint at ernie-3.0-mini-zh were not used when initializing ErnieModel: ['ernie.encoder.layers.6.self_attn.q_proj.weight', 'ernie.encoder.layers.6.linear1.weight', 'ernie.encoder.layers.6.self_attn.q_proj.bias', 'ernie.encoder.layers.6.linear2.bias', 'ernie.encoder.layers.6.norm2.weight', 'ernie.encoder.layers.6.self_attn.k_proj.weight', 'ernie.encoder.layers.6.norm1.bias', 'ernie.encoder.layers.6.norm1.weight', 'ernie.encoder.layers.6.self_attn.k_proj.bias', 'ernie.encoder.layers.6.self_attn.v_proj.weight', 'ernie.encoder.layers.6.self_attn.out_proj.weight', 'ernie.encoder.layers.6.norm2.bias', 'ernie.encoder.layers.6.self_attn.v_proj.bias', 'ernie.encoder.layers.6.self_attn.out_proj.bias', 'ernie.encoder.layers.6.linear1.bias', 'ernie.encoder.layers.6.linear2.weight']
- This IS expected if you are initializing ErnieModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
- This IS NOT expected if you are initializing ErnieModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
[2023-09-20 23:56:34,828] [ WARNING] - Some weights of ErnieModel were not initialized from the model checkpoint at ernie-3.0-mini-zh and are newly initialized: ['ernie.pooler.dense.weight', 'ernie.pooler.dense.bias']
You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
Traceback (most recent call last):
File "train.py", line 192, in
do_train()
File "train.py", line 67, in do_train
model = GPLinkerForRelationExtraction(encoder, label_maps)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/layers/globalpointer.py", line 107, in __init__
self.head_output = gpcls(hidden_size, num_rels, head_size=head_size, RoPE=False, tril_mask=False)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/layers/globalpointer.py", line 47, in __init__
self.dense2 = nn.Linear(head_size * 2, heads * 2)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/nn/layer/common.py", line 163, in __init__
is_bias=False,
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/nn/layer/layers.py", line 716, in create_parameter
temp_attr, shape, dtype, is_bias, default_initializer
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layer_helper_base.py", line 355, in create_parameter
"but the size of the {}-th dim is {}".format(i, size)
AssertionError: Expected every dim's size to be larger than 0, but the size of the 1-th dim is 0

信息收取任务。schema = ['姓氏','性别']。doccano_ext.json数据格式:{"id":5565,"text":"伏姓女孩起名高分","entities": [{"id": 178, "start_offset": 0, "end_offset": 2, "label": "姓氏"},{"id": 179, "start_offset": 2, "end_offset": 4, "label": "性别"}],"relations":[]}

尝试了很多次,数据都和

https://aistudio.baidu.com/projectdetail/6262450?channelType=0&channel=0

的数据进行了对齐,运行evaluate_teacher_qm.py结果都为0.train.py报错、

0
收藏
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户