Enables the LoRA layers for the text encoder. Args: text_encoder (`torch.nn.Module`, *optional*): The text encoder module to enable the LoRA layers for. If `None`, it will try to get the `text_encoder` attribute.
(text_encoder: "PreTrainedModel" | None = None)
| 175 | |
| 176 | |
| 177 | def enable_lora_for_text_encoder(text_encoder: "PreTrainedModel" | None = None): |
| 178 | """ |
| 179 | Enables the LoRA layers for the text encoder. |
| 180 | |
| 181 | Args: |
| 182 | text_encoder (`torch.nn.Module`, *optional*): |
| 183 | The text encoder module to enable the LoRA layers for. If `None`, it will try to get the `text_encoder` |
| 184 | attribute. |
| 185 | """ |
| 186 | if text_encoder is None: |
| 187 | raise ValueError("Text Encoder not found.") |
| 188 | set_adapter_layers(text_encoder, enabled=True) |
| 189 | |
| 190 | |
| 191 | def _remove_text_encoder_monkey_patch(text_encoder): |
no test coverage detected
searching dependent graphs…