Spaces:
Runtime error
Runtime error
BusinessDev
commited on
Commit
•
5d11984
1
Parent(s):
601bc5b
more Storage
Browse files
app.py
CHANGED
@@ -37,13 +37,13 @@ model = MBartForConditionalGeneration.from_pretrained(model_name)
|
|
37 |
def answer_question(context, question):
|
38 |
# Prepare input text
|
39 |
input_text = f"context: {context} question: {question}"
|
40 |
-
inputs = tokenizer(input_text, return_tensors="pt", max_length=
|
41 |
|
42 |
# Generate answer
|
43 |
outputs = model.generate(
|
44 |
input_ids=inputs["input_ids"],
|
45 |
attention_mask=inputs["attention_mask"],
|
46 |
-
max_length=
|
47 |
num_beams=5,
|
48 |
early_stopping=True
|
49 |
)
|
|
|
37 |
def answer_question(context, question):
|
38 |
# Prepare input text
|
39 |
input_text = f"context: {context} question: {question}"
|
40 |
+
inputs = tokenizer(input_text, return_tensors="pt", max_length=1280000, truncation=False, padding="max_length")
|
41 |
|
42 |
# Generate answer
|
43 |
outputs = model.generate(
|
44 |
input_ids=inputs["input_ids"],
|
45 |
attention_mask=inputs["attention_mask"],
|
46 |
+
max_length=1280000,
|
47 |
num_beams=5,
|
48 |
early_stopping=True
|
49 |
)
|