Spaces:
Runtime error
Runtime error
Update getans.py
Browse files
getans.py
CHANGED
@@ -5,14 +5,11 @@ token1="hf_"
|
|
5 |
token2="rPlNHzkJScHYmtGSaQPcaoKcjJGYQEpjLu"
|
6 |
login(token=token1+token2)
|
7 |
|
8 |
-
|
9 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
10 |
|
11 |
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
|
12 |
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
|
13 |
|
14 |
-
model.to(device)
|
15 |
-
|
16 |
def get_response(prompt, max_new_tokens=50):
|
17 |
inputs = tokenizer(prompt, return_tensors="pt")
|
18 |
outputs = model.generate(**inputs, max_new_tokens=max_new_tokens, temperature=0.0001, do_sample=True)
|
|
|
5 |
token2="rPlNHzkJScHYmtGSaQPcaoKcjJGYQEpjLu"
|
6 |
login(token=token1+token2)
|
7 |
|
|
|
8 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
9 |
|
10 |
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
|
11 |
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
|
12 |
|
|
|
|
|
13 |
def get_response(prompt, max_new_tokens=50):
|
14 |
inputs = tokenizer(prompt, return_tensors="pt")
|
15 |
outputs = model.generate(**inputs, max_new_tokens=max_new_tokens, temperature=0.0001, do_sample=True)
|