Spaces:
Runtime error
Runtime error
vinayakdev
commited on
Commit
•
a4b6666
1
Parent(s):
dc9cd8d
update generator
Browse files- generator.py +2 -2
generator.py
CHANGED
@@ -59,7 +59,7 @@ def run_model(input_string, **generator_args):
|
|
59 |
|
60 |
inputs = tokenize([input_string])
|
61 |
|
62 |
-
res = model.generate(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'], **
|
63 |
output = hftokenizer.decode(res[0], skip_special_tokens=True)
|
64 |
output = [item.split("<sep>") for item in output]
|
65 |
output = [o.strip() for o in output[:-1]]
|
@@ -79,7 +79,7 @@ def QA(question, context):
|
|
79 |
'context':context
|
80 |
}
|
81 |
res = nlp(format)
|
82 |
-
output = f"{question}\n{string.capwords(res['answer'])}\
|
83 |
return output
|
84 |
# inputs = tokenizer(question, context, return_tensors="pt")
|
85 |
# # Run the model, the deepset way
|
|
|
59 |
|
60 |
inputs = tokenize([input_string])
|
61 |
|
62 |
+
res = model.generate(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'], **generate_args)
|
63 |
output = hftokenizer.decode(res[0], skip_special_tokens=True)
|
64 |
output = [item.split("<sep>") for item in output]
|
65 |
output = [o.strip() for o in output[:-1]]
|
|
|
79 |
'context':context
|
80 |
}
|
81 |
res = nlp(format)
|
82 |
+
output = f"{question}\n{string.capwords(res['answer'])}\n"
|
83 |
return output
|
84 |
# inputs = tokenizer(question, context, return_tensors="pt")
|
85 |
# # Run the model, the deepset way
|