MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / disable_lora

Method disable_lora

diffusers/src/diffusers/loaders/peft.py:316–337  ·  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

314 del self.peft_config
315
316 def disable_lora(self):
317 """
318 Disables the active LoRA layers of the underlying model.
319
320 Example:
321
322 ```py
323 from diffusers import AutoPipelineForText2Image
324 import torch
325
326 pipeline = AutoPipelineForText2Image.from_pretrained(
327 "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
328 ).to("cuda")
329 pipeline.load_lora_weights(
330 "jbilcke-hf/sdxl-cinematic-1", weight_name="pytorch_lora_weights.safetensors", adapter_name="cinematic"
331 )
332 pipeline.disable_lora()
333 ```
334 """
335 if not USE_PEFT_BACKEND:
336 raise ValueError("PEFT backend is required for this method.")
337 set_adapter_layers(self, enabled=False)
338
339 def enable_lora(self):
340 """

Calls 1

set_adapter_layersFunction · 0.85