I recently fine-tuned a GPT model (GPT2LMHeadModel) and tried to push it to hub. I followed the tutorial but got this strange error: ‘GPT2LMHeadModel’ object has no attribute ‘push_to_hub’
I’ve updated the transformers library to the latest version, as shown in the screenshot. Can anybody help me with that? I’ve been working on this problem for 3 hours but still in vain…
(By the way I was coding on Kaggle)
Any help is appreciated!
The correct way to push a model to the hub is by typing:
repo_path_or_name: Optional[str] = None,
repo_url: Optional[str] = None,
use_temp_dir: bool = False,
commit_message: Optional[str] = None,
organization: Optional[str] = None,
private: Optional[bool] = None,
use_auth_token: Optional[Union[bool, str]] = None,)
As can be seen here.
No that’s incorrect.
push_to_hub method is preferred when you just want to push to the Hub, and your model should have that method. Are you absolutely certain the Transformers version is correct inside your notebook? All
PreTrainedModel have the
Thanks for the reply!
Yes I used
pip install transformers==4.12.3
in the notebook to make sure the version is correct. You can see my screenshot that the library version is correct.
Something strange is that I used
to print out all the methods and attributes in the object but there’s no push_to_hub method. I even tried to use the save_pretrained method with the ‘push_to_hub’ set to true but it gives me an error saying no such parameter for the method.
It seems that even though pip updated the transformers library, some files in the library remained not updated. I really don’t understand how this happened…
I just tried again with the same notebook and this time it works!!! I changed nothing actually but just closed it and run it again after 12 hours…
So I guess it’s a bug related to the kaggle notebook. It seems the library files are cached so the newly updated files didn’t take effect somehow.