Arturo Jiménez de los Galanes Reguillos commited on
Commit
4711fbe
1 Parent(s): 4952bf3

Set attention mask

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -34,8 +34,11 @@ def translate(python):
34
  inputs = tokenizer.apply_chat_template(
35
  messages_for(python),
36
  return_tensors="pt").to(model.device)
 
 
37
  outputs = model.generate(
38
- inputs,
 
39
  max_new_tokens=1024,
40
  do_sample=False,
41
  pad_token_id=tokenizer.eos_token_id,
 
34
  inputs = tokenizer.apply_chat_template(
35
  messages_for(python),
36
  return_tensors="pt").to(model.device)
37
+ attention_mask = inputs["attention_mask"]
38
+
39
  outputs = model.generate(
40
+ inputs,
41
+ attention_mask=attention_mask,
42
  max_new_tokens=1024,
43
  do_sample=False,
44
  pad_token_id=tokenizer.eos_token_id,