ZinebSN commited on
Commit
4c1087e
·
1 Parent(s): 57f1d8d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -30,10 +30,9 @@ else:
30
  def gpt2_summarize(input_text, tokenizer, model, length):
31
  text=tokenizer.encode_plus(f'<bos> {input_text} <sep>', truncation=True, max_length=1024).input_ids
32
  text_length=len(text)
33
- text = torch.tensor(text, dtype=torch.long, device=device)
34
  text = text.unsqueeze(0)
35
  generated = text
36
- model = model.to(device)
37
  with torch.no_grad():
38
  for _ in range(length):
39
  inputs = {'input_ids': generated}
 
30
  def gpt2_summarize(input_text, tokenizer, model, length):
31
  text=tokenizer.encode_plus(f'<bos> {input_text} <sep>', truncation=True, max_length=1024).input_ids
32
  text_length=len(text)
33
+ text = torch.tensor(text, dtype=torch.long)
34
  text = text.unsqueeze(0)
35
  generated = text
 
36
  with torch.no_grad():
37
  for _ in range(length):
38
  inputs = {'input_ids': generated}