LoRA loader for nunchaku transformer

#2
by NMHung - opened

Thanks for releasing the Nunchaku quantized version. I’m just wondering how to load an unquantized LoRA into this quantized Nunchaku transformer?

Owner

About lora
LoRA support for FLUX.2-klein-9B-Nunchaku has been released.Please copy the files from the repository to the corresponding directories:

nunchaku/lora/common/
nunchaku/models/transformers/transformer_flux2.py
nunchaku/torch_transfer_utils.py

Usage

lora_path = "/home/tonera/loras/ultra_real_v2.safetensors"
transformer.update_lora_params(lora_path)
transformer.set_lora_strength(0.8)

BTW: How to locate the Nunchaku installation path and copy the above files to the correct directories? Run the following command:

python -c "import nunchaku; print(nunchaku.file)"

You will get output similar to this:/home/tonera/miniconda3/envs/aiservice/lib/python3.11/site-packages/nunchaku/init.py Here, /home/tonera/miniconda3/envs/aiservice/lib/python3.11/site-packages/nunchaku is your Nunchaku installation directory. Simply copy the aforementioned files into the matching subdirectories under this path.

Sign up or log in to comment