403 Forbidden: Authorization error

#62
by parkerbotta - opened

Hi,
I already accepted the Terms&Conditions to use this model, but as the title said, I have the following issue:
403 Forbidden: Authorization error..
Cannot access content at: https://huggingface.co/google/gemma-2b/resolve/main/config.json.

How can I resolve this?

I'm using Google Colab. Thanks!

on Google Colab, are you adding your authorization token? or are you signed with your account?

something like this:
import os
from google.colab import userdata
os.environ["HF_TOKEN"] = userdata.get('HF_TOKEN')

I have a Google Colab secret named HF_TOKEN with my HuggingFace token, but I still have the issue.
I tried what you did but it gives me the same error.

do you have a code snippet that replicate the issue?

I've just created a new access token (https://huggingface.co/settings/tokens) and executed this code on colab:

import os
from google.colab import userdata
os.environ["HF_TOKEN"] = userdata.get('HF_TOKEN')

from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="google/gemma-2b", filename="config.json")

here is my code:

from llama_index.embeddings.huggingface import HuggingFaceEmbedding
from llama_index.core import Settings

model_name = "google/gemma-2b"
Settings.embed_model = HuggingFaceEmbedding(model_name=model_name)

it gives me the error

before doing it, I logged successfully on HF by:

from huggingface_hub import notebook_login
notebook_login()

and then added my HF token.
I tried also on VisualStudio Code but nothing change :(

I'm not an expert, but have you tried using only one authentication method login or HF Token?

Google org

Hi @parkerbotta , It's the HF authorization error to access the gemma-2b model. Please ensure that you have configured the HF token correctly in Colab(as mentioned in below screenshot) or can try again by creating a new token (HF account - Settings - Access tokens).

I am able to execute the above given code in Google Colab using accelerator 'T4 GPU'. Please have a look at this attached gist for the same. Thank you.
Screenshot 2024-06-28 at 6.11.54 PM.png

Sign up or log in to comment