Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 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}
|