Spaces:
Running
on
Zero
Running
on
Zero
da03
commited on
Commit
·
d0b135c
1
Parent(s):
137d14f
app.py
CHANGED
|
@@ -14,13 +14,16 @@ MAX_RESULT_TOKENS = 10
|
|
| 14 |
@spaces.GPU
|
| 15 |
def predict_answer(question):
|
| 16 |
input_text = ' '.join(question.split()).strip() + ' ' + tokenizer.eos_token
|
|
|
|
| 17 |
inputs = tokenizer(input_text, return_tensors='pt').to('cuda' if torch.cuda.is_available() else 'cpu')
|
| 18 |
implicit_cot_model.to('cuda' if torch.cuda.is_available() else 'cpu')
|
| 19 |
|
| 20 |
input_ids = inputs['input_ids']
|
|
|
|
| 21 |
outputs = implicit_cot_model.generate(input_ids=input_ids,
|
| 22 |
max_new_tokens=MAX_RESULT_TOKENS,
|
| 23 |
do_sample=False)
|
|
|
|
| 24 |
|
| 25 |
prediction = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 26 |
|
|
|
|
| 14 |
@spaces.GPU
|
| 15 |
def predict_answer(question):
|
| 16 |
input_text = ' '.join(question.split()).strip() + ' ' + tokenizer.eos_token
|
| 17 |
+
print (input_text)
|
| 18 |
inputs = tokenizer(input_text, return_tensors='pt').to('cuda' if torch.cuda.is_available() else 'cpu')
|
| 19 |
implicit_cot_model.to('cuda' if torch.cuda.is_available() else 'cpu')
|
| 20 |
|
| 21 |
input_ids = inputs['input_ids']
|
| 22 |
+
print (input_ids)
|
| 23 |
outputs = implicit_cot_model.generate(input_ids=input_ids,
|
| 24 |
max_new_tokens=MAX_RESULT_TOKENS,
|
| 25 |
do_sample=False)
|
| 26 |
+
print (outputs)
|
| 27 |
|
| 28 |
prediction = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 29 |
|