"tests/yoso/test_modeling_yoso.py" did not exist on "2f06f2bcd66917d878db04a3b8c79968b530255c"
int4-flux.1-dev-lora.py 932 Bytes
Newer Older
1
2
3
import torch
from diffusers import FluxPipeline

muyangli's avatar
muyangli committed
4
from nunchaku import NunchakuFluxTransformer2dModel
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

transformer = NunchakuFluxTransformer2dModel.from_pretrained("mit-han-lab/svdq-int4-flux.1-dev")
pipeline = FluxPipeline.from_pretrained(
    "black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16
).to("cuda")

### LoRA Related Code ###
transformer.update_lora_params(
    "mit-han-lab/svdquant-lora-collection/svdq-int4-flux.1-dev-ghibsky.safetensors"
)  # Path to your converted LoRA safetensors, can also be a remote HuggingFace path
transformer.set_lora_strength(1)  # Your LoRA strength here
### End of LoRA Related Code ###

image = pipeline(
    "GHIBSKY style, cozy mountain cabin covered in snow, with smoke curling from the chimney and a warm, inviting light spilling through the windows",
    num_inference_steps=25,
    guidance_scale=3.5,
).images[0]
image.save("flux.1-dev-ghibsky.png")