Skip to content

Commit

Permalink
docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ydshieh committed Feb 7, 2024
1 parent db21e83 commit 34fdf75
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/models/llama/test_inference_llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ class LLaMaInferenceTest(unittest.TestCase):

def test_foo(self):
ckpt = "meta-llama/Llama-2-7b-hf"
hf_token = token=os.getenv("HF_HUB_READ_TOKEN", None)

tokenizer = AutoTokenizer.from_pretrained(ckpt)
tokenizer = AutoTokenizer.from_pretrained(ckpt, token=hf_token)

prompt = "Hey, are you conscious? Can you talk to me?"
inputs = tokenizer(prompt, return_tensors="pt").to(device)

model = AutoModelForCausalLM.from_pretrained(ckpt, torch_dtype=torch.float16, token=os.getenv("HF_HUB_READ_TOKEN", None))
model = AutoModelForCausalLM.from_pretrained(ckpt, torch_dtype=torch.float16, token=hf_token)
model.to(device)

# Generate
Expand Down

0 comments on commit 34fdf75

Please sign in to comment.