Repo model google/gemma-2b is gated. You must be authenticated to access it.
Hi all,
I'm trying to install Gemma-2b locally (Running the model on a CPU) and following the instructions on the model card.
I ran..
from transformers import AutoTokenizer, AutoModelForCausalLM
All good!
When I try running...
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b")
I get Cannot access gated repo for url https://huggingface.co/google/gemma-2b/resolve/main/config.json. Repo model google/gemma-2b is gated. You must be authenticated to access it.
Looking at the HuggingFace WebUI - I have access.. screenshot attched
Can anyone help me out?
Many Thanks
Ian
I got similar issue, and now it's fixed after updating:
pip install -U transformers
Hi
@IanKelly63
Make sure to login to HF-hub in your local instance by doing huggingface-cli login
and pasting your read token
I also had the same issue, turns out I need to create a .env file and put the Access token there, instead of just using it in the .py file.
This also worked for me:
- Create token: https://huggingface.co/settings/tokens
- Add the token to your tokenizer & model
access_token = "hf_..."
tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b-it", token=access_token)
model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it", token=access_token)
I have the same problem huggingface-cli download google/gemma-2-9b-i
does not work despite that i have made sure that im logged in with the right token
Traceback (most recent call last):
File "/mnt/vast/home/wendy/envs/mistral_env/bin/huggingface-cli", line 8, in <module>
sys.exit(main())
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/commands/huggingface_cli.py", line 51, in main
service.run()
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/commands/download.py", line 146, in run
print(self._download()) # Print path to downloaded files
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/commands/download.py", line 180, in _download
return snapshot_download(
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py", line 233, in snapshot_download
raise api_call_error
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/_snapshot_download.py", line 164, in snapshot_download
repo_info = api.repo_info(repo_id=repo_id, repo_type=repo_type, revision=revision, token=token)
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 2491, in repo_info
return method(
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 2301, in model_info
hf_raise_for_status(r)
File "/mnt/vast/home/wendy/envs/mistral_env/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 352, in hf_raise_for_status
raise RepositoryNotFoundError(message, response) from e
huggingface_hub.utils._errors.RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-668d10b6-2a6202857b11034c4ef3c926;3ed0e486-a107-47e7-9a5c-5a49d4773f40)
Repository Not Found for url: https://huggingface.co/api/models/google/gemma-2-9b-i/revision/main.
Please make sure you specified the correct `repo_id` and `repo_type`.
If you are trying to access a private or gated repo, make sure you are authenticated.
I have the same problem
huggingface-cli download google/gemma-2-9b-i
does not work despite that i have made sure that im logged in with the right token
Just a bling guess: typo in the model's namehuggingface-cli download google/gemma-2-9b-it