Speedup model loading by 4-5x in Diffusers ⚡ by a-r-r-o-w · Pull Request #3674 · huggingface/accelerate

@a-r-r-o-w

@a-r-r-o-w

@a-r-r-o-w

@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.

@a-r-r-o-w

a-r-r-o-w



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

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

SunMarc

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,

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 ?

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?

@a-r-r-o-w

@a-r-r-o-w

SunMarc

Choose a reason for hiding this comment

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

Nice !