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

Function disable_lora_for_text_encoder

src/diffusers/loaders/lora_base.py:163–174  ·  view source on GitHub ↗

Disables the LoRA layers for the text encoder. Args: text_encoder (`torch.nn.Module`, *optional*): The text encoder module to disable the LoRA layers for. If `None`, it will try to get the `text_encoder` attribute.

(text_encoder: "PreTrainedModel" | None = None)

Source from the content-addressed store, hash-verified

161
162
163def disable_lora_for_text_encoder(text_encoder: "PreTrainedModel" | None = None):
164 """
165 Disables the LoRA layers for the text encoder.
166
167 Args:
168 text_encoder (`torch.nn.Module`, *optional*):
169 The text encoder module to disable the LoRA layers for. If `None`, it will try to get the `text_encoder`
170 attribute.
171 """
172 if text_encoder is None:
173 raise ValueError("Text Encoder not found.")
174 set_adapter_layers(text_encoder, enabled=False)
175
176
177def enable_lora_for_text_encoder(text_encoder: "PreTrainedModel" | None = None):

Callers 1

disable_loraMethod · 0.85

Calls 1

set_adapter_layersFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…