Spaces:
Sleeping

QueryYourDocs / examples /tests /hf_login.py
LVKinyanjui's picture
Changed HF HOME advanced contextual rag
e66a60a
Raw History Blame Contribute Delete
476 Bytes
from huggingface_hub import login
# login()
import transformers, torch
import os
# from huggingface_hub import HfApi
# Get the token from the environment variable
token = os.getenv("HF_TOKEN_READ")
print(token)
# Use the token to authenticate
api = login(token=token)
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)