Spaces:
Runtime error
Runtime error
BusinessDev
commited on
Commit
•
601bc5b
1
Parent(s):
a592fa2
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=2560000, 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=2560000,
|
47 |
num_beams=5,
|
48 |
early_stopping=True
|
49 |
)
|