# Mbart finetuning

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmbart-finetuning%2F8806%3E%5C
**Category:** Models\
**Created:** [July 29, 2021, 2:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmbart-finetuning%2F8806 "2021-07-29T14:52:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudia](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@claudia](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fclaudia)%5C
**Post date:** [July 29, 2021, 2:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fmbart-finetuning%2F8806%2F1 "2021-07-29T14:52:09Z")

</div>

Hello

I am using the run\_translation.py script from [transformers/examples/pytorch/translation at v4.6.1 · huggingface/transformers · GitHub](https://github.com/huggingface/transformers/tree/v4.6.1/examples/pytorch/translation)  
The command I am using is the following

```auto
python mbart/run_translation.py --model_name_or_path facebook/mbart-large-50-many-to-many-mmt --do_train --do_eval --do_predict --source_lang source --target_lang target --train_file /shares/cofi/FlemishSpeechToText/models/europarl/train_cased_small.json --max_source_length=56 --max_target_length=56 --validation_file /shares/cofi/FlemishSpeechToText/models/europarl/val_cased_small.json --test_file /shares/cofi/FlemishSpeechToText/models/europarl/test_cased_small.json --output_dir /home/claudia/SpeechDataExp/model_europarl_small/ --per_device_train_batch_size=2 --per_device_eval_batch_size=2 --num_train_epochs=3.0 --save_steps=5000 --overwrite_output_dir --predict_with_generate

```

Normally passing the parameter `--predict_with_generate` and a test set should produce an output with the translations. However I get an error during the fine-tuning process and I don’t obtain the translations

```auto
{'loss': 0.2652, 'learning_rate': 0.0, 'epoch': 3.0}
{'train_runtime': 10697.4203, 'train_samples_per_second': 2.804, 'epoch': 3.0}
07/29/2021 13:26:29 - INFO - __main__ - ***Evaluate***
 *****Running Evaluation*****
  Num examples = 2000
  Batch size = 6
/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/torch/nn/parallel/>
  warnings.warn('Was asked to gather along dimension 0, but all '
^M 0%| | 0/334 [00:00<?, ?it/s]^M 1%| | 2/334 [00:01<04:37, 1.20>
  File "mbart/run_translation.py", line 602, in <module>
    main()
  File "mbart/run_translation.py", line 541, in main
    max_length=data_args.val_max_target_length, num_beams=data_args.num_beams, metric>
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/transforme>
    return super().evaluate(eval_dataset, ignore_keys=ignore_keys, metric_key_prefix=>
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/transforme>
    metric_key_prefix=metric_key_prefix,
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/transforme>
    metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, label_ids=al>
  File "mbart/run_translation.py", line 496, in compute_metrics
    result = metric.compute(predictions=decoded_preds, references=decoded_labels)
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/datasets/m>
    output = self._compute(predictions=predictions, references=references, **kwargs)
  File "/home/claudia/.cache/huggingface/modules/datasets_modules/metrics/sacrebleu/4>
    use_effective_order=use_effective_order,
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/sacrebleu/>
    sys_stream, ref_streams, use_effective_order=use_effective_order)
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/sacrebleu/>
    raise EOFError("No valid references for a sentence!")
EOFError: No valid references for a sentence!
^M100%|██████████| 334/334 [09:48<00:00, 1.76s/it]

```

Any help?
