maxidl commited on
Commit
137c997
1 Parent(s): 72bd649
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -28,18 +28,18 @@ def generate(paper_text):
28
  {"role": "system", "content": "You are a pirate."},
29
  {"role": "user", "content": paper_text}
30
  ]
31
- model_inputs = tokenizer.apply_chat_template(
32
  messages,
33
  add_generation_prompt=True,
34
  return_tensors='pt'
35
  ).to(model.device)
36
 
37
  generated_ids = model.generate(
38
- input_ids=model_inputs,
39
  max_new_tokens=256
40
  )
41
  generated_ids = [
42
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
43
  ]
44
 
45
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
 
28
  {"role": "system", "content": "You are a pirate."},
29
  {"role": "user", "content": paper_text}
30
  ]
31
+ input_ids = tokenizer.apply_chat_template(
32
  messages,
33
  add_generation_prompt=True,
34
  return_tensors='pt'
35
  ).to(model.device)
36
 
37
  generated_ids = model.generate(
38
+ input_ids=input_ids,
39
  max_new_tokens=256
40
  )
41
  generated_ids = [
42
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(input_ids, generated_ids)
43
  ]
44
 
45
  response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]