huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
128.52k stars 25.49k forks source link

convert Fairseq to huggingface error #31193

Open nichellehouston opened 1 month ago

nichellehouston commented 1 month ago

after train model with Fairseq when convert to huggingface show error

!fairseq-train \ "./data_bin/" \ --arch lstm \ --encoder-layers 1\ --decoder-layers 1\ --optimizer adam --adam-betas '(0.9, 0.98)' --clip-norm 0.0 \ --lr 2e-3 --lr-scheduler inverse_sqrt --warmup-init-lr 0.0025 --warmup-updates 4000 \ --dropout 0.25 --weight-decay 0.0001 \ --criterion label_smoothed_cross_entropy --label-smoothing 0.2 \ --max-tokens 4096 \ --eval-bleu \ --eval-bleu-args '{"beam": 5, "max_len_a": 1.2, "max_len_b": 10}' \ --eval-bleu-detok moses \ --eval-bleu-print-samples \ --best-checkpoint-metric bleu --maximize-best-checkpoint-metric \ --fp16 --memory-efficient-fp16 \ --max-epoch 5 \ --save-dir ./data_bin/checkpoints/ \ --tensorboard-logdir ./data_bin/logs

!python /content/z/src/transformers/convert_fsmt_original_pytorch_checkpoint_to_pytorch.py --model-path /content/data_bin/checkpoints/checkpoint_best.pt --dis /content/x

/usr/local/lib/python3.10/dist-packages/transformers/utils/generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. _torch_pytree._register_pytree_node( Traceback (most recent call last): File "/content/z/src/transformers/convert_fsmt_original_pytorch_checkpoint_to_pytorch.py", line 35, in from transformers.configuration_fsmt import FSMTConfig ModuleNotFoundError: No module named 'transformers.configuration_fsmt'

RUFFY-369 commented 1 month ago

Hi @nichellehouston , have you modified the weights conversion file because the original conversion file won't throw such errors as the correct importing code is from transformers import FSMTConfig. If you have modified it then please correct your import line for removing the error.

github-actions[bot] commented 12 hours ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.