MiniMax H3 w4a8 Quantizer
(Directions are under the cut!!)
Observation: Kijai's w4a8 version of H3 is excellent; very close to identical to the int8_convrot at half the memory cost.
Problem: People aren't making w4a8 versions of their H3 finetunes!
Solution: You're looking at it!
This is a Python script that converts a full-precision BF16 file for a Minimax H3-based model, and spits out a w4a8 version. It streams the weights from disk layer by layer, instead of loading the entire model at once, so you DON'T have to have 70GB of memory available to use it! (If you can use Kijai's w4a8 of the base model, you should be good to go.)
The script itself was written by GPT 5.6 Terra, but I tested it myself both making a pruned and unpruned version and it works great. The first video here is with my w4a8 quant of PinkCherry; the second is the official int8_convrot.
Directions
Download this archive and extract it somewhere.
Download and install uv, or if you don't want to do that, see "Python venv" below. (Use uv though.)
Download a full-precision BF16 MiniMax H3 model. To replicate the videos above, use PinkCherry beta 0.6. Put it next to the script. (I haven't tested it with things that alter the model architecture in any arcane way like 10Eros. You can try though. Report back!)
Open a terminal in the same directory as the script and the BF16 weights and run this, replacing <MODEL> with the name of the BF16 .safetensors file and <QUANT> with... whatever you'll remember.
uv run --script convert_minimax_h3_w4a8_streaming.py <MODEL> <QUANT>By default, this script keeps adaln intact, but if you want to make a pruned checkpoint, you can pass --prune-adaln, like so:
uv run --script convert_minimax_h3_w4a8_streaming.py --prune-adaln <MODEL> <QUANT>To create the file used in the example videos, I did this (the backslashes are just so you can use newlines for readability):
uv run --script convert_minimax_h3_w4a8_streaming.py --prune-adaln \
PinkCherry_fl2va_MiniMax_H3_bf16_beta-0.6.safetensors \
PinkCherry_fl2va_MiniMax_H3_w4a8_pruned_beta-0.6.safetensorsOnce finished, put the resulting file in your diffusion_models folder, and give it a test! If it's to your liking, you can delete the BF16 weights to reclaim your disk space.
(Note that I haven't tested this with things that alter the model architecture in any arcane way like 10Eros. You can try though. Report back!)
Python venv
If you don't want to/can't install uv for some reason, the script can also be used with Python >= 3.10, with these dependencies. This is the "I know what I'm doing" path, please don't ask for help with this, I use uv to not have to deal with this stuff!
numpy>=1.26,<3
torch==2.7.1 (if you need CUDA then make sure to pass the right https://download.pytorch.org/whl/<cuXYZ> index URL as well)
triton==3.3.1
Video made from a Krea 2 image I made while shitposting with a friend. There's your explanation for it.
Description
Rewritten by GPT-5.6 Sol. It behaves exactly the same as the original, except it isn't a complete travesty to read, and the error behavior was improved to fail explicitly instead of quietly producing a broken output. It doesn't really matter which one you use, the model it produces is byte-identical.
Comments (3)
Can You explain, in plain engrish, what it exactly does?
- Save memory (I do assume so)
- Speed up generations (I do assume it slows it down due to streaming from even nvme)?
what are issue (frog in one gen don't have spark in the eyes)?
This is a Python script that makes a w4a8 model, which is a high-quality 4-bit quant format that's also fast on GPUs older than the 5000 series (unlike nvfp4). You can get Kijai's w4a8 version of H3 here; it's experimental but produces great results for me, which is why I made this! It's a drop-in replacement for the int8_convrot or fp8_scaled model you might be using right now.
The first video here was made with a quant of PinkCherry produced by the script. The second was made with its int8_convrot. As you can see, they're pretty close!! The int8_convrot model took nearly 3 times as long though, in part because it kept hitting swap.
You only have to run the script once; after that, you just use the model like normal. The "streaming from disk" detail is for running the script; as if you didn't do this, you'd have to load the whole model at once, which isn't feasible for the kind of hardware you'd want to use w4a8 with.
Now that I've had some sleep, I'll update the readme with this information as well as usage instructions. :)
Testing, minimal, on my end, using Kijai MMH3 Experimental:
- quality: more or less same as int8-convrot "full model", keep in mind that I do generate at res 0.2MP
- speed: no difference on my end with 96GB RAM and 5090 32GB VRAM
- space: almost half the size
Will test more and maybe update if something changes.
Anyway great work and worth checking out IMHO.