OOTDiffusion icon indicating copy to clipboard operation
OOTDiffusion copied to clipboard

ValueError: Cannot load ../checkpoints/ootd/ootd_hd/checkpoint-36000

Open SilentTE opened this issue 1 year ago • 5 comments

File "/root/OOTDiffusion/run/run_ootd.py", line 47, in model = OOTDiffusionHD(args.gpu_id) File "/root/OOTDiffusion/ootd/inference_ootd_hd.py", line 57, in init unet_vton = UNetVton2DConditionModel.from_pretrained( File "/root/anaconda3/envs/ootd/lib/python3.10/site-packages/diffusers/models/modeling_utils.py", line 812, in from_pretrained unexpected_keys = load_model_dict_into_meta( File "/root/anaconda3/envs/ootd/lib/python3.10/site-packages/diffusers/models/modeling_utils.py", line 155, in load_model_dict_into_meta raise ValueError( ValueError: Cannot load ../checkpoints/ootd/ootd_hd/checkpoint-36000 because conv_in.weight expected shape tensor(..., device='meta', size=(320, 8, 3, 3)), but got torch.Size([320, 4, 3, 3]). If you want to instead overwrite randomly initialized weights, please make sure to pass both low_cpu_mem_usage=False and ignore_mismatched_sizes=True.

SilentTE avatar Feb 23 '24 02:02 SilentTE

how to solve it?

SilentTE avatar Feb 23 '24 02:02 SilentTE

: 16, 'num_hidden_layers': 24, 'patch_size': 14, 'projection_dim': 768}} were passed to AutoencoderKL, but are not expected and will be ignored. Please verify your config.json configuration file. Traceback (most recent call last): File "/home/app/workspace/OOTDiffusion/run/graido_ootd.py", line 28, in ootd_model_hd = OOTDiffusionHD(0) File "/home/app/workspace/OOTDiffusion/ootd/inference_ootd_hd.py", line 45, in init vae = AutoencoderKL.from_pretrained( File "/home/app/miniconda3/envs/ootd/lib/python3.10/site-packages/diffusers/models/modeling_utils.py", line 812, in from_pretrained unexpected_keys = load_model_dict_into_meta( File "/home/app/miniconda3/envs/ootd/lib/python3.10/site-packages/diffusers/models/modeling_utils.py", line 155, in load_model_dict_into_meta raise ValueError( ValueError: Cannot load ../checkpoints/ootd because encoder.conv_in.weight expected shape tensor(..., device='meta', size=(64, 3, 3, 3)), but got torch.Size([128, 3, 3, 3]). If you want to instead overwrite randomly initialized weights, please make sure to pass both low_cpu_mem_usage=False and ignore_mismatched_sizes=True. For more information, see also: https://github.com/huggingface/diffusers/issues/1619#issuecomment-1345604389 as an example.

CFengFeng avatar Feb 23 '24 03:02 CFengFeng

same problem

CFengFeng avatar Feb 23 '24 03:02 CFengFeng

+1, please add the weights to the Hugging Face repo

julian-useraspberry avatar Feb 23 '24 22:02 julian-useraspberry

I encounterd the same problem as you.

chfeng-cs avatar Feb 24 '24 08:02 chfeng-cs

https://github.com/levihsu/OOTDiffusion/issues/82#issuecomment-1975955294

levihsu avatar Mar 06 '24 09:03 levihsu

@CFengFeng I am facing the same problem as you

ValueError: Cannot load ../checkpoints/ootd because encoder.conv_in.weight expected shape tensor(..., device='meta', size=(64, 3, 3, 3)), but got torch.Size([128, 3, 3, 3]). If you want to instead overwrite randomly initialized weights, please make sure to pass both low_cpu_mem_usage=False and ignore_mismatched_sizes=True. For more information, see also: https://github.com/huggingface/diffusers/issues/1619#issuecomment-1345604389 as an example.

when trying to run run_ootd with either of dc or hd models

I got the weights from https://huggingface.co/levihsu/OOTDiffusion/tree/main/checkpoints/ootd

ShashwatNigam99 avatar Mar 06 '24 21:03 ShashwatNigam99