Closed blueclowd closed 1 month ago
The first thing that comes to mind is that this seems related to the environment. Could you restart the notebook kernel and try again? Could you be sure that the env notebook used at that time has diffusers
? Also, could you provide some more information before running this cell? How did you train exactly?
Hi @tolgacangoz Thanks for replying.
!git clone https://github.com/huggingface/diffusers
!cd /kaggle/working/diffusers
!pip install /kaggle/working/diffusers/.
!cd /kaggle/working/diffusers/examples/text_to_image
!pip install -r /kaggle/working/diffusers/examples/text_to_image/requirements.txt
!pip install --upgrade peft transformers torch xformers bitsandbytes
!accelerate config default
!mkdir /kaggle/working/figurine
!accelerate launch --mixed_precision="fp16" /kaggle/working/diffusers/examples/dreambooth/train_dreambooth_lora.py \
--mixed_precision="fp16" \
--pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5" \
--instance_data_dir="/kaggle/input/aabc-train" \
--instance_prompt="a photo of aabc figurine" \
--class_data_dir="/kaggle/working/figurine" \
--class_prompt="a photo of figurine" \
--with_prior_preservation \
--prior_loss_weight=1.0 \
--use_8bit_adam \
--lr_scheduler="constant" \
--gradient_checkpointing \
--enable_xformers_memory_efficient_attention \
--num_train_epochs=50 \
--output_dir="/kaggle/working/dreambooth-lora"
Thanks
I have just run this code in a Kaggle notebook, and it worked seamlessly:
!git clone https://github.com/huggingface/diffusers
!cd /kaggle/working/diffusers
!pip install /kaggle/working/diffusers/. -q
!cd /kaggle/working/diffusers/examples/text_to_image
!pip install -r /kaggle/working/diffusers/examples/text_to_image/requirements.txt -q
!pip install --upgrade peft transformers torch xformers bitsandbytes -q
from diffusers import AutoPipelineForText2Image
import torch
pipeline = AutoPipelineForText2Image.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
Additional info: To change the directory use %cd diffusers
instead of !cd diffusers
.
Hi @tolgacangoz Thanks for helping. I tried to copy your script and run. It doesn't work on my notework for the first time, but after restarting the session for a few times, all of sudden it works. Probably restarting the session is a common practice for now?
Just wanna share my findings. On Kaggle Notebook, restarting the session works for me by choosing No Persistence
for the session.
It seems like there is some system file that may break the library link, start a 100% clean session resolve the issue.
can we close the issue now? :)
Describe the bug
It seems like an old issue that was mentioned a few times before. I encountered it at version 0.29.2. I am able to finished the training and get the weights, so probably environment setting is fine. The import error is shown on inference stage from the below script.
Reproduction
Logs
System Info
Diffusers : v0.29.2
Who can help?
No response