Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for full FP8 quantization (FP8 activations + FP8 weights) of the DiT model using TorchAO, enabling reduced memory usage and improved execution efficiency while preserving model quality.
Quantization details
Quantization method:
FP8 dynamic activations + FP8 weights (
Float8DynamicActivationFloat8WeightConfig)All DiT modules are quantized by default
The following layers are explicitly excluded for numerical stability:
Time, text, and visual embedding input/output layers
Final output and modulation layers
FFN output projections:
text_transformer_blocks[0–3].feed_forward.out_layervisual_transformer_blocks[0–59].feed_forward.out_layerPerformance comparison (FP8 vs Base)
Percentages are computed relative to the base model. Negative values indicate faster execution.
New dependency
FP8 quantization relies on TorchAO:
How to generate FP8 weights
The script produces, for example:
How to run the FP8-quantized model
Important
Running the FP8-quantized model with
offload=Trueresults in a runtime failure with the following error:The issue is known but not yet resolved. Due to project time constraints, a full investigation and fix of the interaction between FP8-quantized TorchAO modules and offloading mechanics were not completed.
At the moment, FP8 quantization is supported only with
offload=False.