MCPcopy Create free account
hub / github.com/aim-uofa/Framer / __call__

Method __call__

models_diffusers/attention_processor.py:1831–1849  ·  view source on GitHub ↗
(self, attn: Attention, hidden_states: torch.FloatTensor, *args, **kwargs)

Source from the content-addressed store, hash-verified

1829 self.to_out_lora = LoRALinearLayer(out_hidden_size, out_hidden_size, out_rank, network_alpha)
1830
1831 def __call__(self, attn: Attention, hidden_states: torch.FloatTensor, *args, **kwargs) -> torch.FloatTensor:
1832 self_cls_name = self.__class__.__name__
1833 deprecate(
1834 self_cls_name,
1835 "0.26.0",
1836 (
1837 f"Make sure use {self_cls_name[4:]} instead by setting"
1838 "LoRA layers to `self.{to_q,to_k,to_v,to_out[0]}.lora_layer` respectively. This will be done automatically when using"
1839 " `LoraLoaderMixin.load_lora_weights`"
1840 ),
1841 )
1842 attn.to_q.lora_layer = self.to_q_lora.to(hidden_states.device)
1843 attn.to_k.lora_layer = self.to_k_lora.to(hidden_states.device)
1844 attn.to_v.lora_layer = self.to_v_lora.to(hidden_states.device)
1845 attn.to_out[0].lora_layer = self.to_out_lora.to(hidden_states.device)
1846
1847 attn._modules.pop("processor")
1848 attn.processor = AttnProcessor2_0()
1849 return attn.processor(attn, hidden_states, *args, **kwargs)
1850
1851
1852class LoRAXFormersAttnProcessor(nn.Module):

Callers

nothing calls this directly

Calls 1

AttnProcessor2_0Class · 0.85

Tested by

no test coverage detected