MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / __init__

Method __init__

diffusers/src/diffusers/models/lora.py:84–107  ·  view source on GitHub ↗
(self, regular_linear_layer, lora_scale=1, network_alpha=None, rank=4, dtype=None)

Source from the content-addressed store, hash-verified

82
83class PatchedLoraProjection(torch.nn.Module):
84 def __init__(self, regular_linear_layer, lora_scale=1, network_alpha=None, rank=4, dtype=None):
85 deprecation_message = "Use of `PatchedLoraProjection` is deprecated. Please switch to PEFT backend by installing PEFT: `pip install peft`."
86 deprecate("PatchedLoraProjection", "1.0.0", deprecation_message)
87
88 super().__init__()
89 from ..models.lora import LoRALinearLayer
90
91 self.regular_linear_layer = regular_linear_layer
92
93 device = self.regular_linear_layer.weight.device
94
95 if dtype is None:
96 dtype = self.regular_linear_layer.weight.dtype
97
98 self.lora_linear_layer = LoRALinearLayer(
99 self.regular_linear_layer.in_features,
100 self.regular_linear_layer.out_features,
101 network_alpha=network_alpha,
102 device=device,
103 dtype=dtype,
104 rank=rank,
105 )
106
107 self.lora_scale = lora_scale
108
109 # overwrite PyTorch's `state_dict` to be sure that only the 'regular_linear_layer' weights are saved
110 # when saving the whole text encoder model and when LoRA is unloaded or fused

Callers

nothing calls this directly

Calls 3

deprecateFunction · 0.85
LoRALinearLayerClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected