Push model to hugging face hub without Trainer
Hi, I want to train a model for text classification usingbert-base-uncasedwith pure Pytorch (without Trainer). I wanted to push the fine tuned model to hugging face hub and I used this code:model.push_to_hub("repository_name")But when I’m trying to see the prediction of the model in the model repository on the example sentence I got this error:Can't load tokenizer using from_pretrained, please update its configuration: Can't load tokenizer for 'Zahra99/pure-python2'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'Zahra99/pure-python2' is the correct path to a directory containing all relevant files for a BertTokenizerFast tokenizer.This is shown in the following image:Screenshot 2023-05-26 at 14.17.051162×1222 88.7 KBI searched about it but actually I couldn’t find solution for my problem which how I can push the model which is trained using pure Pytorch in hugging face hub and load it later.I apperciate any help
2023-05-26T12:12:10Z
What is in'Zahra99/pure-python2'?
2023-05-26T12:49:53Z
This error comes fromhere. Maybethisissue can help.
2023-05-26T13:48:30Z
My repository includes these files:my_repo1280×395 36.9 KB
2023-05-26T13:55:04Z
I can’t openthislink.But I try the comments in the other link you sent and uploaded manuallytokenizer.jsonandtokenizer_config.jsonfrombert-base-uncasedrepository into my repository and now inference API in my repository is working. Thank you so muchBut I have a question, is this work really true? and is there any way to uploadtokenizerfiles automatically?
2023-05-26T14:08:52Z
Zahra99:But I have a question, is this work really true? and is there any way to uploadtokenizerfiles automatically?I think only theTraineruploads them automatically.I can’t openthislink.Oops, this link points to a private repo :), and it’s not that useful, to be honest.
2023-05-27T06:41:16Z
Thank you so muchThis piece of code solve the problemtokenizer.push_to_hub() # instead of adding tokenizer files manually to repository
model.push_to_hub()
2024-05-14T00:43:58Z
Hi Eventhough I use the above, the error still persist for me, any suggesstions?