Spaces:
Sleeping
Sleeping
Update unified_tts.py
Browse files- unified_tts.py +2 -2
unified_tts.py
CHANGED
@@ -65,7 +65,7 @@ from transformers import AutoTokenizer
|
|
65 |
from vllm import LLM, SamplingParams
|
66 |
from modelscope import snapshot_download
|
67 |
|
68 |
-
snapshot_download('iic/CosyVoice2-0.5B'
|
69 |
|
70 |
|
71 |
# Add CosyVoice paths
|
@@ -212,7 +212,7 @@ class UnifiedTTS:
|
|
212 |
# CosyVoice2 converts discrete speech tokens to continuous audio waveforms
|
213 |
# It supports voice cloning using prompt audio features for consistent voice characteristics
|
214 |
logger.info(f"Loading CosyVoice2 model from {self.cosyvoice_model_dir}")
|
215 |
-
self.cosyvoice = CosyVoice2(
|
216 |
self.sample_rate = self.cosyvoice.sample_rate
|
217 |
|
218 |
# Preload prompt audio features for voice cloning
|
|
|
65 |
from vllm import LLM, SamplingParams
|
66 |
from modelscope import snapshot_download
|
67 |
|
68 |
+
cosyvoice_cache_dir = snapshot_download('iic/CosyVoice2-0.5B')
|
69 |
|
70 |
|
71 |
# Add CosyVoice paths
|
|
|
212 |
# CosyVoice2 converts discrete speech tokens to continuous audio waveforms
|
213 |
# It supports voice cloning using prompt audio features for consistent voice characteristics
|
214 |
logger.info(f"Loading CosyVoice2 model from {self.cosyvoice_model_dir}")
|
215 |
+
self.cosyvoice = CosyVoice2(cosyvoice_cache_dir, fp16=self.fp16, device="cuda" if torch.cuda.is_available() else "cpu")
|
216 |
self.sample_rate = self.cosyvoice.sample_rate
|
217 |
|
218 |
# Preload prompt audio features for voice cloning
|