Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finetuning error #38

Open
Kimtona opened this issue Jun 14, 2024 · 2 comments
Open

finetuning error #38

Kimtona opened this issue Jun 14, 2024 · 2 comments

Comments

@Kimtona
Copy link

Kimtona commented Jun 14, 2024

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
Copy link

Honeybadger-LSX commented Jun 14, 2024 via email

@Kimtona
Copy link
Author

Kimtona commented Jun 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants