Scripts for safetensors model conversion and editing, such as nvfp4 quantization (see to_format.py).
python to_format.py path/to/model.safetensors path/to/modeldef.sc types...
types can be the name of a pytorch type, or nvfp4/fp8_scaled for quant types.
Multiple types are supported if the .sc config supports it. More info here. Example .sc configs can be found in model_defs.
Supports loading regular pytorch types, comfy format nvfp4 and fp8_scaled.
Supports converting to the following types (and aliases):
fp64-doublefp32-fp,float,fullfp16-halfbf16-brainfp8_e4m3fn-fp8_e4m3,fp8_e4,fp8fp8_e5m2-fp8_e5nvfp4-fp4(using comfy kitchen)fp8_scaled-scaled_fp8(using comfy kitchen)
- SVD creation from precision losses
use --svd [rank]to create a corrector lora. (Note: effectiveness depends on implementation.)
- comfy kitchen - Used for nvfp4 and fp8 scaled quantization and dequantization.