Spaces:
Running
on
Zero
Running
on
Zero
Leonard Püttmann
commited on
Upload app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import spaces
|
|
|
2 |
import gradio as gr
|
3 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
4 |
import spacy
|
@@ -18,10 +19,10 @@ class ModelSingleton:
|
|
18 |
|
19 |
# Load translation models and tokenizers
|
20 |
self.tokenizer_en_it = AutoTokenizer.from_pretrained("LeonardPuettmann/Quadrifoglio-mt-en-it")
|
21 |
-
self.model_en_it = AutoModelForSeq2SeqLM.from_pretrained("LeonardPuettmann/Quadrifoglio-mt-en-it")
|
22 |
|
23 |
self.tokenizer_it_en = AutoTokenizer.from_pretrained("LeonardPuettmann/Quadrifoglio-mt-it-en")
|
24 |
-
self.model_it_en = AutoModelForSeq2SeqLM.from_pretrained("LeonardPuettmann/Quadrifoglio-mt-it-en")
|
25 |
|
26 |
self.initialized = True
|
27 |
|
|
|
1 |
import spaces
|
2 |
+
import torch
|
3 |
import gradio as gr
|
4 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
5 |
import spacy
|
|
|
19 |
|
20 |
# Load translation models and tokenizers
|
21 |
self.tokenizer_en_it = AutoTokenizer.from_pretrained("LeonardPuettmann/Quadrifoglio-mt-en-it")
|
22 |
+
self.model_en_it = AutoModelForSeq2SeqLM.from_pretrained("LeonardPuettmann/Quadrifoglio-mt-en-it", torch_dtype=torch.bfloat16)
|
23 |
|
24 |
self.tokenizer_it_en = AutoTokenizer.from_pretrained("LeonardPuettmann/Quadrifoglio-mt-it-en")
|
25 |
+
self.model_it_en = AutoModelForSeq2SeqLM.from_pretrained("LeonardPuettmann/Quadrifoglio-mt-it-en", torch_dtype=torch.bfloat16)
|
26 |
|
27 |
self.initialized = True
|
28 |
|