# Encoding error while fine-tuning

**URL:** <https://discuss.huggingface.co/t/encoding-error-while-fine-tuning/8800>\
**Category:** 🤗Transformers\
**Created:** [July 29, 2021, 11:04am UTC](https://discuss.huggingface.co/t/encoding-error-while-fine-tuning/8800 "2021-07-29T11:04:33Z")\
**Posts on this page:** 3\
**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 29, 2021, 11:04am UTC](https://discuss.huggingface.co/t/encoding-error-while-fine-tuning/8800/1 "2021-07-29T11:04:33Z")

</div>

Hello there! I have a question regarding the fine-tuning of mbart. I did the training like the example here [transformers/examples/pytorch/translation at v4.6.1 · huggingface/transformers · GitHub](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:** ![snowgo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/snowgo/32/2476_2.png) [@snowgo](https://discuss.huggingface.co/u/snowgo)\
**Post date:** [August 8, 2021, 1:03pm UTC](https://discuss.huggingface.co/t/encoding-error-while-fine-tuning/8800/2 "2021-08-08T13:03:08Z")

</div>

maybe your inputpath is xxxxxxxxxxxxx/pytorch\_model.bin  
change to xxxxxxxxxxxxx/  
have a try

---

<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:** [August 10, 2021, 1:52pm UTC](https://discuss.huggingface.co/t/encoding-error-while-fine-tuning/8800/3 "2021-08-10T13:52:22Z")

</div>

Thanks, this solved it.
