# Finetuning TrOCR on the IAM dataset

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffinetuning-trocr-on-the-iam-dataset%2F21512%3E%5C
**Category:** 🤗Transformers\
**Created:** [August 11, 2022, 6:45am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffinetuning-trocr-on-the-iam-dataset%2F21512 "2022-08-11T06:45:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![d0r1h](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/d0r1h/32/4687_2.png) [@d0r1h](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fd0r1h)%5C
**Post date:** [August 11, 2022, 6:45am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffinetuning-trocr-on-the-iam-dataset%2F21512%2F1 "2022-08-11T06:45:14Z")

</div>

I’m finetuning TrOCR model using Seq2SeqTrainer API, and I’ve taken reference from [this notebook](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TrOCR/Fine_tune_TrOCR_on_IAM_Handwriting_Database_using_Seq2SeqTrainer.ipynb).

My training is completed but there is no model saved, I’ve attached the image of the content in the output directory.

 ![snap](https://us1.discourse-cdn.com/hellohellohello/original/2X/e/e354f43fb5e7f36173198a37696d594de6473f74.jpeg)

Also, I’ve attached my training [notebook](https://colab.research.google.com/drive/1DdnvEPFGeVB1qvW6UeNdjefTOVbVbhrz#scrollTo=ldk0Q-o1v5lF) for reference.

---

<div class="post-metadata">

**Author:** ![nielsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/nielsr/32/39617_2.png) [@nielsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnielsr)%5C
**Post date:** [August 11, 2022, 10:37am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffinetuning-trocr-on-the-iam-dataset%2F21512%2F2 "2022-08-11T10:37:30Z")

</div>

Hi,

The error you’re getting is:

> OSError: Can’t load feature extractor for ‘./model’. If you were trying to load it from ‘[Models - Hugging Face](https://huggingface.co/models)’, make sure you don’t have a local directory with the same name. Otherwise, make sure ‘./model’ is the correct path to a directory containing a preprocessor\_config.json file

That’s because the `Seq2SeqTrainer` only saves the model files (namely the weights as a `pytorch_model.bin` file and the configuration as a `config.json` file).

However, you’re also loading the processor (`TrOCRProcessor`) from the directory. A processor combines a feature extractor (for the vision modality) and a tokenizer (for the text modality), hence it requires a `preprocessor_config.json` file as well as a `vocab.txt` file for the tokenizer. It seems that you’re just using this one:

```auto
processor = TrOCRProcessor.from_pretrained("microsoft/trocr-base-handwritten")

```

Hence, you can use this one when performing inference. You can always save its files using `save_pretrained`. You can see the files required here: [microsoft/trocr-base-handwritten at main](https://huggingface.co/microsoft/trocr-base-handwritten/tree/main)
