spockren commited on
Commit
c2005ce
1 Parent(s): a1be33e

Update README.md

Browse files

improve model card

Files changed (1) hide show
  1. README.md +33 -2
README.md CHANGED
@@ -36,7 +36,13 @@ Special VAE used for training: None.
36
  #### How to use
37
 
38
  ```python
39
- # TODO: add an example code snippet for running this diffusion pipeline
 
 
 
 
 
 
40
  ```
41
 
42
  #### Limitations and bias
@@ -45,4 +51,29 @@ Special VAE used for training: None.
45
 
46
  ## Training details
47
 
48
- [TODO: describe the data used to train the model]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  #### How to use
37
 
38
  ```python
39
+ from diffusers import AutoPipelineForText2Image
40
+ import torch
41
+
42
+ pipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16).to("cuda")
43
+ pipeline.load_lora_weights("spockren/naruto_lora_xl", weight_name="pytorch_lora_weights.safetensors")
44
+ image = pipeline("A naruto with blue eyes").images[0]
45
+ image
46
  ```
47
 
48
  #### Limitations and bias
 
51
 
52
  ## Training details
53
 
54
+ export MODEL_NAME="stabilityai/stable-diffusion-xl-base-1.0"
55
+ export OUTPUT_DIR="./xl_lora/naruto"
56
+ export HUB_MODEL_ID="naruto-lora-xl"
57
+ export DATASET_NAME="lambdalabs/naruto-blip-captions"
58
+
59
+ accelerate launch --mixed_precision="fp16" train_text_to_image_lora_sdxl.py \
60
+ --pretrained_model_name_or_path=$MODEL_NAME \
61
+ --dataset_name=$DATASET_NAME \
62
+ --dataloader_num_workers=8 \
63
+ --resolution=512 \
64
+ --center_crop \
65
+ --random_flip \
66
+ --train_batch_size=1 \
67
+ --gradient_accumulation_steps=4 \
68
+ --max_train_steps=15000 \
69
+ --learning_rate=1e-04 \
70
+ --max_grad_norm=1 \
71
+ --lr_scheduler="cosine" \
72
+ --lr_warmup_steps=0 \
73
+ --output_dir=${OUTPUT_DIR} \
74
+ --push_to_hub \
75
+ --hub_model_id=${HUB_MODEL_ID} \
76
+ --checkpointing_steps=500 \
77
+ --validation_prompt="A naruto with blue eyes." \
78
+ --checkpoints_total_limit=6 \
79
+ --seed=1337