kohya-ss / kohya-ss/sd-scripts

KeyError: 'time_embed.0.weight while Training on SD3.

Open
#1,414 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

`Traceback (most recent call last):
File "F:\AI\sd-scripts-sd3\sd-scripts-sd3\train_network.py", line 1242, in
trainer.train(args)
File "F:\AI\sd-scripts-sd3\sd-scripts-sd3\train_network.py", line 234, in train
model_version, text_encoder, vae, unet = self.load_target_model(args, weight_dtype, accelerator)
File "F:\AI\sd-scripts-sd3\sd-scripts-sd3\train_network.py", line 101, in load_target_model
text_encoder, vae, unet, _ = train_util.load_target_model(args, weight_dtype, accelerator)
File "F:\AI\sd-scripts-sd3\sd-scripts-sd3\library\train_util.py", line 4655, in load_target_model
text_encoder, vae, unet, load_stable_diffusion_format = _load_target_model(
File "F:\AI\sd-scripts-sd3\sd-scripts-sd3\library\train_util.py", line 4610, in _load_target_model
text_encoder, vae, unet = model_util.load_models_from_stable_diffusion_checkpoint(
File "F:\AI\sd-scripts-sd3\sd-scripts-sd3\library\model_util.py", line 1005, in load_models_from_stable_diffusion_checkpoint
converted_unet_checkpoint = convert_ldm_unet_checkpoint(v2, state_dict, unet_config)
File "F:\AI\sd-scripts-sd3\sd-scripts-sd3\library\model_util.py", line 267, in convert_ldm_unet_checkpoint
new_checkpoint["time_embedding.linear_1.weight"] = unet_state_dict["time_embed.0.weight"]
KeyError: 'time_embed.0.weight'`

using sd3_medium_incl_clips.safetensors

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the traceback in library/model_util.py, especially convert_ldm_unet_checkpoint, and trace how train_util.py loads sd3_medium_incl_clips.safetensors through train_network.py. Reproduce the failure with the reported checkpoint and determine what successful SD3 model loading should look like, then verify the training entry point no longer raises this KeyError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.