Skip to content

Commit 17c1be2

Browse files
committed
revert name
1 parent bd81f50 commit 17c1be2

11 files changed

+30
-30
lines changed

scripts/convert_sana_to_diffusers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
SanaPipeline,
1919
SanaTransformer2DModel,
2020
)
21-
from diffusers.models.modeling_utils import load_state_dict_into_meta
21+
from diffusers.models.modeling_utils import load_model_dict_into_meta
2222
from diffusers.utils.import_utils import is_accelerate_available
2323

2424

@@ -189,7 +189,7 @@ def main(args):
189189
)
190190

191191
if is_accelerate_available():
192-
load_state_dict_into_meta(transformer, converted_state_dict)
192+
load_model_dict_into_meta(transformer, converted_state_dict)
193193
else:
194194
transformer.load_state_dict(converted_state_dict, strict=True, assign=True)
195195

scripts/convert_sd3_to_diffusers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from diffusers import AutoencoderKL, SD3Transformer2DModel
99
from diffusers.loaders.single_file_utils import convert_ldm_vae_checkpoint
10-
from diffusers.models.modeling_utils import load_state_dict_into_meta
10+
from diffusers.models.modeling_utils import load_model_dict_into_meta
1111
from diffusers.utils.import_utils import is_accelerate_available
1212

1313

@@ -319,7 +319,7 @@ def main(args):
319319
dual_attention_layers=attn2_layers,
320320
)
321321
if is_accelerate_available():
322-
load_state_dict_into_meta(transformer, converted_transformer_state_dict)
322+
load_model_dict_into_meta(transformer, converted_transformer_state_dict)
323323
else:
324324
transformer.load_state_dict(converted_transformer_state_dict, strict=True)
325325

@@ -339,7 +339,7 @@ def main(args):
339339
)
340340
converted_vae_state_dict = convert_ldm_vae_checkpoint(original_ckpt, vae.config)
341341
if is_accelerate_available():
342-
load_state_dict_into_meta(vae, converted_vae_state_dict)
342+
load_model_dict_into_meta(vae, converted_vae_state_dict)
343343
else:
344344
vae.load_state_dict(converted_vae_state_dict, strict=True)
345345

scripts/convert_stable_audio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
StableAudioPipeline,
1919
StableAudioProjectionModel,
2020
)
21-
from diffusers.models.modeling_utils import load_state_dict_into_meta
21+
from diffusers.models.modeling_utils import load_model_dict_into_meta
2222
from diffusers.utils import is_accelerate_available
2323

2424

@@ -221,7 +221,7 @@ def convert_stable_audio_state_dict_to_diffusers(state_dict, num_autoencoder_lay
221221
], # assume `seconds_start` and `seconds_total` have the same min / max values.
222222
)
223223
if is_accelerate_available():
224-
load_state_dict_into_meta(projection_model, projection_model_state_dict)
224+
load_model_dict_into_meta(projection_model, projection_model_state_dict)
225225
else:
226226
projection_model.load_state_dict(projection_model_state_dict)
227227

@@ -242,7 +242,7 @@ def convert_stable_audio_state_dict_to_diffusers(state_dict, num_autoencoder_lay
242242
cross_attention_input_dim=model_config["cond_token_dim"],
243243
)
244244
if is_accelerate_available():
245-
load_state_dict_into_meta(model, model_state_dict)
245+
load_model_dict_into_meta(model, model_state_dict)
246246
else:
247247
model.load_state_dict(model_state_dict)
248248

@@ -260,7 +260,7 @@ def convert_stable_audio_state_dict_to_diffusers(state_dict, num_autoencoder_lay
260260
)
261261

262262
if is_accelerate_available():
263-
load_state_dict_into_meta(autoencoder, autoencoder_state_dict)
263+
load_model_dict_into_meta(autoencoder, autoencoder_state_dict)
264264
else:
265265
autoencoder.load_state_dict(autoencoder_state_dict)
266266

scripts/convert_stable_cascade.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
)
2121
from diffusers.loaders.single_file_utils import convert_stable_cascade_unet_single_file_to_diffusers
2222
from diffusers.models import StableCascadeUNet
23-
from diffusers.models.modeling_utils import load_state_dict_into_meta
23+
from diffusers.models.modeling_utils import load_model_dict_into_meta
2424
from diffusers.pipelines.wuerstchen import PaellaVQModel
2525
from diffusers.utils import is_accelerate_available
2626

@@ -126,7 +126,7 @@
126126
switch_level=[False],
127127
)
128128
if is_accelerate_available():
129-
load_state_dict_into_meta(prior_model, prior_state_dict)
129+
load_model_dict_into_meta(prior_model, prior_state_dict)
130130
else:
131131
prior_model.load_state_dict(prior_state_dict)
132132

@@ -181,7 +181,7 @@
181181
)
182182

183183
if is_accelerate_available():
184-
load_state_dict_into_meta(decoder, decoder_state_dict)
184+
load_model_dict_into_meta(decoder, decoder_state_dict)
185185
else:
186186
decoder.load_state_dict(decoder_state_dict)
187187

scripts/convert_stable_cascade_lite.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
)
2121
from diffusers.loaders.single_file_utils import convert_stable_cascade_unet_single_file_to_diffusers
2222
from diffusers.models import StableCascadeUNet
23-
from diffusers.models.modeling_utils import load_state_dict_into_meta
23+
from diffusers.models.modeling_utils import load_model_dict_into_meta
2424
from diffusers.pipelines.wuerstchen import PaellaVQModel
2525
from diffusers.utils import is_accelerate_available
2626

@@ -133,7 +133,7 @@
133133
)
134134

135135
if is_accelerate_available():
136-
load_state_dict_into_meta(prior_model, prior_state_dict)
136+
load_model_dict_into_meta(prior_model, prior_state_dict)
137137
else:
138138
prior_model.load_state_dict(prior_state_dict)
139139

@@ -189,7 +189,7 @@
189189
)
190190

191191
if is_accelerate_available():
192-
load_state_dict_into_meta(decoder, decoder_state_dict)
192+
load_model_dict_into_meta(decoder, decoder_state_dict)
193193
else:
194194
decoder.load_state_dict(decoder_state_dict)
195195

src/diffusers/loaders/single_file_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
if is_accelerate_available():
5454
from accelerate import init_empty_weights
5555

56-
from ..models.modeling_utils import load_state_dict_into_meta
56+
from ..models.modeling_utils import load_model_dict_into_meta
5757

5858
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
5959

@@ -1588,7 +1588,7 @@ def create_diffusers_clip_model_from_ldm(
15881588
raise ValueError("The provided checkpoint does not seem to contain a valid CLIP model.")
15891589

15901590
if is_accelerate_available():
1591-
load_state_dict_into_meta(model, diffusers_format_checkpoint, dtype=torch_dtype)
1591+
load_model_dict_into_meta(model, diffusers_format_checkpoint, dtype=torch_dtype)
15921592
else:
15931593
model.load_state_dict(diffusers_format_checkpoint, strict=False)
15941594

@@ -2047,7 +2047,7 @@ def create_diffusers_t5_model_from_checkpoint(
20472047
diffusers_format_checkpoint = convert_sd3_t5_checkpoint_to_diffusers(checkpoint)
20482048

20492049
if is_accelerate_available():
2050-
load_state_dict_into_meta(model, diffusers_format_checkpoint, dtype=torch_dtype)
2050+
load_model_dict_into_meta(model, diffusers_format_checkpoint, dtype=torch_dtype)
20512051
else:
20522052
model.load_state_dict(diffusers_format_checkpoint)
20532053

src/diffusers/loaders/transformer_flux.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ImageProjection,
1818
MultiIPAdapterImageProjection,
1919
)
20-
from ..models.modeling_utils import load_state_dict_into_meta
20+
from ..models.modeling_utils import load_model_dict_into_meta
2121
from ..utils import (
2222
is_accelerate_available,
2323
is_torch_version,
@@ -82,7 +82,7 @@ def _convert_ip_adapter_image_proj_to_diffusers(self, state_dict, low_cpu_mem_us
8282
if not low_cpu_mem_usage:
8383
image_projection.load_state_dict(updated_state_dict, strict=True)
8484
else:
85-
load_state_dict_into_meta(image_projection, updated_state_dict, device=self.device, dtype=self.dtype)
85+
load_model_dict_into_meta(image_projection, updated_state_dict, device=self.device, dtype=self.dtype)
8686

8787
return image_projection
8888

@@ -153,7 +153,7 @@ def _convert_ip_adapter_attn_to_diffusers(self, state_dicts, low_cpu_mem_usage=F
153153
else:
154154
device = self.device
155155
dtype = self.dtype
156-
load_state_dict_into_meta(attn_procs[name], value_dict, device=device, dtype=dtype)
156+
load_model_dict_into_meta(attn_procs[name], value_dict, device=device, dtype=dtype)
157157

158158
key_id += 1
159159

src/diffusers/loaders/transformer_sd3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from ..models.attention_processor import SD3IPAdapterJointAttnProcessor2_0
1717
from ..models.embeddings import IPAdapterTimeImageProjection
18-
from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT, load_state_dict_into_meta
18+
from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT, load_model_dict_into_meta
1919

2020

2121
class SD3Transformer2DLoadersMixin:
@@ -59,7 +59,7 @@ def _load_ip_adapter_weights(self, state_dict: Dict, low_cpu_mem_usage: bool = _
5959
if not low_cpu_mem_usage:
6060
attn_procs[name].load_state_dict(layer_state_dict[idx], strict=True)
6161
else:
62-
load_state_dict_into_meta(
62+
load_model_dict_into_meta(
6363
attn_procs[name], layer_state_dict[idx], device=self.device, dtype=self.dtype
6464
)
6565

@@ -86,4 +86,4 @@ def _load_ip_adapter_weights(self, state_dict: Dict, low_cpu_mem_usage: bool = _
8686
if not low_cpu_mem_usage:
8787
self.image_proj.load_state_dict(state_dict["image_proj"], strict=True)
8888
else:
89-
load_state_dict_into_meta(self.image_proj, state_dict["image_proj"], device=self.device, dtype=self.dtype)
89+
load_model_dict_into_meta(self.image_proj, state_dict["image_proj"], device=self.device, dtype=self.dtype)

src/diffusers/loaders/unet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
IPAdapterPlusImageProjection,
3131
MultiIPAdapterImageProjection,
3232
)
33-
from ..models.modeling_utils import load_state_dict, load_state_dict_into_meta
33+
from ..models.modeling_utils import load_state_dict, load_model_dict_into_meta
3434
from ..utils import (
3535
USE_PEFT_BACKEND,
3636
_get_model_file,
@@ -753,7 +753,7 @@ def _convert_ip_adapter_image_proj_to_diffusers(self, state_dict, low_cpu_mem_us
753753
if not low_cpu_mem_usage:
754754
image_projection.load_state_dict(updated_state_dict, strict=True)
755755
else:
756-
load_state_dict_into_meta(image_projection, updated_state_dict, device=self.device, dtype=self.dtype)
756+
load_model_dict_into_meta(image_projection, updated_state_dict, device=self.device, dtype=self.dtype)
757757

758758
return image_projection
759759

@@ -846,7 +846,7 @@ def _convert_ip_adapter_attn_to_diffusers(self, state_dicts, low_cpu_mem_usage=F
846846
else:
847847
device = next(iter(value_dict.values())).device
848848
dtype = next(iter(value_dict.values())).dtype
849-
load_state_dict_into_meta(attn_procs[name], value_dict, device=device, dtype=dtype)
849+
load_model_dict_into_meta(attn_procs[name], value_dict, device=device, dtype=dtype)
850850

851851
key_id += 2
852852

src/diffusers/models/model_loading_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def load_state_dict(
201201
)
202202

203203

204-
def load_state_dict_into_meta(
204+
def load_model_dict_into_meta(
205205
model,
206206
state_dict: OrderedDict,
207207
dtype: Optional[Union[str, torch.dtype]] = None,

0 commit comments

Comments
 (0)