fix: use `dtype` instead of deprecated `torch_dtype` for Qwen3-TTS
The qwen-tts package expects `dtype=torch.bfloat16`, not `torch_dtype`. The old parameter triggers: "`torch_dtype` is deprecated! Use `dtype` instead!" "You are attempting to use Flash Attention 2 without specifying a torch dtype." Updated both the main model and clone model loading paths. https://claude.ai/code/session_01965m1v3f1cK6gDV1JHioA8
+2 −4 · 1 file changed
-
src/tts_provider.py+2 −4
@@ -361,11 +361,9 @@ class Qwen3TTSProvider(BaseTTSProvider): model_name = self._get_model_name(clone=False) print(f"Loading Qwen3-TTS ({model_name}) on {self.device}...") - # Determine dtype and attention implementation - # Use torch_dtype (not dtype) so Flash Attention 2 sees the dtype compute_dtype = torch.bfloat16 if self.device == "cuda" else torch.float32 kwargs = {"device_map": f"{self.device}:0" if self.device == "cuda" else self.device} - kwargs["torch_dtype"] = compute_dtype + kwargs["dtype"] = compute_dtype # flash-attn is required try: @@ -409,7 +407,7 @@ class Qwen3TTSProvider(BaseTTSProvider): compute_dtype = torch.bfloat16 if self.device == "cuda" else torch.float32 kwargs = {"device_map": f"{self.device}:0" if self.device == "cuda" else self.device} - kwargs["torch_dtype"] = compute_dtype + kwargs["dtype"] = compute_dtype kwargs["attn_implementation"] = "flash_attention_2" self._clone_model = Qwen3TTSModel.from_pretrained(model_name, **kwargs)