MCPcopy Index your code
hub / github.com/huggingface/diffusers / set_processor

Method set_processor

src/diffusers/models/attention_processor.py:535–553  ·  view source on GitHub ↗

r""" Set the attention processor to use. Args: processor (`AttnProcessor`): The attention processor to use.

(self, processor: "AttnProcessor")

Source from the content-addressed store, hash-verified

533 self.set_processor(processor)
534
535 def set_processor(self, processor: "AttnProcessor") -> None:
536 r"""
537 Set the attention processor to use.
538
539 Args:
540 processor (`AttnProcessor`):
541 The attention processor to use.
542 """
543 # if current processor is in `self._modules` and if passed `processor` is not, we need to
544 # pop `processor` from `self._modules`
545 if (
546 hasattr(self, "processor")
547 and isinstance(self.processor, torch.nn.Module)
548 and not isinstance(processor, torch.nn.Module)
549 ):
550 logger.info(f"You are removing possibly trained weights of {self.processor} with {processor}")
551 self._modules.pop("processor")
552
553 self.processor = processor
554
555 def get_processor(self, return_deprecated_lora: bool = False) -> "AttentionProcessor":
556 r"""

Callers 15

__init__Method · 0.95
set_attention_sliceMethod · 0.95
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 2

infoMethod · 0.80
popMethod · 0.45

Tested by 2