bcmi / DCI-VTON-Virtual-Try-On

[ACM Multimedia 2023] Taming the Power of Diffusion Models for High-Quality Virtual Try-On with Appearance Flow.
https://arxiv.org/abs/2308.06101
MIT License
387 stars 56 forks source link

RuntimeError: The size of tensor a (6) must match the size of tensor b (8) at non-singleton dimension 0 #8

Closed kadirnar closed 1 year ago

kadirnar commented 1 year ago

Hi,

Thank you very much for the project. I like the project very much but I am getting an error while running it. Can you help me? I followed the steps in the readme file. But I am getting this error.

Run Code:

python test.py --plms --gpu_id 0 --ddim_steps 100 --outdir results/viton --config configs/viton512.yaml --dataroot VITON-HD --ckpt viton512.ckpt --n_samples 8 --seed 23 --scale 1 --H 512 --W 512 --unpaired

Error Message:

  File "...\DCI-VTON-Virtual-Try-On\ldm\modules\diffusionmodules\openaimodel.py", line 273, in _forward
    h = h + emb_out
RuntimeError: The size of tensor a (6) must match the size of tensor b (8) at non-singleton dimension 0
Limbor commented 1 year ago

This is because your dataload failed to obtain sufficient batch data (only 6 data were read), but the batch size was set to 8. This leads to a mismatch between the size of the time embedding and the input data in subsequent samplers. You can modify the batchsize so that the sufficient data can be obtained each time, or modify batch_size=opt.n_samples in the following code to the actual batchsize:

samples_ddim, _ = sampler.sample(S=opt.ddim_steps,
                                 conditioning=c,
                                 batch_size=opt.n_samples,
                                 shape=shape,
                                 verbose=False,
                                 unconditional_guidance_scale=opt.scale,
                                 unconditional_conditioning=uc,
                                 eta=opt.ddim_eta,
                                 x_T=start_code,
                                 test_model_kwargs=test_model_kwargs)
kadirnar commented 1 year ago

Thank you. Is there code to test on custom dataset? I'm trying this for the preprocces part, but it's hard. Is there a simpler way to do this?

https://github.com/sangyun884/HR-VITON/issues/45

Limbor commented 1 year ago

This tutorial looks very detailed, there should be no simple way for preprocessing, at most some adjustments can be made in the selection of preprocessing model.