Cannot access gated repo You must be authenticated to access it.
Got the following error today and it works yesterday.
Cannot access gated repo for url https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2/resolve/main/config.json.
Repo model mistralai/Mistral-7B-Instruct-v0.2 is gated. You must be authenticated to access it.
Any ideas about how to get the authentication? Thanks!
Same
I passed hugging face token to constructor and it worked
How do I do that?
why?
same
istrli
I have another machine with cached file. By using that cached file, it works but needs to find a formal solution.
The cache file can be found in ~/.cache/huggingface
Same problem I can face today so what is the solution of this problem or how to handle it?
Make a request to access the repo and then pass a access token by passing token=<your_token>
.
from huggingface_hub import login
login(token="your_access_token")
An access_token_can be get by your hugging face account settings
This worked for me:
I went to model card and clicked "Agree and access repository". Then I was able to start downloading.
sadly this did not work for me. I also tried putting my huggingface token in my privategpt settings.yaml file without success. Not sure what others have done here. The information is too vague (I do not understand it well enough) for me to follow.
Same issue... I am trying to use this with VLLM. How to pass token with vllm
Same
pip install --upgrade huggingface_hub
huggingface-cli login
YOUR_ACCESS_TOKEN
Done
pip install --upgrade huggingface_hub
huggingface-cli login
YOUR_ACCESS_TOKEN
Done
THANK YOU.
why? without any heads up, this just broke so many pipelines in production.
why? without any heads up, this just broke so many pipelines in production.
if you rely on a free service, and dont plan ahead for it to vanish totally tomorow. you get burnt. What happens when HF start charging for any access? Or they vanish, due technical problems, throw in the towel, or are shut down forcefully.. "whaaaa i should have got the files downloaded locally to keep" ( or even a project. )
it worked for me after "Agree and access repository" but now it's not working again. What could be the possible solution.
bla bla nonsense bla bla whining
ignore
I passed hugging face token to constructor and it worked
Why do we need to use this token to run this model on local environment?
This worked for me:
I went to model card and clicked "Agree and access repository". Then I was able to start downloading.sadly this did not work for me. I also tried putting my huggingface token in my privategpt settings.yaml file without success. Not sure what others have done here. The information is too vague (I do not understand it well enough) for me to follow.
What if I need to handle this on server, How to do this in server?
It works for me in google collab in doing this after cliking on the model "Agree and access repository"
!pip install --upgrade huggingface_hub
!huggingface-cli login --token $REPLACE_WITH_YOUR_TOKEN_ON_HUGGING_FACE
Result :
The token has not been saved to the git credentials helper. Pass `add_to_git_credential=True` in this function directly or `--add-to-git-credential` if using via `huggingface-cli` if you want to set the git credential as well.
Token is valid (permission: read).
Your token has been saved to /root/.cache/huggingface/token
Login successful
When you want to do through your terminal where you have your active environment .
Just run two command.
- pip install --upgrade huggingface_hub
- huggingface-cli login --token "Your access token"
Then you will see something like this
The token has not been saved to the git credentials helper. Passadd_to_git_credential=True
in this function directly or--add-to-git-credential
if using viahuggingface-cli
if you want to set the git credential as well.
Token is valid (permission: write).
Your token has been saved to /home/.cache/huggingface/token
Login successful
All set!!!!!!!!!!!!!!1
I had to go to the model's page on huggingface and click "I accept the terms" in order for the download to work.
Everybody talks about the TOKEN but where is this token gotten from? How do we get this token?
I passed hugging face token to constructor and it worked
What token?
I passed hugging face token to constructor and it worked
What token?
Obviously and like any API service you use, you should go to your user settings and generate a token for using the API.
Just google "how to generate token for huggingface hub".
I passed hugging face token to constructor and it worked
What token?
https://huggingface.co/docs/hub/security-tokens
..also check https://huggingface.co/docs/hub/spaces-sdks-docker#secrets-and-variables-management
Firstly, do this -->
from huggingface_hub import login
login(token="your-access-token")
Then, you have to go to your settings --> Access Tokens --> Manage (Top right corner of access token) --> Edit Permissions and check the necessary boxes.
This should work
I scratched my head with this for ages, then I realised that after logging into hugging face with the token, I had to reinstall mistral with "poetry run python scripts/setup". After this last step PrivateGPT loaded without errors for me.
Getting the same error. It's strange how this issue plagues so many users. Im authenticated, have access to the model on HF and still the same issue, for like, the past 3 days?
Hi Neel, did you check the permissions of the token you used to login as mentioned by the previous users? Hugging face increased security related to access tokens.
Hi Neel, did you check the permissions of the token you used to login as mentioned by the previous users? Hugging face increased security related to access tokens.
Hi! Yes, I did check the permissions for my tokens. Additionally, I invalidated the previous token, created a new one and configured all the required permissions. No luck though.
That is odd indeed, did update all packages not solve the issue neither?
Just updated all packages again. I still cannot gain access to the model.
In case this was the source of the issue for anyone else -- the Model Card repo ID is incorrect. You need to add Instruct to it, e.g instead of this:
mistral_models_path = Path.home().joinpath('mistral_models', '7B-v0.3')
Use this (see the word Instruct in the path!):
mistral_models_path = Path.home().joinpath(local_path, '7B-Instruct-v0.3')
Full instructions for completeness:
- Create a token in User >> Settings >> Access Token. I used a READ token and it worked fine. Copy the token ID.
- Use the hugging face CLI to login and use the token from the previous step
- Execute the download command:
snapshot_download(repo_id="mistralai/Mistral-7B-Instruct-v0.3", allow_patterns=["params.json", "consolidated.safetensors", "tokenizer.model.v3"], local_dir=mistral_models_path)
When you want to do through your terminal where you have your active environment .
Just run two command.
- pip install --upgrade huggingface_hub
- huggingface-cli login --token "Your access token"
Then you will see something like this
The token has not been saved to the git credentials helper. Passadd_to_git_credential=True
in this function directly or--add-to-git-credential
if using viahuggingface-cli
if you want to set the git credential as well.
Token is valid (permission: write).
Your token has been saved to /home/.cache/huggingface/token
Login successful
All set!!!!!!!!!!!!!!1
Go to User >> Settings >> Access token.
Click on edit access token permissions and enable Read access to contents of all public gated repos you can access >> Save token
This worked for me