GaParmar / img2img-turbo

One-step image-to-image with Stable Diffusion turbo: sketch2image, day2night, and more
MIT License
1.5k stars 169 forks source link

ModuleNotFoundError: No module named 'wandb' #90

Open enfff opened 6 days ago

enfff commented 6 days ago

Hello, I'm trying to training a CycleGAN-Turbo model on unpaired data by following the provided instructions.

The command

export NCCL_P2P_DISABLE=1
accelerate launch --main_process_port 29501 src/train_cyclegan_turbo.py \
    --pretrained_model_name_or_path="stabilityai/sd-turbo" \
    --output_dir="output/cyclegan_turbo/my_horse2zebra" \
    --dataset_folder "data/my_horse2zebra" \
    --train_img_prep "resize_286_randomcrop_256x256_hflip" --val_img_prep "no_resize" \
    --learning_rate="1e-5" --max_train_steps=25000 \
    --train_batch_size=1 --gradient_accumulation_steps=1 \
    --report_to "wandb" --tracker_project_name "gparmar_unpaired_h2z_cycle_debug_v2" \
    --enable_xformers_memory_efficient_attention --validation_steps 250 \
    --lambda_gan 0.5 --lambda_idt 1 --lambda_cycle 1

results in:

Traceback (most recent call last):
  File "/mnt/c/Users/pcuser/Documents/concept/img2img-turbo/src/train_cyclegan_turbo.py", line 6, in <module>
    import wandb
ModuleNotFoundError: No module named 'wandb'
Traceback (most recent call last):
  File "/home/pcuser/.local/bin/accelerate", line 8, in <module>
    sys.exit(main())
  File "/home/pcuser/.local/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main
    args.func(args)
  File "/home/pcuser/.local/lib/python3.10/site-packages/accelerate/commands/launch.py", line 1174, in launch_command
    simple_launcher(args)
  File "/home/pcuser/.local/lib/python3.10/site-packages/accelerate/commands/launch.py", line 769, in simple_launcher
    raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'src/train_cyclegan_turbo.py', '--pretrained_model_name_or_path=stabilityai/sd-turbo', '--output_dir=output/cyclegan_turbo/my_horse2zebra', '--dataset_folder', 'data/my_horse2zebra', '--train_img_prep', 'resize_286_randomcrop_256x256_hflip', '--val_img_prep', 'no_resize', '--learning_rate=1e-5', '--max_train_steps=25000', '--train_batch_size=1', '--gradient_accumulation_steps=1', '--report_to', 'wandb', '--tracker_project_name', 'gparmar_unpaired_h2z_cycle_debug_v2', '--enable_xformers_memory_efficient_attention', '--validation_steps', '250', '--lambda_gan', '0.5', '--lambda_idt', '1', '--lambda_cycle', '1']' returned non-zero exit status 1.

This is the output of conda list:

# packages in environment at /home/pcuser/anaconda3/envs/img2img-turbo:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main
_openmp_mutex             5.1                       1_gnu
blinker                   1.8.2                    pypi_0    pypi
bzip2                     1.0.8                h5eee18b_6
ca-certificates           2024.7.2             h06a4308_0
importlib-metadata        8.5.0                    pypi_0    pypi
ld_impl_linux-64          2.38                 h1181459_1
libffi                    3.4.4                h6a678d5_1
libgcc-ng                 11.2.0               h1234567_1
libgomp                   11.2.0               h1234567_1
libstdcxx-ng              11.2.0               h1234567_1
libuuid                   1.41.5               h5eee18b_0
ncurses                   6.4                  h6a678d5_0
openssl                   3.0.15               h5eee18b_0
pip                       24.2            py310h06a4308_0
pyparsing                 3.1.4                    pypi_0    pypi
python                    3.10.14              h955ad1f_1
pyyaml                    6.0.2                    pypi_0    pypi
readline                  8.2                  h5eee18b_0
setuptools                75.1.0          py310h06a4308_0
six                       1.16.0                   pypi_0    pypi
sqlite                    3.45.3               h5eee18b_0
tk                        8.6.14               h39e8969_0
tzdata                    2024a                h04d1e81_0
wheel                     0.44.0          py310h06a4308_0
xz                        5.4.6                h5eee18b_1
zipp                      3.20.2                   pypi_0    pypi
zlib                      1.2.13               h5eee18b_1

Which does not include wandb. I installed it with conda install conda-forge::wandb as mentioned here.

conda list | grep wandb
wandb                     0.16.6             pyhd8ed1ab_1    conda-forge

but it still didn't fix the issue, and I ended up with the same error as before.

This is the content of my default_config.yaml

compute_environment: LOCAL_MACHINE
debug: false
distributed_type: 'NO'
downcast_bf16: 'no'
enable_cpu_affinity: false
gpu_ids: all
machine_rank: 0
main_training_function: main
mixed_precision: 'no'
num_machines: 1
num_processes: 1
rdzv_backend: static
same_network: true
tpu_env: []
tpu_use_cluster: false
tpu_use_sudo: false
use_cpu: false

I read other users mentioning it might be related to the package vision_aided_loss, but so far I haven't found a way to install it with conda, even though I have it installed with pip.

pip list | grep vision-aided-loss
vision-aided-loss         0.1.0

I'm using the provided conda virtual environment, and I'm on WSL with Ubuntu 22.04. Hope you can help me.

GaParmar commented 6 days ago

Could you try installing wandb with pip?

enfff commented 6 days ago

Yes I tried that, and it still doesn't work.

pip list | grep wandb
wandb                     0.16.6

Can you please tell me which version you're using?

YijiFeng commented 5 days ago

I met this problem too,but I just use "pip install wandb", the problem was solved successfully.

GaParmar commented 4 days ago

Hi @enfff I am using the same wandb version as you are, i don't think the issue is the version. Looking at your error log, it looks like your python is unable to find the wandb package. could you try a simple import command to test if you can import wandb?

import wandb

-Gaurav