Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error message of “Error: permute(sparse_coo): number of dimensions in the tensor input does not match the length of the desired ordering of dimensions i.e. input.dim() = 2 is not equal to len(dims) = 3” appears in the message field in the traintrain and Lora cannot be created in Forge. #18

Open
noha2310 opened this issue Jun 5, 2024 · 1 comment

Comments

@noha2310
Copy link

noha2310 commented Jun 5, 2024

The following is the text after the TRAINTRAIN run.


Start Training!
Loading weights [5353d90e0c] from /content/drive/MyDrive/sd/stable-diffusion-webui-forge/models/Stable-diffusion/anyloraCheckpoint_bakedvaeBlessedFp16.safetensors
model_type EPS
UNet ADM Dimension 0
Using xformers attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using xformers attention in VAE
extra {'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.logit_scale'}
left over keys: dict_keys(['alphas_cumprod', 'alphas_cumprod_prev', 'betas', 'log_one_minus_alphas_cumprod', 'posterior_log_variance_clipped', 'posterior_mean_coef1', 'posterior_mean_coef2', 'posterior_variance', 'sqrt_alphas_cumprod', 'sqrt_one_minus_alphas_cumprod', 'sqrt_recip_alphas_cumprod', 'sqrt_recipm1_alphas_cumprod'])
loaded straight to GPU
To load target model BaseModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 13313.25634765625
[Memory Management] Model Memory (MB) = 0.00762939453125
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 12289.248718261719
Moving model(s) has taken 0.02 seconds
To load target model SD1ClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 13313.24755859375
[Memory Management] Model Memory (MB) = 454.2076225280762
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 11835.039936065674
Moving model(s) has taken 0.11 seconds
Model loaded in 12.4s (unload existing model: 2.9s, load weights from disk: 0.4s, forge load real models: 8.8s, calculate empty prompt: 0.1s).
Preparing the Model...
Enabling Xformers
Preparing image latents and text-conditional...
max bucket sizes : [(512, 512)]
sub bucket sizes : []
Traceback (most recent call last):
File "/content/drive/MyDrive/sd/stable-diffusion-webui-forge/extensions/sd-webui-traintrain/trainer/train.py", line 195, in train_main
result = train_lora(t)
File "/content/drive/MyDrive/sd/stable-diffusion-webui-forge/extensions/sd-webui-traintrain/trainer/train.py", line 226, in train_lora
dataloaders = dataset.make_dataloaders(t)
File "/content/drive/MyDrive/sd/stable-diffusion-webui-forge/extensions/sd-webui-traintrain/trainer/dataset.py", line 15, in make_dataloaders
load_resize_image_and_text(t) #画像を読み込み、画像サイズごとに振り分け、リサイズ、テキストの読み込み
File "/content/drive/MyDrive/sd/stable-diffusion-webui-forge/extensions/sd-webui-traintrain/trainer/dataset.py", line 241, in load_resize_image_and_text
resized, alpha_mask = resize_and_crop(ar_error, image, *max, t.image_disable_upscale)
File "/content/drive/MyDrive/sd/stable-diffusion-webui-forge/extensions/sd-webui-traintrain/trainer/dataset.py", line 231, in resize_and_crop
tensor = torch.from_numpy(np.array(image)).permute(2, 0, 1).float() / 255.0
RuntimeError: permute(sparse_coo): number of dimensions in the tensor input does not match the length of the desired ordering of dimensions i.e. input.dim() = 2 is not equal to len(dims) = 3

Loading weights [9807d1172b] from /content/drive/MyDrive/sd/stable-diffusion-webui-forge/models/Stable-diffusion/anyloracleanlinearmix_v10.safetensors
model_type EPS
UNet ADM Dimension 0
Using xformers attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using xformers attention in VAE
extra {'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.logit_scale'}
left over keys: dict_keys(['model_ema.decay', 'model_ema.num_updates'])
loaded straight to GPU
To load target model BaseModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 13294.35791015625
[Memory Management] Model Memory (MB) = 0.00762939453125
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 12270.350280761719
Moving model(s) has taken 0.02 seconds
To load target model SD1ClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) = 13294.34912109375
[Memory Management] Model Memory (MB) = 454.2076225280762
[Memory Management] Minimal Inference Memory (MB) = 1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) = 11816.141498565674
Moving model(s) has taken 0.10 seconds
Model loaded in 21.2s (load weights from disk: 1.2s, forge load real models: 19.6s, calculate empty prompt: 0.2s).


That's all.
Reinstalling traintrain did not solve the problem and searching did not find a solution.

How can I solve this problem?

@noha2310 noha2310 changed the title Error: permute(sparse_coo): number of dimensions in the tensor input does not match the length of the desired ordering of dimensions i.e. input.dim() = 2 is not equal to len(dims) = 3 An error message of “Error: permute(sparse_coo): number of dimensions in the tensor input does not match the length of the desired ordering of dimensions i.e. input.dim() = 2 is not equal to len(dims) = 3” appears in the message field in the traintrain and Lora cannot be created in Forge. Jun 5, 2024
@jurgens1206
Copy link

Hello.

I was also having trouble because the same error occurred, but when I reviewed the image data I was trying to learn, I realized that grayscale was mixed in, and I converted it to RGB, and it worked properly.

I will post the address of the blog referenced below.

Well then.

https://yukr.hatenablog.com/entry/2020/05/03/170502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants