Michael Hu commited on
Commit
bb33c13
·
1 Parent(s): 086a552

temporarily disable dia

Browse files
Files changed (2) hide show
  1. requirements.txt +2 -2
  2. utils/tts.py +43 -43
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- streamlit>=1.21
2
  nltk>=3.8
3
  librosa>=0.10
4
  ffmpeg-python>=0.2
@@ -12,4 +12,4 @@ soundfile>=0.13.0
12
  kokoro>=0.7.9
13
  ordered-set>=4.1.0
14
  phonemizer-fork>=3.3.2
15
- descript-audio-codec
 
1
+ streamlit>=1.31
2
  nltk>=3.8
3
  librosa>=0.10
4
  ffmpeg-python>=0.2
 
12
  kokoro>=0.7.9
13
  ordered-set>=4.1.0
14
  phonemizer-fork>=3.3.2
15
+ # descript-audio-codec
utils/tts.py CHANGED
@@ -26,45 +26,45 @@ except ImportError:
26
  logger.warning("Kokoro TTS engine is not available")
27
 
28
  # Try to import Dia as fallback
29
- if not KOKORO_AVAILABLE:
30
- try:
31
- logger.info("Attempting to import Dia TTS engine as fallback")
32
- try:
33
- # Check if required dependencies for Dia are available
34
- import torch
35
- logger.info("PyTorch is available for Dia TTS")
36
- except ImportError as torch_err:
37
- logger.error(f"PyTorch dependency for Dia TTS is missing: {str(torch_err)}")
38
- raise ImportError(f"PyTorch dependency required for Dia TTS: {str(torch_err)}") from torch_err
39
 
40
- # Try to import the Dia module
41
- try:
42
- from utils.tts_dia import _get_model as get_dia_model
43
- logger.info("Successfully imported Dia TTS module")
44
 
45
- # Verify the model can be accessed
46
- logger.info("Verifying Dia model can be accessed")
47
- model_info = get_dia_model.__module__
48
- logger.info(f"Dia model module: {model_info}")
49
 
50
- DIA_AVAILABLE = True
51
- logger.info("Dia TTS engine is available as fallback")
52
- except ImportError as module_err:
53
- logger.error(f"Failed to import Dia TTS module: {str(module_err)}")
54
- logger.error(f"Module path: {module_err.__traceback__.tb_frame.f_globals.get('__file__', 'unknown')}")
55
- raise
56
- except AttributeError as attr_err:
57
- logger.error(f"Dia TTS module attribute error: {str(attr_err)}")
58
- logger.error(f"This may indicate the module exists but has incorrect structure")
59
- raise
60
- except ImportError as e:
61
- logger.error(f"Dia TTS engine is not available due to import error: {str(e)}")
62
- logger.error(f"Import path attempted: {e.__traceback__.tb_frame.f_globals.get('__name__', 'unknown')}")
63
- logger.warning("Will use dummy TTS implementation as fallback")
64
- except Exception as e:
65
- logger.error(f"Unexpected error initializing Dia TTS: {str(e)}")
66
- logger.error(f"Error type: {type(e).__name__}")
67
- logger.error("Will use dummy TTS implementation as fallback")
68
 
69
  class TTSEngine:
70
  def __init__(self, lang_code='z'):
@@ -92,13 +92,13 @@ class TTSEngine:
92
  # Fall through to try Dia
93
 
94
  # Try Dia if Kokoro is not available or failed to initialize
95
- if self.engine_type is None and DIA_AVAILABLE:
96
- logger.info("Using Dia as fallback TTS engine")
97
- # For Dia, we don't need to initialize anything here
98
- # The model will be lazy-loaded when needed
99
- self.pipeline = None
100
- self.engine_type = "dia"
101
- logger.info("TTS engine initialized with Dia (lazy loading)")
102
 
103
  # Use dummy if no TTS engines are available
104
  if self.engine_type is None:
 
26
  logger.warning("Kokoro TTS engine is not available")
27
 
28
  # Try to import Dia as fallback
29
+ # if not KOKORO_AVAILABLE:
30
+ # try:
31
+ # logger.info("Attempting to import Dia TTS engine as fallback")
32
+ # try:
33
+ # # Check if required dependencies for Dia are available
34
+ # import torch
35
+ # logger.info("PyTorch is available for Dia TTS")
36
+ # except ImportError as torch_err:
37
+ # logger.error(f"PyTorch dependency for Dia TTS is missing: {str(torch_err)}")
38
+ # raise ImportError(f"PyTorch dependency required for Dia TTS: {str(torch_err)}") from torch_err
39
 
40
+ # # Try to import the Dia module
41
+ # try:
42
+ # from utils.tts_dia import _get_model as get_dia_model
43
+ # logger.info("Successfully imported Dia TTS module")
44
 
45
+ # # Verify the model can be accessed
46
+ # logger.info("Verifying Dia model can be accessed")
47
+ # model_info = get_dia_model.__module__
48
+ # logger.info(f"Dia model module: {model_info}")
49
 
50
+ # DIA_AVAILABLE = True
51
+ # logger.info("Dia TTS engine is available as fallback")
52
+ # except ImportError as module_err:
53
+ # logger.error(f"Failed to import Dia TTS module: {str(module_err)}")
54
+ # logger.error(f"Module path: {module_err.__traceback__.tb_frame.f_globals.get('__file__', 'unknown')}")
55
+ # raise
56
+ # except AttributeError as attr_err:
57
+ # logger.error(f"Dia TTS module attribute error: {str(attr_err)}")
58
+ # logger.error(f"This may indicate the module exists but has incorrect structure")
59
+ # raise
60
+ # except ImportError as e:
61
+ # logger.error(f"Dia TTS engine is not available due to import error: {str(e)}")
62
+ # logger.error(f"Import path attempted: {e.__traceback__.tb_frame.f_globals.get('__name__', 'unknown')}")
63
+ # logger.warning("Will use dummy TTS implementation as fallback")
64
+ # except Exception as e:
65
+ # logger.error(f"Unexpected error initializing Dia TTS: {str(e)}")
66
+ # logger.error(f"Error type: {type(e).__name__}")
67
+ # logger.error("Will use dummy TTS implementation as fallback")
68
 
69
  class TTSEngine:
70
  def __init__(self, lang_code='z'):
 
92
  # Fall through to try Dia
93
 
94
  # Try Dia if Kokoro is not available or failed to initialize
95
+ # if self.engine_type is None and DIA_AVAILABLE:
96
+ # logger.info("Using Dia as fallback TTS engine")
97
+ # # For Dia, we don't need to initialize anything here
98
+ # # The model will be lazy-loaded when needed
99
+ # self.pipeline = None
100
+ # self.engine_type = "dia"
101
+ # logger.info("TTS engine initialized with Dia (lazy loading)")
102
 
103
  # Use dummy if no TTS engines are available
104
  if self.engine_type is None: