Instructions to use elvis92/pets_rank_2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use elvis92/pets_rank_2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("elvis92/pets_rank_2") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Download diffusers/examples/text_to_image/train.py from elvis92/pets_rank_2: direct link, hf CLI and curl.
- Browser
- Download file 1.52 kB
-
https://huggingface.co/elvis92/pets_rank_2/resolve/main/diffusers/examples/text_to_image/train.py
- Command line
-
hf download hf://elvis92/pets_rank_2/diffusers/examples/text_to_image/train.py
-
curl -L -o train.py https://huggingface.co/elvis92/pets_rank_2/resolve/main/diffusers/examples/text_to_image/train.py
1.52 kB
| import subprocess | |
| subprocess.run(["accelerate", "launch", "--mixed_precision=fp16", "train_text_to_image_lora.py", | |
| "--pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5", | |
| "--dataset_name=pcuenq/oxford-pets", | |
| "--dataloader_num_workers=8", | |
| "--resolution=512", "--center_crop", "--random_flip", | |
| "--train_batch_size=1", | |
| "--gradient_accumulation_steps=4", | |
| "--max_train_steps=5000", | |
| "--learning_rate=1e-04", | |
| "--max_grad_norm=1", | |
| "--lr_scheduler=cosine", "--lr_warmup_steps=0", | |
| "--output_dir=/home/htelvis92/182/", | |
| "--push_to_hub", | |
| "--hub_model_id=pets", | |
| "--checkpointing_steps=500", | |
| "--validation_prompt=Totoro", | |
| "--seed=1337", | |
| "--caption_column=label"]) | |
| # run script | |
| # python train_text_to_image_lora.py \ | |
| # --pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5 \ | |
| # --dataset_name=pcuenq/oxford-pets \ | |
| # --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=/home/htelvis92/182 \ | |
| # --push_to_hub \ | |
| # --hub_model_id=pets \ | |
| # --checkpointing_steps=500 \ | |
| # --validation_prompt="Totoro" |