Spaces:
Paused
Paused
Further optimize memory usage: Switch to nllb-200-distilled-200M and add Uvicorn debug logging
Browse files- Switched translation model from facebook/nllb-200-distilled-600M to facebook/nllb-200-distilled-200M to reduce memory usage
- Added debug logging around Uvicorn startup to diagnose startup issues
- Added debug print statements in _initialize_tts_model for better logging
app.py
CHANGED
|
@@ -72,9 +72,10 @@ class TalklasTranslator:
|
|
| 72 |
|
| 73 |
def _initialize_mt_model(self):
|
| 74 |
try:
|
| 75 |
-
|
|
|
|
| 76 |
self.mt_tokenizer = AutoTokenizer.from_pretrained(
|
| 77 |
-
"facebook/nllb-200-distilled-
|
| 78 |
clean_up_tokenization_spaces=True
|
| 79 |
)
|
| 80 |
self.mt_model.to(self.device)
|
|
@@ -84,6 +85,7 @@ class TalklasTranslator:
|
|
| 84 |
|
| 85 |
def _initialize_tts_model(self):
|
| 86 |
try:
|
|
|
|
| 87 |
self.tts_model = VitsModel.from_pretrained(f"facebook/mms-tts-{self.target_lang}")
|
| 88 |
self.tts_tokenizer = AutoTokenizer.from_pretrained(
|
| 89 |
f"facebook/mms-tts-{self.target_lang}",
|
|
@@ -216,4 +218,6 @@ async def translate_text(text: str = Form(...), source_lang: str = Form(...), ta
|
|
| 216 |
|
| 217 |
if __name__ == "__main__":
|
| 218 |
import uvicorn
|
| 219 |
-
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
def _initialize_mt_model(self):
|
| 74 |
try:
|
| 75 |
+
print("Trying to load facebook/nllb-200-distilled-200M...")
|
| 76 |
+
self.mt_model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-200M")
|
| 77 |
self.mt_tokenizer = AutoTokenizer.from_pretrained(
|
| 78 |
+
"facebook/nllb-200-distilled-200M",
|
| 79 |
clean_up_tokenization_spaces=True
|
| 80 |
)
|
| 81 |
self.mt_model.to(self.device)
|
|
|
|
| 85 |
|
| 86 |
def _initialize_tts_model(self):
|
| 87 |
try:
|
| 88 |
+
print(f"Trying to load facebook/mms-tts-{self.target_lang}...")
|
| 89 |
self.tts_model = VitsModel.from_pretrained(f"facebook/mms-tts-{self.target_lang}")
|
| 90 |
self.tts_tokenizer = AutoTokenizer.from_pretrained(
|
| 91 |
f"facebook/mms-tts-{self.target_lang}",
|
|
|
|
| 218 |
|
| 219 |
if __name__ == "__main__":
|
| 220 |
import uvicorn
|
| 221 |
+
print("Starting Uvicorn server...")
|
| 222 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
| 223 |
+
print("Uvicorn server started successfully")
|