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)
| 161 | |
| 162 | |
| 163 | def 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 | |
| 177 | def enable_lora_for_text_encoder(text_encoder: "PreTrainedModel" | None = None): |
no test coverage detected
searching dependent graphs…