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

Method enable_lora

diffusers/src/diffusers/loaders/peft.py:339–360  ·  view source on GitHub ↗

Enables 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

337 set_adapter_layers(self, enabled=False)
338
339 def enable_lora(self):
340 """
341 Enables the active LoRA layers of the underlying model.
342
343 Example:
344
345 ```py
346 from diffusers import AutoPipelineForText2Image
347 import torch
348
349 pipeline = AutoPipelineForText2Image.from_pretrained(
350 "stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16
351 ).to("cuda")
352 pipeline.load_lora_weights(
353 "jbilcke-hf/sdxl-cinematic-1", weight_name="pytorch_lora_weights.safetensors", adapter_name="cinematic"
354 )
355 pipeline.enable_lora()
356 ```
357 """
358 if not USE_PEFT_BACKEND:
359 raise ValueError("PEFT backend is required for this method.")
360 set_adapter_layers(self, enabled=True)
361
362 def delete_adapters(self, adapter_names: Union[List[str], str]):
363 """

Callers

nothing calls this directly

Calls 1

set_adapter_layersFunction · 0.85

Tested by

no test coverage detected