Gated Repo Access in Google Colab

#59
by SyntaxError101 - opened

I am getting this error:
OSError: You are trying to access a gated repo.
Make sure to have access to it at https://huggingface.co/google/gemma-7b.
401 Client Error. (Request ID: Root=1-65e56481-05d4e73c3b3b3f11512a5693;8930f691-51e9-4c80-8596-7796518b78df)
Cannot access gated repo for url https://huggingface.co/google/gemma-7b/resolve/main/config.json.
Repo model Google/GEMMA-7B is gated. You must be authenticated to access it.

When running this code:
model_id = "google/gemma-7b"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, cache_dir='./workspace/',
torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto", offload_folder="offload")
model.eval()
pipeline = transformers.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
device_map="auto",
max_length=1000,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id
)

Please help me fix this, as I have access to the model on hugginface cannot run the code on google colab

You will need to follow https://huggingface.co/docs/hub/en/models-gated#access-gated-models-as-a-user and agree to the terms and conditions, and then it should work

Google org

Yes, make sure to login into your HF account in the notebook by calling the cell:

from huggingface_hub import notebook_login

notebook_login()

Thank you so much @ybelkada . I was facing the same problem and now it is fixed.

osanseviero changed discussion status to closed

Sign up or log in to comment