Hassan501 commited on
Commit
a6b2d00
·
verified ·
1 Parent(s): dd28184

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,12 +1,13 @@
1
  import streamlit as st
2
- from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
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
- tokenizer = MBart50TokenizerFast.from_pretrained(model_name)
 
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