You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the third model and load lora, I get a error:
transformer_flux.py", line 825, in update_lora_params
assert isinstance(block, NunchakuFluxTransformerBlocks)
AssertionError
Here is the code:
`import torch
from diffusers import FluxPipeline
from nunchaku import NunchakuFluxTransformer2dModel
from nunchaku.utils import get_precision
from nunchaku import NunchakuFluxTransformer2dModel, NunchakuT5EncoderModel
from optimum.quanto import freeze, qfloat8, quantize, quantization_map
from torchao.quantization import quantize_, int8_weight_only, int4_weight_only
from tonera.teacache import teacache_forward,set_tea_cache
precision = get_precision() # auto-detect your precision is 'int4' or 'fp4' based on your GPU
base_model = "models/majicflus_v10.safetensors"
NunchakuFluxTransformer2dModel.forward = teacache_forward
transformer = NunchakuFluxTransformer2dModel.from_single_file(
base_model,
torch_dtype=torch.bfloat16,
config='models/FLUX.1-dev/transformer/config.json'
)
set_tea_cache(transformer,30)
quantize_(transformer, int8_weight_only())
LoRA Related Code
transformer.update_lora_params(
"loras/Ghibili-Cartoon-Art.safetensors"
) # Path to your LoRA safetensors, can also be a remote HuggingFace path
transformer.set_lora_strength(1) # Your LoRA strength here
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", # noqa: E501
num_inference_steps=25,
guidance_scale=3.5,
).images[0]
image.save(f"/home/tonera/website/output/flux.1-dev-ghibsky-int4.png")`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When I use the third model and load lora, I get a error:
Here is the code:
`import torch
from diffusers import FluxPipeline
from nunchaku import NunchakuFluxTransformer2dModel
from nunchaku.utils import get_precision
from nunchaku import NunchakuFluxTransformer2dModel, NunchakuT5EncoderModel
from optimum.quanto import freeze, qfloat8, quantize, quantization_map
from torchao.quantization import quantize_, int8_weight_only, int4_weight_only
from tonera.teacache import teacache_forward,set_tea_cache
precision = get_precision() # auto-detect your precision is 'int4' or 'fp4' based on your GPU
base_model = "models/majicflus_v10.safetensors"
NunchakuFluxTransformer2dModel.forward = teacache_forward
transformer = NunchakuFluxTransformer2dModel.from_single_file(
base_model,
torch_dtype=torch.bfloat16,
config='models/FLUX.1-dev/transformer/config.json'
)
set_tea_cache(transformer,30)
quantize_(transformer, int8_weight_only())
LoRA Related Code
transformer.update_lora_params(
"loras/Ghibili-Cartoon-Art.safetensors"
) # Path to your LoRA safetensors, can also be a remote HuggingFace path
transformer.set_lora_strength(1) # Your LoRA strength here
End of LoRA Related Code
text_encoder_2 = NunchakuT5EncoderModel.from_pretrained("weights/nunchaku-t5/awq-int4-flux.1-t5xxl.safetensors")
pipeline = FluxPipeline.from_pretrained(
"models/FLUX.1-dev",
transformer=transformer,
torch_dtype=torch.bfloat16,
text_encoder_2=text_encoder_2
).to("cuda")
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", # noqa: E501
num_inference_steps=25,
guidance_scale=3.5,
).images[0]
image.save(f"/home/tonera/website/output/flux.1-dev-ghibsky-int4.png")`
Beta Was this translation helpful? Give feedback.
All reactions