Open
Conversation
Author
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.


Title: Add NVFP4 weights-only quantization support to fit Kandinsky-5 Pro into 24 GB VRAM
Summary
This PR adds support for weights-only NVFP4 quantization for the model so that it can run on GPUs with 24 GB VRAM (with
offload=True).Changes
create_nvfp4_weights.pyto generate NVFP4-quantized checkpoints from the original weights.torch.compileinkandinsky/models/dit.py, which makes NVFP4-quantized runs work significantly better; the baseline model path has also been verified to work with it.model_type="quantized"quantized_model_path="kandinsky-5/K5Pro_nvfp4.pth"New dependency
Before using NVFP4 quantization, install NVIDIA ModelOpt:
pip install -U "nvidia-modelopt[all]"Supported modes (24 GB)
On a 24 GB GPU, the NVFP4-quantized weights allow the following modes to run with
offload=True:5s sft sd
10s sft sd
How to generate NVFP4 weights
Use the provided script to create a quantized checkpoint from the original model weights:
The script produces, e.g.:
How to run the quantized model
In your config or launch script, select the quantized model type and point to the generated checkpoint, for example: