diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

[tests] add a test on torch compile for varied resolutions

Open sayakpaul opened this issue 8 months ago • 3 comments

What does this PR do?

After https://github.com/huggingface/diffusers/issues/11360 and https://github.com/huggingface/diffusers/pull/11297, we can notice how torch.compile() can also benefit scenarios that go through shape changes.

This PR adds a test to catch recompilation errors on shape changes when compilation was performed with dynamic=True. I think it mimics many practical user workflows.

Requesting a review from Yiyi as you were interested in this feature.

Cc: @anijain2305 @strongerxi for visibility.

sayakpaul avatar Jun 23 '25 09:06 sayakpaul

we also can update the doc for hot swap lora then?

I haven't added a test for this in our Hotswap + Compilation tests: https://github.com/huggingface/diffusers/blob/7bc0a07b1947bcbe0e84bbe9ecf8ae2d234382c4/tests/models/test_modeling_common.py#L1971

I will do so in a future PR. But meanwhile, let me update the docs: https://huggingface.co/docs/diffusers/en/optimization/torch2.0#torchcompile

sayakpaul avatar Jun 24 '25 03:06 sayakpaul

Cc: @AstraliteHeart this is how I envisioned the test for dynamic compilation. If you have time, it'd be great to have these tests enabled for AuraFlow, too :)

sayakpaul avatar Jun 24 '25 03:06 sayakpaul

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.