DiffusionCLIP icon indicating copy to clipboard operation
DiffusionCLIP copied to clipboard

finetuning error

Open Kimtona opened this issue 1 year ago • 2 comments

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?

Kimtona avatar Jun 14 '24 08:06 Kimtona

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

Honeybadger-LSX avatar Jun 14 '24 08:06 Honeybadger-LSX

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.

Kimtona avatar Jun 14 '24 09:06 Kimtona