r""" Set the attention processor to use. Args: processor (`AttnProcessor`): The attention processor to use.
(self, processor: "AttnProcessor")
| 378 | self.set_processor(processor) |
| 379 | |
| 380 | def set_processor(self, processor: "AttnProcessor") -> None: |
| 381 | r""" |
| 382 | Set the attention processor to use. |
| 383 | |
| 384 | Args: |
| 385 | processor (`AttnProcessor`): |
| 386 | The attention processor to use. |
| 387 | """ |
| 388 | # if current processor is in `self._modules` and if passed `processor` is not, we need to |
| 389 | # pop `processor` from `self._modules` |
| 390 | if ( |
| 391 | hasattr(self, "processor") |
| 392 | and isinstance(self.processor, torch.nn.Module) |
| 393 | and not isinstance(processor, torch.nn.Module) |
| 394 | ): |
| 395 | logger.info(f"You are removing possibly trained weights of {self.processor} with {processor}") |
| 396 | self._modules.pop("processor") |
| 397 | |
| 398 | self.processor = processor |
| 399 | |
| 400 | def get_processor(self, return_deprecated_lora: bool = False) -> "AttentionProcessor": |
| 401 | r""" |
no test coverage detected