Spaces:
Runtime error
Runtime error
Allen Park
commited on
Commit
·
76c4bfe
1
Parent(s):
8275a94
add attention mask and pad token id
Browse files
app.py
CHANGED
|
@@ -32,7 +32,11 @@ Your output should be in JSON FORMAT with the keys "REASONING" and "SCORE":
|
|
| 32 |
def model_call(question, document, answer):
|
| 33 |
NEW_FORMAT = PROMPT.format(question=question, document=document, answer=answer)
|
| 34 |
inputs = tokenizer(NEW_FORMAT, return_tensors="pt")
|
| 35 |
-
model.generate(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
generated_text = tokenizer.decode(inputs.input_ids[0])
|
| 37 |
print(generated_text)
|
| 38 |
return generated_text
|
|
|
|
| 32 |
def model_call(question, document, answer):
|
| 33 |
NEW_FORMAT = PROMPT.format(question=question, document=document, answer=answer)
|
| 34 |
inputs = tokenizer(NEW_FORMAT, return_tensors="pt")
|
| 35 |
+
model.generate(
|
| 36 |
+
inputs.input_ids,
|
| 37 |
+
attention_mask=inputs.attention_mask,
|
| 38 |
+
pad_token_id=tokenizer.eos_token_id,
|
| 39 |
+
)
|
| 40 |
generated_text = tokenizer.decode(inputs.input_ids[0])
|
| 41 |
print(generated_text)
|
| 42 |
return generated_text
|