Spaces:
Sleeping
Sleeping
Commit
·
b4c917d
1
Parent(s):
aeaead2
Updates.
Browse files
app.py
CHANGED
@@ -71,9 +71,12 @@ You are a medical assistant trained on clinical reasoning data. Given the follow
|
|
71 |
def generate_local_answer(prompt, max_new_tokens=512):
|
72 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
73 |
print(f"Using device: {device}")
|
74 |
-
|
|
|
|
|
75 |
output = generation_model.generate(
|
76 |
input_ids=input_ids,
|
|
|
77 |
max_new_tokens=max_new_tokens,
|
78 |
temperature=0.5,
|
79 |
do_sample=True,
|
|
|
71 |
def generate_local_answer(prompt, max_new_tokens=512):
|
72 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
73 |
print(f"Using device: {device}")
|
74 |
+
inputs = tokenizer(prompt, return_tensors="pt", padding=True).to(device)
|
75 |
+
input_ids = inputs["input_ids"]
|
76 |
+
attention_mask = inputs["attention_mask"]
|
77 |
output = generation_model.generate(
|
78 |
input_ids=input_ids,
|
79 |
+
attention_mask=attention_mask,
|
80 |
max_new_tokens=max_new_tokens,
|
81 |
temperature=0.5,
|
82 |
do_sample=True,
|