Fairseq: problem with interactive.py (wmt en-fr model)

Created on 20 Jun 2018  路  2Comments  路  Source: pytorch/fairseq

I downloaded the en-fr wmt model and am trying to use the interactive.py script.

But when I run as indicated on the README:
python interactive.py --path $MODEL_DIR/model.pt $MODEL_DIR --beam 5
I get the following error:
Namespace(beam=5, buffer_size=1, cpu=False, data='wmt14.en-fr.fconv-py', gen_subset='test', left_pad_source='True', left_pad_target='False', lenpen=1, log_format=None, log_interval=1000, max_len_a=0, max_len_b=200, max_sentences=1, max_source_positions=1024, max_target_positions=1024, max_tokens=None, min_len=1, nbest=1, no_beamable_mm=False, no_early_stop=False, no_progress_bar=False, num_shards=1, path='wmt14.en-fr.fconv-py/model.pt', prefix_size=0, quiet=False, raw_text=False, remove_bpe=None, replace_unk=None, sampling=False, sampling_temperature=1, sampling_topk=-1, score_reference=False, seed=1, shard_id=0, skip_invalid_size_inputs_valid_test=False, source_lang=None, target_lang=None, task='translation', unkpen=0, unnormalized=False) Traceback (most recent call last): File "interactive.py", line 162, in <module> main(args) File "interactive.py", line 72, in main task = tasks.setup_task(args) File "/private/home/aconneau/projects/fairseq/fairseq/tasks/__init__.py", line 19, in setup_task return TASK_REGISTRY[args.task].setup_task(args) File "/private/home/aconneau/projects/fairseq/fairseq/tasks/translation.py", line 55, in setup_task raise Exception('Could not infer language pair, please provide it explicitly') Exception: Could not infer language pair, please provide it explicitly

I tried adding "--source_lang en --target_lang fr" to the list of parameters but it outputs:
interactive.py: error: unrecognized arguments: --source_lang en --target_lang fr

Thanks for your help

Most helpful comment

can you try --source-lang and --target-lang? (dash instead of underscore)

All 2 comments

can you try --source-lang and --target-lang? (dash instead of underscore)

Indeed, thanks! :)

Was this page helpful?
0 / 5 - 0 ratings