MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / set_processor

Method set_processor

src/diffusers/models/attention_processor.py:380–398  ·  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

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"""

Calls 2

infoMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected