# How to load finetuned model in TF

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-finetuned-model-in-tf%2F1272%3E%5C
**Category:** Beginners\
**Created:** [September 28, 2020, 5:54am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-finetuned-model-in-tf%2F1272 "2020-09-28T05:54:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgedittmar](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@georgedittmar](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fgeorgedittmar)%5C
**Post date:** [September 28, 2020, 5:54am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-finetuned-model-in-tf%2F1272%2F1 "2020-09-28T05:54:12Z")

</div>

So I trained a new gpt2 model using the language modeling script and it spits out a pytorch.bin file that I assume is the model. How do I go about converting it to TF 2.0? I see there is a convert script but I am not sure if I can just run that to make it TF compatible?

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsgugger)%5C
**Post date:** [September 28, 2020, 2:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-finetuned-model-in-tf%2F1272%2F2 "2020-09-28T14:30:22Z")

</div>

You should create your model like this:

```auto
from transformers import TFGPT2Model
model = TFGPT2Model.from_pretrained("path_to_dir", from_pt=True)

```

where `path_to_dir` should be replaced with the path to the directory where your pytorch model is (what you set in ` GPT2Model.save_pretrained()`).

Then you can use your TF model and save it with the `save_pretrained` method.

---

<div class="post-metadata">

**Author:** ![georgedittmar](https://avatars.discourse-cdn.com/v4/letter/g/ecccb3/32.png) [@georgedittmar](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fgeorgedittmar)%5C
**Post date:** [September 28, 2020, 8:15pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-load-finetuned-model-in-tf%2F1272%2F3 "2020-09-28T20:15:30Z")

</div>

Awesome, I’ll give that try. I missed that from\_pt param.
