# T5 fine-tuning for custom output

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ft5-fine-tuning-for-custom-output%2F13998%3E%5C
**Category:** Beginners\
**Created:** [January 22, 2022, 4:39pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ft5-fine-tuning-for-custom-output%2F13998 "2022-01-22T16:39:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![oras](https://avatars.discourse-cdn.com/v4/letter/o/59ef9b/32.png) [@oras](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Foras)%5C
**Post date:** [January 22, 2022, 4:39pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ft5-fine-tuning-for-custom-output%2F13998%2F1 "2022-01-22T16:39:56Z")

</div>

Hi,  
I am trying to fine-tune a model to extract custom data from a sentence. The data looks like this:

| text | target |
| --- | --- |
| We are open from 8 am to 6 pm | 8-6 |
| The store working hours are 8-8 | 8-8 |
| Some random text | none |

I tried to fine-tune the T5 base to do this task but the generated text didn’t follow the custom dataset.

Steps I followed:

1. Load T5ForConditionalGeneration and T5Tokenizer.
2. Load my custom dataset.
3. Tokenize the text data with a prefix for tokenizer “extract working hours:”.
4. Train using Trainer.
5. Save the model locally.
6. Load model.
7. Apply transformers pipeline to generate text.

I also tried to use a custom function to tokenize the input and decode output instead of using the pipeline, which didn’t generate the expected output.

Next, I copied [Fine Tuning T5 Transformer Model with PyTorch](https://shivanandroy.com/fine-tune-t5-transformer-with-pytorch/) colab notebook and replaced the dataset with mine. The generated text wasn’t correct either.

Is T5 the right model for what I am trying to achieve? If not, which model would you recommend for this task?

Thank you!
