Spaces:
Runtime error
Runtime error
Simon Salmon
commited on
Commit
·
3bae5d7
1
Parent(s):
394894d
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
import torch
|
2 |
-
from transformers import T5ForConditionalGeneration,T5Tokenizer, AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
import streamlit as st
|
4 |
|
5 |
-
|
6 |
-
|
|
|
7 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
8 |
model = model.to(device)
|
9 |
|
@@ -17,7 +18,7 @@ def translate_to_english(model, tokenizer, text):
|
|
17 |
do_sample=True,
|
18 |
max_length=256,
|
19 |
top_k=120,
|
20 |
-
temperature=1.
|
21 |
top_p=0.98,
|
22 |
early_stopping=True,
|
23 |
num_return_sequences=10
|
|
|
1 |
import torch
|
2 |
+
from transformers import T5ForConditionalGeneration,T5Tokenizer, AutoTokenizer, AutoModelForSeq2SeqLM, PegasusTokenizer, PegasusForConditionalGeneration
|
3 |
import streamlit as st
|
4 |
|
5 |
+
model_name = 'tuner007/pegasus_paraphrase'
|
6 |
+
tokenizer = PegasusTokenizer.from_pretrained(model_name)
|
7 |
+
model = PegasusForConditionalGeneration.from_pretrained(model_name)
|
8 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
9 |
model = model.to(device)
|
10 |
|
|
|
18 |
do_sample=True,
|
19 |
max_length=256,
|
20 |
top_k=120,
|
21 |
+
temperature=1.5,
|
22 |
top_p=0.98,
|
23 |
early_stopping=True,
|
24 |
num_return_sequences=10
|