# Encoding error with fine-tuned model

**URL:** <https://discuss.huggingface.co/t/encoding-error-with-fine-tuned-model/8769>\
**Category:** Models\
**Created:** [July 28, 2021, 2:24pm UTC](https://discuss.huggingface.co/t/encoding-error-with-fine-tuned-model/8769 "2021-07-28T14:24:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudia](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@claudia](https://discuss.huggingface.co/u/claudia)\
**Post date:** [July 28, 2021, 2:24pm UTC](https://discuss.huggingface.co/t/encoding-error-with-fine-tuned-model/8769/1 "2021-07-28T14:24:30Z")

</div>

Hello there! I have a question regarding the fine-tuning of mbart. I did the training like the example here [https://github.com/huggingface/transformers/tree/v4.6.1/examples/pytorch/translation](https://github.com/huggingface/transformers/tree/v4.6.1/examples/pytorch/translation) and obtained a model `pytorch_model.bin`  
However when trying to use the model to translate I get an UnicodeDecodeError `UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte`  
The complete error is the following. As far as I can see it produces when loading the model I obtained from fine-tuning.

```auto
Traceback (most recent call last):
  File "mbart/predict.py", line 41, in <module>
    main()
  File "mbart/predict.py", line 21, in main
    model = MBartForConditionalGeneration.from_pretrained(opt.model)
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/transformers/modeling_utils.py", line 1080, in from_pretrained
    **kwargs,
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/transformers/configuration_utils.py", line 427, in from_pretrained
    config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/transformers/configuration_utils.py", line 495, in get_config_dict
    config_dict = cls._dict_from_json_file(resolved_config_file)
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/site-packages/transformers/configuration_utils.py", line 578, in _dict_from_json_>
    text = reader.read()
  File "/home/claudia/anaconda3/envs/speechenv/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte

```

Any ideas on how to solve this?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![RylanSchaeffer](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@RylanSchaeffer](https://discuss.huggingface.co/u/RylanSchaeffer)\
**Post date:** [October 4, 2021, 10:11pm UTC](https://discuss.huggingface.co/t/encoding-error-with-fine-tuned-model/8769/2 "2021-10-04T22:11:57Z")

</div>

@claudia did you ever solve this?
