Save custom transformer as PreTrainedModel

There might be a better way, but I would:

  • subclass PretrainedModel with your own class
  • load your trained model weights into this new class
  • run yourmodel.save_pretrained() to save the model weights for this class
  • now you can do YourCustomModel.from_pretrained() as it now can use those HF methods
1 Like