"docs/vscode:/vscode.git/clone" did not exist on "1bd3a2fb34ba26197a08dfa836c3913d99469c59"
Unverified Commit ce1063ac authored by Sayak Paul's avatar Sayak Paul Committed by GitHub
Browse files

[docs] add a snippet for compilation in the auraflow docs. (#11327)

* add a snippet for compilation in the auraflow docs.

* include speedups.
parent 7212f35d
...@@ -89,6 +89,21 @@ image = pipeline(prompt).images[0] ...@@ -89,6 +89,21 @@ image = pipeline(prompt).images[0]
image.save("auraflow.png") image.save("auraflow.png")
``` ```
## Support for `torch.compile()`
AuraFlow can be compiled with `torch.compile()` to speed up inference latency even for different resolutions. First, install PyTorch nightly following the instructions from [here](https://pytorch.org/). The snippet below shows the changes needed to enable this:
```diff
+ torch.fx.experimental._config.use_duck_shape = False
+ pipeline.transformer = torch.compile(
pipeline.transformer, fullgraph=True, dynamic=True
)
```
This enables from 100% (on low resolutions) to a 30% (on 1536x1536 resolution) speed improvements.
Thanks to [AstraliteHeart](https://github.com/huggingface/diffusers/pull/11297/) who helped us rewrite the [`AuraFlowTransformer2DModel`] class so that the above works for different resolutions ([PR](https://github.com/huggingface/diffusers/pull/11297/)).
## AuraFlowPipeline ## AuraFlowPipeline
[[autodoc]] AuraFlowPipeline [[autodoc]] AuraFlowPipeline
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment