seyoungsong commited on
Commit
e723e47
1 Parent(s): 68fdd8d
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -137,14 +137,15 @@ lang_to_code = {
137
  lang_names = list(lang_to_code.keys())
138
 
139
  # load model
140
- cache_dir = Path("./cache_dir").resolve()
141
- cache_dir.mkdir(exist_ok=True, parents=True)
142
- print(f"cache_dir: {cache_dir}")
143
- pipe: TranslationPipeline = pipeline(
144
- task="translation", model="seyoungsong/flores101_mm100_175M"
145
  )
146
- tokenizer: M2M100Tokenizer = pipe.tokenizer
147
- model: M2M100ForConditionalGeneration = pipe.model
 
 
148
 
149
  # fix tokenizer
150
  tokenizer.lang_token_to_id = {
 
137
  lang_names = list(lang_to_code.keys())
138
 
139
  # load model
140
+ model_path = Path("./model_files").resolve()
141
+ print(f"model_path: {model_path}")
142
+ tokenizer: M2M100Tokenizer = M2M100Tokenizer.from_pretrained(
143
+ pretrained_model_name_or_path=str(model_path), local_files_only=True
 
144
  )
145
+ model = M2M100ForConditionalGeneration.from_pretrained(
146
+ pretrained_model_name_or_path=str(model_path), local_files_only=True
147
+ )
148
+
149
 
150
  # fix tokenizer
151
  tokenizer.lang_token_to_id = {