MCPcopy
hub / github.com/huggingface/diffusers / state_dict

Method state_dict

src/diffusers/models/lora.py:109–115  ·  view source on GitHub ↗
(self, *args, destination=None, prefix="", keep_vars=False)

Source from the content-addressed store, hash-verified

107 # overwrite PyTorch's `state_dict` to be sure that only the 'regular_linear_layer' weights are saved
108 # when saving the whole text encoder model and when LoRA is unloaded or fused
109 def state_dict(self, *args, destination=None, prefix="", keep_vars=False):
110 if self.lora_linear_layer is None:
111 return self.regular_linear_layer.state_dict(
112 *args, destination=destination, prefix=prefix, keep_vars=keep_vars
113 )
114
115 return super().state_dict(*args, destination=destination, prefix=prefix, keep_vars=keep_vars)
116
117 def _fuse_lora(self, lora_scale=1.0, safe_fusing=False):
118 if self.lora_linear_layer is None:

Callers 15

load_sub_modelFunction · 0.45
decode_to_imageMethod · 0.45
decode_to_meshMethod · 0.45
pack_weightsMethod · 0.45
from_single_fileMethod · 0.45
load_lora_adapterMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected