BusinessDev commited on
Commit
d1095eb
1 Parent(s): 59e0faa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -13,13 +13,13 @@ model = MBartForConditionalGeneration.from_pretrained(model_name)
13
  def answer_question(text, question):
14
  # Prepare input text
15
  input_text = f"context: {text} question: {question}"
16
- inputs = tokenizer(input_text, return_tensors="pt", max_length=1280000, truncation=False, padding="max_length")
17
 
18
  # Generate answer
19
  outputs = model.generate(
20
  input_ids=inputs["input_ids"],
21
  attention_mask=inputs["attention_mask"],
22
- max_length=1280000,
23
  num_beams=5,
24
  early_stopping=True
25
  )
 
13
  def answer_question(text, question):
14
  # Prepare input text
15
  input_text = f"context: {text} question: {question}"
16
+ inputs = tokenizer(input_text, return_tensors="pt", max_length=1024, truncation=False, padding="max_length")
17
 
18
  # Generate answer
19
  outputs = model.generate(
20
  input_ids=inputs["input_ids"],
21
  attention_mask=inputs["attention_mask"],
22
+ max_length=1024,
23
  num_beams=5,
24
  early_stopping=True
25
  )