RayeRen / multilingual-kd-pytorch

ICLR2019, Multilingual Neural Machine Translation with Knowledge Distillation
Other
70 stars 18 forks source link

Inferring a trained student model #4

Open sugeeth14 opened 5 years ago

sugeeth14 commented 5 years ago

Hi, I have trained a model for student and now I want to infer it. The BLEU scores are getting printed every 3 epochs but if I want to run inference using the command python interactive.py --path checkpoints/student-model/checkpoint_best.pt data/data-bin/ --beam 5 I am getting the following error.

| Redis disabled...
Namespace(beam=5, buffer_size=1, cpu=False, data=['data/data-bin/'], 
diverse_beam_groups=1, diverse_beam_strength=0.5, fp16=False, fp16_init_scale=128, 
fp16_scale_window=None, 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, model_overrides='{}', nbest=1, no_beamable_mm=False, no_early_stop=False, no_progress_bar=False, num_shards=1, 
path='checkpoints/student/checkpoint_best.pt', prefix_size=0, print_alignment=False, 
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, upsample_primary=1)
| [en] dictionary: 43640 types
| [de] dictionary: 43640 types
| loading model(s) from checkpoints/student-model/checkpoint_best.pt
Traceback (most recent call last):
  File "interactive.py", line 184, in <module>
    main(args)
  File "interactive.py", line 79, in main
    models, model_args = utils.load_ensemble_for_inference(model_paths, task, model_arg_overrides=eval(args.model_overrides))
  File "/Sugeeth/exp2/multilingual-kd-pytorch/fairseq/utils.py", line 158, in load_ensemble_for_inference
    model = task.build_model(args)
  File "/Sugeeth/exp2/multilingual-kd-pytorch/fairseq/tasks/fairseq_task.py", line 131, in build_model
    return models.build_model(args, self)
  File "/Sugeeth/exp2/multilingual-kd-pytorch/fairseq/models/__init__.py", line 33, in build_model
    return ARCH_MODEL_REGISTRY[args.arch].build_model(args, task)
  File "/Sugeeth/exp2/multilingual-kd-pytorch/fairseq/models/transformer.py", line 146, in build_model
    if args.task == 'universal_translation' and task.dataset('train').universal:
  File "/Sugeeth/exp2/multilingual-kd-pytorch/fairseq/tasks/fairseq_task.py", line 56, in dataset
    raise KeyError('Dataset not loaded: ' + split)
KeyError: 'Dataset not loaded: train'

Can you kindly help on how a infer a trained student model ? Thanks !

linhkid commented 2 years ago

Hi, does anyone resolve or have an answer to this? Since I also have the same issue.

Thanks!

robotsp commented 1 year ago

Same here. @linhkid @sugeeth14