From 77e95e28f1865c7db4f6b90ee01f6107fc5e89ba Mon Sep 17 00:00:00 2001
From: Andres Marafioti <andimarafioti@gmail.com>
Date: Thu, 22 Aug 2024 15:58:23 +0200
Subject: [PATCH] fix melo install

---
 TTS/melotts.py   | 2 +-
 requirements.txt | 2 +-
 s2s_pipeline.py  | 8 ++++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/TTS/melotts.py b/TTS/melotts.py
index 1531bb9..70b29f5 100644
--- a/TTS/melotts.py
+++ b/TTS/melotts.py
@@ -1,4 +1,4 @@
-from MeloTTS.melo.api import TTS
+from melo.api import TTS
 import logging
 from baseHandler import BaseHandler
 import librosa
diff --git a/requirements.txt b/requirements.txt
index e36b3d5..7f0611a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
 nltk==3.8.1
 parler_tts @ git+https://github.com/huggingface/parler-tts.git
-melotts @ git+https://github.com/andimarafioti/MeloTTS.git  # made a copy of MeloTTS to have compatible versions of transformers
+melotts @ git+https://github.com/andimarafioti/MeloTTS.git#egg=MeloTTS  # made a copy of MeloTTS to have compatible versions of transformers
 torch==2.4.0
 sounddevice==0.5.0
 lightning-whisper-mlx==0.0.10
diff --git a/s2s_pipeline.py b/s2s_pipeline.py
index b08d0f9..14a5e2b 100644
--- a/s2s_pipeline.py
+++ b/s2s_pipeline.py
@@ -962,7 +962,7 @@ def main():
             )
         if module_kwargs.llm != "mlx-lm":
             logger.warning(
-                "For macOS users, it is recommended to use mlx-lm."
+                "For macOS users, it is recommended to use mlx-lm. You can activate it by passing --llm mlx-lm."
             )
         if module_kwargs.tts != "melo":
             logger.warning(
@@ -1068,7 +1068,11 @@ def main():
         )
         
     elif module_kwargs.tts == 'melo':
-        from TTS.melotts import MeloTTSHandler
+        try:
+            from TTS.melotts import MeloTTSHandler
+        except RuntimeError as e:
+            logger.error(f"Error importing MeloTTSHandler. You might need to run: python -m unidic download")
+            raise e
         tts = MeloTTSHandler(
             stop_event,
             queue_in=lm_response_queue,
-- 
GitLab