--- base_model: runwayml/stable-diffusion-v1-5 library_name: diffusers license: creativeml-openrail-m inference: true tags: - stable-diffusion - stable-diffusion-diffusers - text-to-image - diffusers - diffusers-training - lora --- # LoRA text2image fine-tuning - Miracle-2001/pokemon-lora These are LoRA adaption weights for runwayml/stable-diffusion-v1-5. The weights were fine-tuned on the svjack/pokemon-blip-captions-en-zh dataset. You can find some example images in the following. ![img_0](./image_0.png) ![img_1](./image_1.png) ![img_2](./image_2.png) ![img_3](./image_3.png) ## Intended uses & limitations #### How to use ```python import torch from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler from huggingface_hub import model_info # LoRA weights ~3 MB model_path = "Miracle-2001/pokemon-lora" info = model_info(model_path) model_base = info.cardData["base_model"] pipe = StableDiffusionPipeline.from_pretrained(model_base, torch_dtype=torch.float16) pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) pipe.unet.load_attn_procs(model_path) pipe.to("cuda") image = pipe("Green pokemon with menacing face", num_inference_steps=25).images[0] image.save("green_pokemon.png") ``` #### Limitations and bias [TODO: provide examples of latent issues and potential remediations] ## Training details ```bash cd diffusers/examples/text_to_image export MODEL_NAME="runwayml/stable-diffusion-v1-5" export OUTPUT_DIR="/flash2/aml/kyzhang24/HW3/hw3-base/" export HUB_MODEL_ID="pokemon-lora" export DATASET_NAME="svjack/pokemon-blip-captions-en-zh" HF_ENDPOINT=https://hf-mirror.com python train_text_to_image_lora.py \ --pretrained_model_name_or_path=$MODEL_NAME \ --dataset_name=$DATASET_NAME \ --dataloader_num_workers=8 \ --resolution=512 --center_crop --random_flip \ --train_batch_size=1 \ --gradient_accumulation_steps=4 \ --max_train_steps=15000 \ --learning_rate=1e-04 \ --max_grad_norm=1 \ --lr_scheduler="cosine" --lr_warmup_steps=0 \ --output_dir=${OUTPUT_DIR} \ --push_to_hub \ --hub_model_id=${HUB_MODEL_ID} \ --report_to=wandb \ --checkpointing_steps=500 \ --validation_prompt="Totoro" \ --seed=1337 \ --caption_column="en_text" ```