dbiir / UER-py

Open Source Pre-training Model Framework in PyTorch & Pre-trained Model Zoo
https://github.com/dbiir/UER-py/wiki
Apache License 2.0
3.01k stars 525 forks source link

convert_t5_from_uer_to_huggingface.py运行报错 #339

Closed ColaFei closed 2 years ago

ColaFei commented 2 years ago

python3 scripts/convert_t5_from_uer_to_huggingface.py --input_model_path cluecorpussmall_t5_small_seq512_model.bin-250000 --output_model_path pytorch_model.bin --layers_num 12 --type t5

当我执行上述脚本时报错如下,麻烦看看为什么会出现这种问题: File "scripts/convert_t5_from_uer_to_huggingface.py", line 27, in input_model["decoder.self_pos_emb.relative_attention_bias.weight"] KeyError: 'decoder.self_pos_emb.relative_attention_bias.weight'

hhou435 commented 2 years ago

请问具体用的哪个模型呢或者用的哪个训练指令呢?以及是想把UER模型转成Huggingface格式么?

ColaFei commented 2 years ago

是的,我尝试把t5的 UER模型,即cluecorpussmall_t5_small_seq512_model.bin,转成 Huggingface 格式,执行以下命令会报上述错误: python3 scripts/convert_t5_from_uer_to_huggingface.py --input_model_path cluecorpussmall_t5_small_seq512_model.bin --output_model_path pytorch_model.bin --layers_num 12 --type t5

hhou435 commented 2 years ago

可以发一下训练的命令我看一下

ColaFei commented 2 years ago

只是执行模型转换指令: python3 scripts/convert_t5_from_uer_to_huggingface.py --ipput_model_path cluecorpussmall_t5_base_seq512_model.bin --output_model_path pytorch_model.bin --layers_num 12 --type t5

hhou435 commented 2 years ago

image 我们之前对代码进行了一次比较大的更新,这个错误应该是因为用旧版代码训练的模型权重名称没有和现在的代码对齐哈,可以把转换脚本里面所有的decoder前加上target. ,我们后续也会重新上传新版本的模型哈

ColaFei commented 2 years ago

好的,感谢解答