LucasAguetai commited on
Commit
647060f
1 Parent(s): bd230ae

fix samuel issue

Browse files
Files changed (1) hide show
  1. modeles.py +1 -1
modeles.py CHANGED
@@ -6,7 +6,7 @@ def load_and_answer(question, context, model_name):
6
  model = AutoModelForQuestionAnswering.from_pretrained(model_name)
7
 
8
  # Tokenize the input question-context pair
9
- inputs = tokenizer.encode_plus(question, context, max_length=512)
10
 
11
  # Send inputs to the same device as your model
12
  inputs = {k: v.to(model.device) for k, v in inputs.items()}
 
6
  model = AutoModelForQuestionAnswering.from_pretrained(model_name)
7
 
8
  # Tokenize the input question-context pair
9
+ inputs = tokenizer.encode_plus(question, context, max_length=512, truncation=True, padding=True, return_tensors='pt')
10
 
11
  # Send inputs to the same device as your model
12
  inputs = {k: v.to(model.device) for k, v in inputs.items()}