Closed ShoubhikBanerjee closed 2 years ago
While trying with bart large, it gave this error. :
Error(s) in loading state_dict for BARTModel: Unexpected key(s) in state_dict: "decoder.output_projection.weight".
I need help please :(
I got the same error. Did you find the solution?
update fairseq to 0.10.2 help me out this error
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
I met the similar question when I use fair-generate on the transformer_monotonic_iwslt_de_en , the detailed tracebacks are showed below :
(torch17) lc2022@Chens-MacBook-Air main_sh % ./generate_infinite.sh Traceback (most recent call last): File "/Users/lc2022/miniconda/envs/torch17/bin/fairseq-generate", line 33, in <module> sys.exit(load_entry_point('fairseq', 'console_scripts', 'fairseq-generate')()) File "/Users/lc2022/Desktop/PycharmProj/fairseq/fairseq_cli/generate.py", line 379, in cli_main main(args) File "/Users/lc2022/Desktop/PycharmProj/fairseq/fairseq_cli/generate.py", line 41, in main return _main(args, sys.stdout) File "/Users/lc2022/Desktop/PycharmProj/fairseq/fairseq_cli/generate.py", line 94, in _main num_shards=args.checkpoint_shard_count, File "/Users/lc2022/Desktop/PycharmProj/fairseq/fairseq/checkpoint_utils.py", line 256, in load_model_ensemble num_shards, File "/Users/lc2022/Desktop/PycharmProj/fairseq/fairseq/checkpoint_utils.py", line 279, in load_model_ensemble_and_task state = load_checkpoint_to_cpu(filename, arg_overrides) File "/Users/lc2022/Desktop/PycharmProj/fairseq/fairseq/checkpoint_utils.py", line 232, in load_checkpoint_to_cpu state = _upgrade_state_dict(state) File "/Users/lc2022/Desktop/PycharmProj/fairseq/fairseq/checkpoint_utils.py", line 435, in _upgrade_state_dict registry.set_defaults(state["args"], models.ARCH_MODEL_REGISTRY[state["args"].arch]) KeyError: 'transformer_monotonic_iwslt_de_en'
on branch v0.10.2
I trained a model using codes below:
fairseq-train \ data-bin/wmt15_en_de_32k \ --simul-type infinite_lookback \ --user-dir $FAIRSEQ/example/simultaneous_translation \ --mass-preservation \ --criterion latency_augmented_label_smoothed_cross_entropy \ --latency-weight-avg 0.1 \ --max-update 50000 \ --arch transformer_monotonic_iwslt_de_en save_dir_key=lambda \ --optimizer adam --adam-betas '(0.9, 0.98)' \ --lr-scheduler 'inverse_sqrt' \ --warmup-init-lr 1e-7 --warmup-updates 4000 \ --lr 5e-4 --min-lr 1e-9 --clip-norm 0.0 --weight-decay 0.0001\ --dropout 0.3 \ --label-smoothing 0.1\ --max-tokens 3584
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
❓ Questions and Help
Getting error here...
`/usr/local/lib/python3.6/dist-packages/fairseq/checkpoint_utils.py in _upgrade_state_dict(state) 348 # set any missing default values in the task, model or other registries 349 registry.set_defaults(state["args"], tasks.TASK_REGISTRY[state["args"].task]) --> 350 registry.set_defaults(state["args"], models.ARCH_MODEL_REGISTRY[state["args"].arch]) 351 for registry_name, REGISTRY in registry.REGISTRIES.items(): 352 choice = getattr(state["args"], registry_name, None)
KeyError: 'bart_base'`
My Code
`import torch from fairseq.models.bart import BARTModel
bart = BARTModel.from_pretrained('drive/My Drive/bart.base/', checkpoint_file='checkpoint_best.pt' )`
What's your environment?
pip
):