kpandey008 / DiffuseVAE

Official implementation of "DiffuseVAE: Efficient, Controllable and High-Fidelity Generation from Low-Dimensional Latents"
MIT License
344 stars 32 forks source link

CelebHQ sampling #15

Open nikki0205 opened 1 year ago

nikki0205 commented 1 year ago

Hi,

I would like to make some samples based on CelebHQ dataset when inferencing. When runing the scripts provided, I got errors saying that the model size mismatched

May I know how to use the CelebHQ checkpoints,how to set parameters in the script?

Thanks a lot.

kpandey008 commented 1 year ago

Hi, it would be great if you can post some error logs for the same. I will try to run the scripts on my end but this might not be immediately feasible due to limited bandwidth.

nikki0205 commented 1 year ago

Hi, I noticed there is no command for celebahq in the script named test_ddpm.sh. So I changed the dataset of one of the comands into celebahq like:  python main/eval/ddpm/sample.py +dataset=celebahq/test \ ...

dataset.ddpm.evaluation.chkpt_path=\'/CIS44/DiffuseVAE-main/checkpoints/diffvae_chq256_form1_loss=0.0361.ckpt\' \

But it seems that none of the commands suits for the celebahq. The error logs are as below: main/eval/ddpm/sample.py:26: UserWarning: The version_base parameter is not specified. Please specify a compatability version level, or None. Will assume defaults for version 1.1   @hydra.main(config_path=os.path.join(p, "configs")) /root/.local/share/virtualenvs/DiffuseVAE-main-m2EH8SNx/lib/python3.7/site-packages/hydra/_internal/hydra.py:127: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default. See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information.   configure_logging=with_log_configuration, Global seed set to 0 Error executing job with overrides: ['+dataset=celebahq/test', 'dataset.ddpm.data.norm=True', "dataset.ddpm.model.attn_resolutions='16,'", 'dataset.ddpm.model.dropout=0.0', 'dataset.ddpm.model.n_residual=2', "dataset.ddpm.model.dim_mults='1,2,2,4,4'", 'dataset.ddpm.model.n_heads=1', 'dataset.ddpm.evaluation.guidance_weight=0.0', 'dataset.ddpm.evaluation.seed=0', 'dataset.ddpm.evaluation.sample_prefix=gpu_0', "dataset.ddpm.evaluation.device='gpu:0'", 'dataset.ddpm.evaluation.save_mode=image', "dataset.ddpm.evaluation.chkpt_path='/CIS44/DiffuseVAE-main/checkpoints/diffvae_chq256_form1_loss=0.0361.ckpt'", 'dataset.ddpm.evaluation.type=uncond', 'dataset.ddpm.evaluation.resample_strategy=spaced', 'dataset.ddpm.evaluation.skip_strategy=quad', 'dataset.ddpm.evaluation.sample_method=ddim', 'dataset.ddpm.evaluation.sample_from=target', 'dataset.ddpm.evaluation.batch_size=16', "dataset.ddpm.evaluation.save_path='/CIS44/DiffuseVAE-main/data/celebahq'", 'dataset.ddpm.evaluation.n_samples=500', 'dataset.ddpm.evaluation.n_steps=25', 'dataset.ddpm.evaluation.workers=1'] Traceback (most recent call last):   File "main/eval/ddpm/sample.py", line 87, in sample     strict=False,   File "/root/.local/share/virtualenvs/DiffuseVAE-main-m2EH8SNx/lib/python3.7/site-packages/pytorch_lightning/core/saving.py", line 153, in load_from_checkpoint     model = cls._load_model_state(checkpoint, strict=strict, **kwargs)   File "/root/.local/share/virtualenvs/DiffuseVAE-main-m2EH8SNx/lib/python3.7/site-packages/pytorch_lightning/core/saving.py", line 201, in _load_model_state     keys = model.load_state_dict(checkpoint["state_dict"], strict=strict)   File "/root/.local/share/virtualenvs/DiffuseVAE-main-m2EH8SNx/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1498, in load_state_dict     self.class.name, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for DDPMWrapper:         size mismatch for online_network.decoder.input_blocks.0.0.weight: copying a param with shape torch.Size([128, 6, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 3, 3, 3]).         size mismatch for online_network.decoder.input_blocks.4.0.in_layers.2.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 128, 3, 3]).         size mismatch for online_network.decoder.input_blocks.4.0.in_layers.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.4.0.emb_layers.1.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([256, 512]).         size mismatch for online_network.decoder.input_blocks.4.0.emb_layers.1.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.4.0.out_layers.0.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.4.0.out_layers.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.4.0.out_layers.3.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for online_network.decoder.input_blocks.4.0.out_layers.3.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.5.0.in_layers.0.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.5.0.in_layers.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.5.0.in_layers.2.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for online_network.decoder.input_blocks.5.0.in_layers.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.5.0.emb_layers.1.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([256, 512]).         size mismatch for online_network.decoder.input_blocks.5.0.emb_layers.1.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.5.0.out_layers.0.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.5.0.out_layers.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.5.0.out_layers.3.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for online_network.decoder.input_blocks.5.0.out_layers.3.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.6.0.op.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for online_network.decoder.input_blocks.6.0.op.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.7.0.in_layers.0.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.7.0.in_layers.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for online_network.decoder.input_blocks.7.0.in_layers.2.weight: copying a param with shape torch.Size([256, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for online_network.decoder.input_blocks.10.0.in_layers.2.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 256, 3, 3]).         size mismatch for online_network.decoder.input_blocks.10.0.in_layers.2.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.10.0.emb_layers.1.weight: copying a param with shape torch.Size([256, 512]) from checkpoint, the shape in current model is torch.Size([512, 512]).         size mismatch for online_network.decoder.input_blocks.10.0.emb_layers.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.10.0.out_layers.0.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.10.0.out_layers.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.10.0.out_layers.3.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for online_network.decoder.input_blocks.10.0.out_layers.3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.11.0.in_layers.0.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.11.0.in_layers.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.11.0.in_layers.2.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for online_network.decoder.input_blocks.11.0.in_layers.2.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.11.0.emb_layers.1.weight: copying a param with shape torch.Size([256, 512]) from checkpoint, the shape in current model is torch.Size([512, 512]).         size mismatch for online_network.decoder.input_blocks.11.0.emb_layers.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.11.0.out_layers.0.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.11.0.out_layers.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.11.0.out_layers.3.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for online_network.decoder.input_blocks.11.0.out_layers.3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.12.0.op.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for online_network.decoder.input_blocks.12.0.op.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.13.0.in_layers.0.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.13.0.in_layers.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for online_network.decoder.input_blocks.13.0.in_layers.2.weight: copying a param with shape torch.Size([512, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for target_network.decoder.input_blocks.0.0.weight: copying a param with shape torch.Size([128, 6, 3, 3]) from checkpoint, the shape in current model is torch.Size([128, 3, 3, 3]).         size mismatch for target_network.decoder.input_blocks.4.0.in_layers.2.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 128, 3, 3]).         size mismatch for target_network.decoder.input_blocks.4.0.in_layers.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.4.0.emb_layers.1.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([256, 512]).         size mismatch for target_network.decoder.input_blocks.4.0.emb_layers.1.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.4.0.out_layers.0.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.4.0.out_layers.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.4.0.out_layers.3.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for target_network.decoder.input_blocks.4.0.out_layers.3.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.5.0.in_layers.0.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.5.0.in_layers.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.5.0.in_layers.2.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for target_network.decoder.input_blocks.5.0.in_layers.2.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.5.0.emb_layers.1.weight: copying a param with shape torch.Size([128, 512]) from checkpoint, the shape in current model is torch.Size([256, 512]).         size mismatch for target_network.decoder.input_blocks.5.0.emb_layers.1.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.5.0.out_layers.0.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.5.0.out_layers.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.5.0.out_layers.3.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for target_network.decoder.input_blocks.5.0.out_layers.3.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.6.0.op.weight: copying a param with shape torch.Size([128, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for target_network.decoder.input_blocks.6.0.op.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.7.0.in_layers.0.weight: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.7.0.in_layers.0.bias: copying a param with shape torch.Size([128]) from checkpoint, the shape in current model is torch.Size([256]).         size mismatch for target_network.decoder.input_blocks.7.0.in_layers.2.weight: copying a param with shape torch.Size([256, 128, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 256, 3, 3]).         size mismatch for target_network.decoder.input_blocks.10.0.in_layers.2.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 256, 3, 3]).         size mismatch for target_network.decoder.input_blocks.10.0.in_layers.2.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.10.0.emb_layers.1.weight: copying a param with shape torch.Size([256, 512]) from checkpoint, the shape in current model is torch.Size([512, 512]).         size mismatch for target_network.decoder.input_blocks.10.0.emb_layers.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.10.0.out_layers.0.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.10.0.out_layers.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.10.0.out_layers.3.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for target_network.decoder.input_blocks.10.0.out_layers.3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.11.0.in_layers.0.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.11.0.in_layers.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.11.0.in_layers.2.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for target_network.decoder.input_blocks.11.0.in_layers.2.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.11.0.emb_layers.1.weight: copying a param with shape torch.Size([256, 512]) from checkpoint, the shape in current model is torch.Size([512, 512]).         size mismatch for target_network.decoder.input_blocks.11.0.emb_layers.1.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.11.0.out_layers.0.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.11.0.out_layers.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.11.0.out_layers.3.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for target_network.decoder.input_blocks.11.0.out_layers.3.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.12.0.op.weight: copying a param with shape torch.Size([256, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).         size mismatch for target_network.decoder.input_blocks.12.0.op.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.13.0.in_layers.0.weight: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.13.0.in_layers.0.bias: copying a param with shape torch.Size([256]) from checkpoint, the shape in current model is torch.Size([512]).         size mismatch for target_network.decoder.input_blocks.13.0.in_layers.2.weight: copying a param with shape torch.Size([512, 256, 3, 3]) from checkpoint, the shape in current model is torch.Size([512, 512, 3, 3]).

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

I just change the name of the dataset and the path of the checkpoint, maybe I need to change other configurations. But I don't know what I should change. I'm looking forward to your help. Thank you very much. Best wishes.

郭博菲 @.***

Original Email

Sender:"Kushagra Pandey"< @.*** >;

Sent Time:2023/4/20 22:46

To:"kpandey008/DiffuseVAE"< @.*** >;

Cc recipient:"nikki0205"< @. >;"Author"< @. >;

Subject:Re: [kpandey008/DiffuseVAE] CelebHQ sampling (Issue #15)

Hi, it would be great if you can post some error logs for the same. I will try to run the scripts on my end but this might not be immediately feasible due to limited bandwidth.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>