-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Description
When loading QwenImageEditPipeline (or other pipelines with Transformers models) using torch_dtype parameter, a deprecation warning is displayed:
pipeline = QwenImageEditPipeline.from_pretrained(
"Qwen/Qwen-Image-Edit",
torch_dtype=torch.bfloat16,
)Warning message:
`torch_dtype` is deprecated! Use `dtype` instead!
However, if users try to use dtype instead of torch_dtype as suggested by the warning, it causes an error because the diffusers' from_pretrained method doesn't accept dtype as a parameter.
Root Cause
The deprecation warning originates from the Transformers library, which has deprecated torch_dtype in favor of dtype. When diffusers loads Transformers models (like text encoders in QwenImageEditPipeline), it passes torch_dtype to the Transformers' from_pretrained method, triggering this warning.
Proposed Solution
Internally convert torch_dtype to dtype when loading Transformers models within diffusers, so users can continue using the existing API without warnings.