yihaocs commited on
Commit
2638901
1 Parent(s): 5e97800

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. llama_test.py +8 -0
llama_test.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import AutoTokenizer, AutoModelForCausalLM
3
+
4
+ tokenizer = AutoTokenizer.from_pretrained("/export/share/txie/llama2/Llama-2-7b-hf")
5
+ model = AutoModelForCausalLM.from_pretrained("/export/share/txie/llama2/Llama-2-7b-hf", torch_dtype=torch.bfloat16)
6
+ inputs = tokenizer("The world is", return_tensors="pt")
7
+ sample = model.generate(**inputs, max_length=128)
8
+ print(tokenizer.decode(sample[0]))