Saving a model and loading it

Hi Samuel, you need to pass the folder with all the exported files to load the model. For example:

from transformers import T5ForConditionalGeneration

model = T5ForConditionalGeneration.from_pretrained("t5-small")

model.save_pretrained("/home/my_name/Desktop/t5small", from_pt=True) 

And then, you can load the model:

model = T5ForConditionalGeneration.from_pretrained("/home/my_name/Desktop/t5small")
4 Likes