-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
Webpage: https://huggingface.co/agents-course/notebooks/blob/main/unit1/dummy_agent_library.ipynb referenced from https://huggingface.co/learn/agents-course/unit1/what-are-llms.
When using this notebook in Google Colab I have not been able to read the token in the way the original code is written.
I have
- added the token in the Secrets section in the Google Colab
- restarted the notebook with Runtime Restart Session
The script completing the "The capital of France is" did not work for me. The first section reading the token runs silently without an issue, despite not being able to retrieve the token. The second section with the Paris example suggests to login into Grock.
I had to use the instructions on the left side in the secret key section, telling me how to import the token. And also passed the token into the InferenceClient function as the second parameter.
import os
from google.colab import userdata
from huggingface_hub import InferenceClient
## You need a token from https://hf.co/settings/tokens, ensure that you select 'read' as the token type. If you run this on Google Colab, you can set it up in the "settings" tab under "secrets". Make sure to call it "HF_TOKEN"
HF_TOKEN = userdata.get('HF_TOKEN').strip()
client = InferenceClient(model="meta-llama/Llama-4-Scout-17B-16E-Instruct", token=HF_TOKEN)
To Reproduce
- Create your READ token in the Hugging Face
- Visit https://huggingface.co/agents-course/notebooks/blob/main/unit1/dummy_agent_library.ipynb
- Fill in the token in the Secrets section
- Restart the session with Runtime -> Restart Session
Additional context
I am not a python developer, so I could have missed something obvious.