Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fairseq error "Could not infer task type" #17

Open
testzer0 opened this issue Sep 7, 2023 · 0 comments
Open

Fairseq error "Could not infer task type" #17

testzer0 opened this issue Sep 7, 2023 · 0 comments

Comments

@testzer0
Copy link

testzer0 commented Sep 7, 2023

Hi,
I followed the steps of the repository (set up the fairseq included and downloaded the checkpoints). Then, as instructed, I ran:

python eval_scripts/eval_longmem_icl.py --path checkpoints/gpt2_medium/checkpoint_last.pt

Which leads to the following error:

Traceback (most recent call last):
  File "/scratch/gpfs/ab4197/LongMem/eval_scripts/eval_longmem_icl.py", line 168, in <module>
    main(args)
  File "/scratch/gpfs/ab4197/LongMem/eval_scripts/eval_longmem_icl.py", line 99, in main
    model, _ = load_model_ensemble([args.path], arg_overrides=override_args, task=None)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/gpfs/ab4197/anaconda3/.conda/envs/ab/lib/python3.11/site-packages/fairseq/checkpoint_utils.py", line 374, in load_model_ensemble
    ensemble, args, _task = load_model_ensemble_and_task(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/gpfs/ab4197/anaconda3/.conda/envs/ab/lib/python3.11/site-packages/fairseq/checkpoint_utils.py", line 443, in load_model_ensemble_and_task
    task = tasks.setup_task(cfg.task, from_checkpoint=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/gpfs/ab4197/anaconda3/.conda/envs/ab/lib/python3.11/site-packages/fairseq/tasks/__init__.py", line 44, in setup_task
    task is not None
AssertionError: Could not infer task type from {'_name': 'gpt_pretraining', 'data': '/mnt/msranlp/shaohanh/data/tnlg_config/', 'sample_break_mode': 'none', 'tokens_per_sample': 1024, 'output_dictionary_size': -1, 'self_target': False, 'future_target': False, 'past_target': False, 'add_bos_token': False, 'max_target_positions': None, 'shorten_method': 'none', 'shorten_data_split_list': '', 'pad_to_fixed_length': False, 'pad_to_fixed_bsz': False, 'gpt2_encoder_json': 'gpt2_bpe/encoder.json', 'gpt2_vocab_bpe': 'gpt2_bpe/vocab.bpe', 'required_batch_size_multiple': 1, 'batch_read_ahead': 5000, 'mlm_cut_length': 128, 'mlm_tokens_proportion': 0.23, 'gpt_dict_path': 'gpt2_bpe/dict.txt', 'seed': 1, 'batch_size': 4, 'batch_size_valid': 4, 'data_buffer_size': 10, 'tpu': False, 'use_plasma_view': False, 'plasma_path': '/tmp/plasma'}. Available argparse tasks: dict_keys(['hubert_pretraining', 'speech_unit_modeling', 'translation', 'multilingual_translation', 'translation_lev', 'translation_from_pretrained_bart', 'audio_pretraining', 'nlu_finetuning', 'denoising', 'speech_to_text', 'text_to_speech', 'frm_text_to_speech', 'translation_multi_simple_epoch', 'simul_speech_to_text', 'simul_text_to_text', 'span_masked_lm', 'sentence_ranking', 'audio_finetuning', 'language_modeling', 'speech_dlm_task', 'cross_lingual_lm', 'translation_from_pretrained_xlm', 'masked_lm', 'speech_to_speech', 'audio_classification', 'semisupervised_translation', 'sentence_prediction', 'sentence_prediction_adapters', 'online_backtranslation', 'multilingual_denoising', 'legacy_masked_lm', 'multilingual_language_modeling', 'multilingual_masked_lm', 'dummy_lm', 'dummy_masked_lm', 'dummy_mt']). Available hydra tasks: dict_keys(['hubert_pretraining', 'speech_unit_modeling', 'translation', 'translation_lev', 'audio_pretraining', 'nlu_finetuning', 'denoising', 'simul_text_to_text', 'span_masked_lm', 'audio_finetuning', 'language_modeling', 'speech_dlm_task', 'translation_from_pretrained_xlm', 'masked_lm', 'audio_classification', 'sentence_prediction', 'sentence_prediction_adapters', 'multilingual_denoising', 'multilingual_language_modeling', 'dummy_lm', 'dummy_masked_lm'])

It seems like the checkpoint should include a "task" key but doesn't - how may I fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant