MCPcopy Create free account
hub / github.com/huggingface/diffusers / disable_lora

Method disable_lora

src/diffusers/loaders/peft.py:717–738  ·  view source on GitHub ↗

Disables the active LoRA layers of the underlying model. Example: ```py from diffusers import AutoPipelineForText2Image import torch pipeline = AutoPipelineForText2Image.from_pretrained( "stabilityai/stable-diffusion-xl-base-1.0", torch

(self)

Source from the content-addressed store, hash-verified

715 _maybe_remove_and_reapply_group_offloading(self)
716
717 def disable_lora(self):
718 """
719 Disables the active LoRA layers of the underlying model.
720
721 Example:
722
723 ```py
724 from diffusers import AutoPipelineForText2Image
725 import torch
726
727 pipeline = AutoPipelineForText2Image.from_pretrained(
728 "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
729 ).to("cuda")
730 pipeline.load_lora_weights(
731 "jbilcke-hf/sdxl-cinematic-1", weight_name="pytorch_lora_weights.safetensors", adapter_name="cinematic"
732 )
733 pipeline.unet.disable_lora()
734 ```
735 """
736 if not USE_PEFT_BACKEND:
737 raise ValueError("PEFT backend is required for this method.")
738 set_adapter_layers(self, enabled=False)
739
740 def enable_lora(self):
741 """

Calls 1

set_adapter_layersFunction · 0.85