Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions backend/backends/pytorch_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ def _load_model_sync(self, model_size: str):
status="downloading",
)

# Use a single cache root for both HF Hub + Transformers to avoid split-cache
# cases where speech_tokenizer files are downloaded to one location while
# AutoFeatureExtractor resolves from another.
from huggingface_hub import constants as hf_constants
tts_cache_dir = hf_constants.HF_HUB_CACHE

# Load the model (tqdm is patched, but filters out non-download progress)
try:
# Don't pass device_map on CPU: accelerate's meta-tensor mechanism
Expand All @@ -186,14 +192,16 @@ def _load_model_sync(self, model_size: str):
if self.device == "cpu":
self.model = Qwen3TTSModel.from_pretrained(
model_path,
torch_dtype=torch.float32,
cache_dir=tts_cache_dir,
dtype=torch.float32,
low_cpu_mem_usage=False,
)
else:
self.model = Qwen3TTSModel.from_pretrained(
model_path,
cache_dir=tts_cache_dir,
device_map=self.device,
torch_dtype=torch.bfloat16,
dtype=torch.bfloat16,
)
finally:
# Exit the patch context
Expand Down