Repository navigation
Replies: 3 comments
|
I think you need to fuse the loras then save. Possibly you only need to save the two transformers as well |
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
|
Fuse the LoRAs into the bf16 weights, drop the LoRA layers, save, then reload that checkpoint with your One Wan-specific catch: import torch, diffusers
repo = "linoyts/Wan2.2-VACE-Fun-14B-diffusers"
vae = diffusers.AutoencoderKLWan.from_pretrained(repo, subfolder="vae", torch_dtype=torch.float32)
wan = diffusers.WanVACEPipeline.from_pretrained(repo, vae=vae, torch_dtype=torch.bfloat16)
wan.load_lora_weights("lightx2v/Wan2.2-Lightning",
weight_name="Wan2.2-I2V-A14B-4steps-lora-rank64-Seko-V1/high_noise_model.safetensors", adapter_name="lightning")
wan.load_lora_weights("lightx2v/Wan2.2-Lightning",
weight_name="Wan2.2-I2V-A14B-4steps-lora-rank64-Seko-V1/low_noise_model.safetensors", adapter_name="lightning_2",
load_into_transformer_2=True)
wan.set_adapters(["lightning", "lightning_2"], adapter_weights=[1.0, 1.0])
wan.fuse_lora(components=["transformer", "transformer_2"], lora_scale=1.0)
wan.unload_lora_weights() # removes the PEFT layers, the fused weights stay
wan.save_pretrained("wan-fused") # plain bf16 checkpoint with the LoRAs baked in
# reload with quantization, then save the quantized version
q = diffusers.WanVACEPipeline.from_pretrained(
"wan-fused",
vae=diffusers.AutoencoderKLWan.from_pretrained("wan-fused", subfolder="vae", torch_dtype=torch.float32),
torch_dtype=torch.bfloat16,
quantization_config=diffusers.PipelineQuantizationConfig(
quant_backend="bitsandbytes_8bit",
quant_kwargs={"load_in_8bit": True},
components_to_quantize=["transformer", "transformer_2"],
),
)
q.save_pretrained("wan-lightning-8bit")The intermediate bf16 checkpoint is large (two 14B transformers). If disk is tight, you only need to save I haven't run this end to end (14B model, and bnb needs CUDA). The |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
normally I can save the quantization model in this way
But now I want to merge lora and the quantization and then save the model with lora. How?
@yiyixuxu @DN6
All reactions