Open andreae293 opened 1 year ago
@andreae293 can you please provide more details? I tried:
export CUDA_VISIBLE_DEVICES=-1
MODEL_FLAGS="--actual_image_size 512 --lr_warmup_steps 10000 --ema_rate 0.9999 --attention_resolutions 64,32,16 --class_cond False --diffusion_steps 1000 --image_size 64 --learn_sigma False --noise_schedule linear --num_channels 320 --num_heads 8 --num_res_blocks 2 --resblock_updown False --use_fp16 False --use_scale_shift_norm False "
TRAIN_FLAGS="--lr 5e-5 --batch_size 32 --log_interval 10 --save_interval 5000 --kl_model kl.pt --resume_checkpoint diffusion.pt"
export OPENAI_LOGDIR=./logs/
python scripts/image_train_stable.py --data_dir /path/to/image-and-text-files $MODEL_FLAGS $TRAIN_FLAGS
where I change the default from README from --use_fp16 True
to --use_fp16 False
(and IIUC no need to remove .half() from the image_train_stable.py with this flag), but it gives:
RuntimeError: CUDA out of memory. Tried to allocate 4.00 GiB (GPU 0; 15.78 GiB total capacity; 10.52 GiB already allocated; 3.86 GiB free; 10.77 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
ie, still seems to use gpu instead of cpu
Stable Diffusion requires CUDA to run the AI, as it is the language for communicating with the GPU and preforming the necessary calculations. Using with the CPU would require a complete rewrite or virtualization which requires more RAM and money than it would take to go and buy a supported CUDA GPU. Although if anyone who is reading this is willing, would it be possible to utilize a TPU from Kaggle or Google Collab instead? I feel like it might be more efficient than a GPU or CPU, as it is meant for processing Tensors directly.
@timotheecour4 sorry for the late response if you dont have enough RAM you have to dedicate a lot of GB to the virtual memory (paging file or swap memory) i dont know the minimum required by this repo,but i did dedicate 100 GB of virtual memory also if you are trying to finetune i suggest you to look for dreambooth for stable diffusion
@TheRealUnBot stable diffusion does not necessarily requires CUDA-supporting hardware to run since its based on pytorch you can run just fine in CPU with the downside of being x50 slower
Hi, has anyone ever tried to train with cpu? i know it will be super slow but im tried for the fun of it
i currently disabled my gpu by setting this line in image_train_stable.py torch.cuda.is_available = lambda : False
sorry for bothering with useless question but am i doing something wrong? thanks
edit: nevermind i removed both .half() from the image_train_stable.py and deleted --use_fp16 from the training arguments
this way i was able to train on cpu