alibaba / AliceMind

ALIbaba's Collection of Encoder-decoders from MinD (Machine IntelligeNce of Damo) Lab
Apache License 2.0
1.97k stars 292 forks source link

can sdcup models be called by transformers interface? #46

Open michaelxu1107 opened 2 years ago

michaelxu1107 commented 2 years ago

can sdcup models be called by transformers interface? such as TapasForQuestionAnswering, thanks

grygg commented 2 years ago

Hello, you can convert the model format to huggingface using this script. Well, I also suggest you apply the offered code.

michaelxu1107 commented 2 years ago

hello, thanks for reply, but when I use script show above to convert model, it shows error below

$ python convert_bert_from_uer_to_huggingface.py --input_model_path "./sdcup_base_model.bin-50000" --output_model_path "./pytorch_model.bin" Traceback (most recent call last): File "/home/smart_qa/sdcup/convert_bert_from_uer_to_huggingface.py", line 82, in main() File "/home/smart_qa/sdcup/convert_bert_from_uer_to_huggingface.py", line 58, in main output_model["bert.embeddings.word_embeddings.weight"] = input_model["embedding.word_embedding.weight"] KeyError: 'embedding.word_embedding.weight'

grygg commented 2 years ago

You can print the key names of the loaded model, maybe you need alignment the key names.