How to load finetuned model in TF
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?
2020-09-28T14:30:22Z
You should create your model like this:from transformers import TFGPT2Model
model = TFGPT2Model.from_pretrained("path_to_dir", from_pt=True)wherepath_to_dirshould be replaced with the path to the directory where your pytorch model is (what you set inGPT2Model.save_pretrained()).Then you can use your TF model and save it with thesave_pretrainedmethod.
2020-09-28T20:15:30Z
Awesome, I’ll give that try. I missed that from_pt param.