Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from transformers import MBartForConditionalGeneration,
|
| 3 |
|
| 4 |
# Load the model and tokenizer. Use st.cache_resource to cache the model,
|
| 5 |
# preventing it from reloading every time the app updates.
|
| 6 |
@st.cache_resource
|
| 7 |
def load_translation_model():
|
| 8 |
model_name = "facebook/mbart-large-50-many-to-many-mmt"
|
| 9 |
-
|
|
|
|
| 10 |
model = MBartForConditionalGeneration.from_pretrained(model_name)
|
| 11 |
return tokenizer, model
|
| 12 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import MBartForConditionalGeneration, MBart50Tokenizer
|
| 3 |
|
| 4 |
# Load the model and tokenizer. Use st.cache_resource to cache the model,
|
| 5 |
# preventing it from reloading every time the app updates.
|
| 6 |
@st.cache_resource
|
| 7 |
def load_translation_model():
|
| 8 |
model_name = "facebook/mbart-large-50-many-to-many-mmt"
|
| 9 |
+
# Use the standard MBart50Tokenizer instead of the fast version
|
| 10 |
+
tokenizer = MBart50Tokenizer.from_pretrained(model_name)
|
| 11 |
model = MBartForConditionalGeneration.from_pretrained(model_name)
|
| 12 |
return tokenizer, model
|
| 13 |
|