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/docs/source/en/using-diffusers/unconditional_image_generation.md from elvis92/pets_rank_2: direct link, hf CLI and curl.
- Browser
- Download file 2.66 kB
-
https://huggingface.co/elvis92/pets_rank_2/resolve/main/diffusers/docs/source/en/using-diffusers/unconditional_image_generation.md
- Command line
-
hf download hf://elvis92/pets_rank_2/diffusers/docs/source/en/using-diffusers/unconditional_image_generation.md
-
curl -L -o unconditional_image_generation.md https://huggingface.co/elvis92/pets_rank_2/resolve/main/diffusers/docs/source/en/using-diffusers/unconditional_image_generation.md
Unconditional image generation
[[open-in-colab]]
Unconditional image generation is a relatively straightforward task. The model only generates images - without any additional context like text or an image - resembling the training data it was trained on.
The [DiffusionPipeline] is the easiest way to use a pre-trained diffusion system for inference.
Start by creating an instance of [DiffusionPipeline] and specify which pipeline checkpoint you would like to download.
You can use any of the 🧨 Diffusers checkpoints from the Hub (the checkpoint you'll use generates images of butterflies).
💡 Want to train your own unconditional image generation model? Take a look at the training guide to learn how to generate your own images.
In this guide, you'll use [DiffusionPipeline] for unconditional image generation with DDPM:
from diffusers import DiffusionPipeline
generator = DiffusionPipeline.from_pretrained("anton-l/ddpm-butterflies-128", use_safetensors=True)
The [DiffusionPipeline] downloads and caches all modeling, tokenization, and scheduling components.
Because the model consists of roughly 1.4 billion parameters, we strongly recommend running it on a GPU.
You can move the generator object to a GPU, just like you would in PyTorch:
generator.to("cuda")
Now you can use the generator to generate an image:
image = generator().images[0]
image
The output is by default wrapped into a PIL.Image object.
You can save the image by calling:
image.save("generated_image.png")
Try out the Spaces below, and feel free to play around with the inference steps parameter to see how it affects the image quality!