Error messages when trying to use save_pretrained and load from_pretrained

Hi all,

I just have some questions about trying to fine-tune, save, and load a version of a transformer model. I am trying to fine-tune ELECTRA for sarcasm detection then reload this model to try and train on a downstream task in sarcasm subcategory classification.

I am having an issue with using the save_pretrained and model.load.from_pretrained methods. Each time I am trying to run either the save or load methods I get the following error message: AttributeError: ‘Functional’ object has no attribute ‘save_pretrained’, which I assume is because I am using Keras to build the model using the Hugging Face ELECTRA model for my base and my own classification layer on top.

I am just wondering whether there is a workaround for this please? I can’t use the Keras save and load methods because they don’t recognise ELECTRA when I’m trying to reload the model, but I can’t seem to get the Hugging Face methods to work either.

Happy to clarify anything if something doesn’t make sense :slight_smile: