Spaces:
Runtime error
Runtime error
Update apis/chat_api.py
Browse files- apis/chat_api.py +4 -2
apis/chat_api.py
CHANGED
|
@@ -105,10 +105,12 @@ class ChatAPIApp:
|
|
| 105 |
logging.warning("GPU not found, using CPU, translation will be very slow.")
|
| 106 |
|
| 107 |
time_start = time.time()
|
| 108 |
-
|
|
|
|
|
|
|
| 109 |
tokenizer = M2M100Tokenizer.from_pretrained(pretrained_model, cache_dir=cache_dir)
|
| 110 |
model = M2M100ForConditionalGeneration.from_pretrained(
|
| 111 |
-
|
| 112 |
).to(device)
|
| 113 |
model.eval()
|
| 114 |
|
|
|
|
| 105 |
logging.warning("GPU not found, using CPU, translation will be very slow.")
|
| 106 |
|
| 107 |
time_start = time.time()
|
| 108 |
+
#TRANSFORMERS_CACHE
|
| 109 |
+
pretrained_model = "facebook/m2m100_1.2B"
|
| 110 |
+
cache_dir = "models/"
|
| 111 |
tokenizer = M2M100Tokenizer.from_pretrained(pretrained_model, cache_dir=cache_dir)
|
| 112 |
model = M2M100ForConditionalGeneration.from_pretrained(
|
| 113 |
+
pretrained_model, cache_dir=cache_dir
|
| 114 |
).to(device)
|
| 115 |
model.eval()
|
| 116 |
|