Saving custom and/or finetuned models without the HUB

Is there a way to save a custom and/or finetuned model without using the Huggingface Hub? I am unable to use the service at this time for security reasons. When I try to use the Keras or MLFlow native methods to save the model I run into errors associated with custom layers associated with the Huggingface implementation.


if you are using the huggingface trainer you can simply save a model with the command

trainer.save_model(<Path>) where <Path> is the path as a string where you want to save your model.
Maybe you should do the huggingface course to get more information (Transformer models - Hugging Face Course) :slight_smile:

Hello, I am currently trying to use the mode.save_pretrained() method using TensorFlow although it doesn’t seem to be working - is this equivalent to the save_model() method with the trainer?

if you have loaded the model via the transformer library and trained the model with the Trainer API then yes it is the equivalent :slight_smile: