Skip to content

[fix] Diffusers dtype in code snippets#2280

Merged
stevhliu merged 1 commit into
huggingface:mainfrom
stevhliu:diffusers-dtype
Jul 15, 2026
Merged

[fix] Diffusers dtype in code snippets#2280
stevhliu merged 1 commit into
huggingface:mainfrom
stevhliu:diffusers-dtype

Conversation

@stevhliu

@stevhliu stevhliu commented Jul 7, 2026

Copy link
Copy Markdown
Member

Use torch_dtype instead of dtype (not supported by from_pretrained) for the Diffusers Hub snippets (see Slack thread for more context)

cc @sayakpaul @pagezyhf


Note

Low Risk
Documentation-only string changes in snippet templates; no runtime or API behavior in the app.

Overview
Updates generated Diffusers Hub code snippets so from_pretrained calls pass torch_dtype instead of dtype, which Diffusers does not accept on that API.

The change is applied consistently across text-to-image, img2img, video, LoRA, textual inversion, Flux fill, and inpainting snippet templates in model-libraries-snippets.ts, so copy-paste examples load pipelines with the intended half/bfloat precision.

Reviewed by Cursor Bugbot for commit f715770. Bugbot is set up for automated code reviews on this repo. Configure here.

@julien-c

julien-c commented Jul 9, 2026

Copy link
Copy Markdown
Member

there's no way to alias dtype to torch_dtype for backward compatibility?

@stevhliu

stevhliu commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

yeah i think we can also do that and it'd be aligned with transformers as well :) wdyt @sayakpaul?

@sayakpaul

Copy link
Copy Markdown
Member

It is currently not planned.

@julien-c

Copy link
Copy Markdown
Member

let's add the alias before merging this then. Should be simple

@pagezyhf

Copy link
Copy Markdown
Contributor

hello, are there any chance to have this one merged by the 15th for a partner launch?

@stevhliu

Copy link
Copy Markdown
Member Author

@julien-c, alias has been added in huggingface/diffusers#14162 so this should be ready to merge

@julien-c

Copy link
Copy Markdown
Member

so we merge this and in a couple of weeks (when people upgrade their diffusers version) we revert it, is this correct?

@stevhliu

Copy link
Copy Markdown
Member Author

yeah i believe so, diffusers is planning on deprecating torch_dtype - see huggingface/diffusers#14162 (comment) - and consolidate to dtype

@julien-c julien-c left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's remember to revert in a couple of weeks

@stevhliu
stevhliu merged commit 2d06031 into huggingface:main Jul 15, 2026
7 of 9 checks passed
@stevhliu
stevhliu deleted the diffusers-dtype branch July 15, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants