Problem with push_to_hub
Hello everyone. I’m trying to upload my fine-tuned GPT-2 Model to Model Hub.When I try to use the uploading function push_to_hub I get the following error:AttributeError: 'GPT2Model' object has no attribute 'push_to_hub'In the documentation it says that I can push the model with this function.Can anybody help please?
2021-07-12T15:24:30Z
You need to update your Transformers library to the latest version.
2021-07-12T18:29:23Z
Thank you so much. I have another question. Is there a way to push a model to the model hub after training without saving the new model to the disk with trainer.save_model() ? Would Trainer.push_to_hub do that or is it for pushing just the trainer instance? If yes how can I give my authentication token as a parameter to trainer.push_to_hub method?
2021-07-12T18:43:45Z
You can set your token in the training arguments insidepush_to_hub_token.TheTrainerwill save the model on disk withsave_model, as you need to save it to the repo of the model you will be using before it can git push it to the model hub.
2021-07-13T09:07:46Z
So you mean I should set push_to_hub_token in Training arguments. Then train the model and save it using trainer.save_model() function. Then I should just recreate it from the saved file usingfine_tuned_model = AutoModel.from_pretrained("./file_path")And then finally push it to hub usingfine_tuned_model.push_to_hub("Name of model")
2021-07-13T11:44:35Z
No, you should just dotrainer.push_to_hub()once you’re done with training. Look at any of thenotebooks examplesfor more context, or thepush to hub video.
2021-07-14T14:20:04Z
Thank you very much. I was able to solve my problem after I saw the training argument “push_to_hub_model_id” and transformers-cli from your example notebook “Train a language model”.
2023-01-28T06:56:59Z
‘Functional’ object has no attribute ‘push_to_hub’screenshot-colab.research.google.com-2023.01.28-12_24_291844×658 79 KBI am facing this issue regarding push_to_hub API which does not support Functional models from TensorFlow. My model is an NMT that has custom objects.It is a custom model which I have built from scratch and does not use any methods like from_pretrained.I want to push it to huggingface as well as create a pipelinePlease help