Skip to content

Speedup model loading by 4-5x in Diffusers ⚡#3674

Merged
SunMarc merged 5 commits intohuggingface:mainfrom
a-r-r-o-w:speedup-model-loading
Jul 11, 2025
Merged

Speedup model loading by 4-5x in Diffusers ⚡#3674
SunMarc merged 5 commits intohuggingface:mainfrom
a-r-r-o-w:speedup-model-loading

Conversation

@a-r-r-o-w
Copy link
Contributor

Sister PR in diffusers: huggingface/diffusers#11904

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.



>>> @find_executable_batch_size(starting_batch_size=128)
... def train(batch_size, model, optimizer):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Change is unrelated. Seems to come from ruff, and I'm not sure why. I'm using the ruff version from the setup.py

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Thanks for this ! A minor suggestion

Comment on lines +225 to +226
non_blocking: bool = False,
_empty_cache: bool = True,
Copy link
Member

Choose a reason for hiding this comment

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

can you update the docstring also ? Also, maybe empty_cache or clear_cache ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SunMarc Thanks, updated! Could you take a look again?

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

Nice !

@SunMarc SunMarc merged commit 524e5f9 into huggingface:main Jul 11, 2025
25 checks passed
@a-r-r-o-w a-r-r-o-w deleted the speedup-model-loading branch July 11, 2025 15:03
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.

3 participants