You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I get a warning related to Hugging Face when using the AmazonBedrockGenerator on Colab. Everything works as expected
Warning:
/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:88: UserWarning:
The secret `HF_TOKEN` does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional to access public models or datasets.
warnings.warn(
To Reproduce
Run the code below after installing pip install amazon-bedrock-haystack
fromamazon_bedrock_haystack.generators.amazon_bedrockimportAmazonBedrockGenerator## Initialize the AmazonBedrockGenerator with an Amazon Bedrock modelbedrock_model='amazon.titan-text-express-v1'generator=AmazonBedrockGenerator(model_name=bedrock_model,
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
aws_region_name="us-east-1",
max_length=500)
Describe your environment (please complete the following information):
Under the hood, AmazonBedrockGenerator is using transformers for tokenization.
Lately, you always get this warning when using transformers in Colab, unless you have set the HF_TOKEN.
An unrelated example that raises the same warning:
Example
# ! pip install accelerateimporttorchfromtransformersimportpipelinepipe=pipeline("text-generation", model="TinyLlama/TinyLlama-1.1B-Chat-v1.0", torch_dtype=torch.bfloat16, device_map="auto")
# We use the tokenizer's chat template to format each message - see https://huggingface.co/docs/transformers/main/en/chat_templatingmessages= [
{
"role": "system",
"content": "You are a friendly chatbot who always responds in the style of a pirate",
},
{"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
]
prompt=pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs=pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])
So I would say there is nothing we can do to prevent this warning...
Describe the bug
I get a warning related to Hugging Face when using the AmazonBedrockGenerator on Colab. Everything works as expected
Warning:
There's an issue here that might be related: huggingface/huggingface_hub#1929
To Reproduce
Run the code below after installing
pip install amazon-bedrock-haystack
Describe your environment (please complete the following information):
The text was updated successfully, but these errors were encountered: