fix loading logic

This commit is contained in:
vasqu
2026-01-23 10:48:11 +01:00
parent 587ebf6389
commit ab0f77849b
@@ -1868,6 +1868,11 @@ class Qwen3TTSForConditionalGeneration(Qwen3TTSPreTrainedModel, GenerationMixin)
weights_only=True,
**kwargs,
):
# Hotfix to enable passing the correct attn implementation which is stored in the config but not in kwargs
requested_attn_implementation = kwargs.pop("attn_implementation", None)
if requested_attn_implementation is None and config and config._attn_implementation:
requested_attn_implementation = config._attn_implementation
model = super().from_pretrained(
pretrained_model_name_or_path,
*model_args,
@@ -1880,6 +1885,7 @@ class Qwen3TTSForConditionalGeneration(Qwen3TTSPreTrainedModel, GenerationMixin)
revision=revision,
use_safetensors=use_safetensors,
weights_only=weights_only,
attn_implementation=requested_attn_implementation,
**kwargs,
)
if not local_files_only and not os.path.isdir(pretrained_model_name_or_path):