Google Colab tokenizer.push_to_hub(repo_name) leads to "Repository not found"-Error
Hello,I’m using a Google Colab notebook.This line worked out:!pip install huggingface_hubNext, I wanted to write a json-file, which worked out, too:import jsonwith open(‘my_language_vocab.json’, ‘w’) as vocab_file:json.dump(vocab_dict, vocab_file)Then, I ran the following line and got an access token (able to write) from my own account:from huggingface_hub import notebook_loginnotebook_login()Next, I create a Repository and I can find it when I visit my page:from huggingface_hub import create_repocreate_repo(“Kristinabckr/testpublic2”, private=False)But if I run this line:tokenizer.push_to_hub(repo_name)#Itried “Kristinabckr/testpublic2” and “testpublic2” for#repo_nameI get the following Error:HTTPError                                 Traceback (most recent call last)/usr/local/lib/python3.7/dist-packages/huggingface_hub/utils/_errors.py in REDACTED_TOKEN_for_status(response, endpoint_name)212     try:→ 213         response.raise_for_status()214     except HTTPError as e:9 framesHTTPError: 401 Client Error: Unauthorized for url:https://huggingface.co/api/repos/createThe above exception was the direct cause of the following exception:RepositoryNotFoundError                   Traceback (most recent call last)/usr/local/lib/python3.7/dist-packages/huggingface_hub/utils/_errors.py in REDACTED_TOKEN_for_status(response, endpoint_name)240                 + “\nIf the repo is private, make sure you are authenticated.”241             )→ 242             raise RepositoryNotFoundError(message, response) from e243244         elif response.status_code == 400:RepositoryNotFoundError: 401 Client Error. (Request ID: AfU1Ldq9xvEPG6pNZ_3jE)Repository Not Found for url:https://huggingface.co/api/repos/create.Please make sure you specified the correctrepo_idandrepo_type.If the repo is private, make sure you are authenticated.Unauthorized - Unauthorized
2022-11-08T12:19:15Z
I am facing the same problem.
2022-11-08T20:46:32Z
I’m getting the same error:(
2022-11-09T01:40:12Z
Hey all! I was not able to reproduce the error. This is my code# !pip install huggingface_hub transformers
from huggingface_hub import notebook_login, create_repo
from transformers import AutoTokenizer

notebook_login()
create_repo("osanseviero/test_bug", private=False)

tokenizer = AutoTokenizer.from_pretrained("gpt2")
tokenizer.push_to_hub("osanseviero/test_bug")
# Result commit https://huggingface.co/osanseviero/test_bug/commit/42718dae9d039325f55143cbff23f57c5098eb7dWould you be able to share a fully reproducible example that causes this bug?
2022-11-09T01:40:19Z
cc@Wauplin
2022-11-09T08:57:52Z
Wasn’t able to reproduce the error either (with@osanseviero's snippet).Just to be sure,notebook_login()has to be run in a separate code block, but I guess that’s already what you are doing.Once logged in, could you try to run the following lines and tell us the result ?from huggingface_hub import whoami

whoami()
# you should see something like {'type': 'user',  'id': '...',  'name': 'Wauplin', ...}andfrom huggingface_hub import HfFolder

HfFolder().get_token()
# you should see your token is well savedandcreate_repo("test_bug_temporary", token="hf_***") # explicitly paste your token
2022-11-13T11:51:47Z
Thank you so much, this solved my problem. I therafter was able to successfully run those lines from@osanseviero:tokenizer = AutoTokenizer.from_pretrained(“gpt2”)tokenizer.push_to_hub(“osanseviero/test_bug”)
2022-11-21T18:15:55Z
Hello,I tried the Wav2Vec2CTCTokenizer instead of AutoTokenizer. Unfortunately, when I run the following cell:tokenizer.push_to_hub(“test_bug_temporary_private_333”)then I get the following Error:TypeError                                 Traceback (most recent call last)in1#tokenizer= AutoTokenizer.from_pretrained(“gpt2”)#works2#tokenizer.push_to_hub(“test_bug_temporary_private_333”, organization = None)#doesnotwork----> 3 tokenizer.push_to_hub(“test_bug_temporary_private_333”)#doesnot work4#tokenizer.push_to_hub(repo_name)#doesnot work54 frames/usr/local/lib/python3.7/dist-packages/huggingface_hub/utils/_deprecation.py in inner_f(*args, **kwargs)43             )44             kwargs.update(zip(sig.parameters, args))—> 45             return f(**kwargs)4647         return inner_fTypeError: create_repo() got an unexpected keyword argument ‘organization’Thank you very much in advance for your help!
2022-11-22T12:50:49Z
Hi@Kristinabckr, in the latest version ofhuggingface_hub(v0.11 that you are probably having), you cannot specifyorganizationin a separate keyword argument. It has been deprecated for some time and is now completely removed.What you should do it build arepo_idand provide it topush_to_hub. Example:# Will default to user namespace
tokenizer.push_to_hub("my-tokenizer")

# Explicit username
tokenizer.push_to_hub("username/my-tokenizer")

# Explicit organization
tokenizer.push_to_hub("my-organization/my-tokenizer")Hope this helps youPlease let me know if you need any further information.
2022-11-23T02:54:00Z
Hi@Wauplin- I got the same error. Could you please elaborate what you meant by " What you should do it build arepo_idand provide it topush_to_hub?I tried:token = “my-tokenizer”tokenizer.push_to_hub(token )Thank you!
2022-11-23T09:11:02Z
@caozxin1230What I meant by “building the repo_id yourself” is that instead of doingtokenizer.push_to_hub(“test_bug”, organization="my_organization")You should dotokenizer.push_to_hub(“my_organization/test_bug”)But in your case it seems that you don’t need that.To help you debug it, could you tell me which versions ofhuggingface_hub,transformersandtokenizeryou are using ? You can find this information by runningpip freezein your local environment.
2022-11-23T10:57:54Z
Wauplin:pip freezeHi,These aremy versions :huggingface-hub==0.11.0transformers==4.17.0tokenizers==0.13.2I’m still having the same error with this:tokenizer.push_to_hub(“my_organization/test_bug”) → error:create_repo() got an unexpected keyword argument ‘organization’Thank you
2022-11-23T17:17:14Z
Hi@Wauplin,yes I have the v0.11.0. I created a repo with “MyUsername/test_pushtohub” (since I am not in any organization, I used my user account name). This new created repo can be seen by me in my hugging face account.Unfortunately, when I run the tokenizer and then run tokenizer.push_to_hub(“MyUsername/test_pushtohub”) the same Error as before occurs:TypeError: create_repo() got an unexpected keyword argument ‘organization’There is also written in the Error message:/usr/local/lib/python3.7/dist-packages/huggingface_hub/utils/_deprecation.py:42: FutureWarning: Deprecated positional argument(s) used in ‘create_repo’: pass token=‘test_pushtohub’ as keyword args. From version 0.12 passing these as positional arguments will result in an error,FutureWarning,…Is there a problem with the Python 3.7 version?
2022-11-25T10:41:23Z
Hi@enrybds, you have to upgradetransformersto a newer version. Your version (4.17) has been released inmarch 2022and is therefore not compatible with the latest version ofhuggingface_hub. Another solution is to downgradehuggingface_hubversion to 0.10.Hi@KristinabckrI guess your issue is similar even though I don’t know which version are installed in your environment. In any case, it is not a Python3.7 issue.
2022-11-25T15:27:52Z
Hi everyone,I tried with different versions and realized that you have to change the version of transformers to 4.24.0 (released this month!) and finally my tokenizer could push to hub withtokenizer.push_to_hub(“MyName/MyRepo”)these are my versions:transformers==4.24.0tokenizers== 0.13.2huggingface_hub==0.11I hope it works for you, too!@enrybds
2023-03-01T08:41:41Z
Thanks a lot! This worked for me.
2023-09-10T05:33:09Z
Hi@Wauplin, I am trying to push a model that I trained in google colab to hugging face hub in my account using-trainer.push_to_hub(‘my_username/my_model_name’) / trainer.push_to_hub()but getting the following error-Repository Not Found for url:https://huggingface.co/api/models/results.Please make sure you specified the correctrepo_idandrepo_type.If you are trying to access a private or gated repo, make sure you are authenticated.I have done a few checks:my hf token if it is saved in the notebook using - HfFolder().get_token()my hf account info using - whoami()versions- huggingface-hub==0.16.4 / 0.11, transformers==4.33.1 / 4.24.0, tokenizers==0.13.3Tried with transformers 0.24 but same error.Please let me know where I am going wrong.Thank you!