gwang-kim / DiffusionCLIP

[CVPR 2022] Official PyTorch Implementation for DiffusionCLIP: Text-guided Image Manipulation Using Diffusion Models
Other
794 stars 117 forks source link

finetuning error #38

Open Kimtona opened 3 months ago

Kimtona commented 3 months ago

Hello, I am trying to fine-tune a pre-trained model on the AFHQ dataset for the dog_bear task using Colab. I have successfully saved the pre-trained model and set up the dataset.

data

└── afhq

├── LMDB_test

│   ├── data.mdb

│   └── lock.mdb

├── LMDB_train

│   ├── data.mdb

│   └── lock.mdb

└── LMDB_val

├── data.mdb

└── lock.mdb

└── raw_images

├── test

   ├── images

└── test

   ├── images

└── val

   ├── images

However, a value error occurs when I try to run the following cell. !python main.py --clip_finetune_eff \ --config afhq.yml \ --exp ./runs/test \ --edit_attr dog_bear \ --do_train 1 \ --do_test 1 \ --n_train_img 50 \ --n_test_img 10 \ --n_iter 5 \ --t_0 500 \ --n_inv_step 40 \ --n_train_step 6 \ --n_test_step 40 \ --lr_clip_finetune 8e-6 \ --id_loss_w 0 \ --l1_loss_w 1 INFO - main.py - 2024-06-13 17:40:33,558 - Using device: cuda

INFO - main.py - 2024-06-13 17:40:33,559 - Exp instance id = 39862 INFO - main.py - 2024-06-13 17:40:33,559 - Exp comment = INFO - main.py - 2024-06-13 17:40:33,559 - Config = <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ./runs/test_FT_dog_dog_bear_t500_ninv40_ngen6_id0.0_l11.0_lr8e-06 ['Dog'] -> ['Bear'] Improved diffusion Model loaded. Setting optimizer with lr=8e-06 Loading losses Prepare identity latent precomputed/dog_train_t500_nim100_ninv40_pairs.pth ERROR - main.py - 2024-06-13 17:40:44,029 - Traceback (most recent call last): File "/content/DiffusionCLIP/main.py", line 213, in main runner.clip_finetune_eff() File "/content/DiffusionCLIP/diffusionclip.py", line 423, in clip_finetune_eff loader_dic = get_dataloader(train_dataset, test_dataset, bs_train=self.args.bs_train, File "/content/DiffusionCLIP/datasets/data_utils.py", line 23, in get_dataloader train_loader = DataLoader( File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 350, in init sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type] File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/sampler.py", line 143, in init raise ValueError(f"num_samples should be a positive integer value, but got num_samples={self.num_samples}") ValueError: num_samples should be a positive integer value, but got num_samples=0

Could you help me?

Honeybadger-LSX commented 3 months ago

  邮件已收到,会尽快回复,祝安!

Kimtona commented 3 months ago

DiffusionCLIP.zip This file is my attempt to directly fine-tune your excellent work in a Colab environment. However, I'm facing a ValueError and having difficulty. As a second-year university student, I still have a lot to learn. Could you help me resolve the error so I can proceed? Thank you.