Run this model with HF Jobs
Run glowforge-dev/stable-diffusion-2-1-img2img-jonathan2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/glowforge-dev/stable-diffusion-2-1-img2img-jonathan2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/glowforge-dev/stable-diffusion-2-1-img2img-jonathan2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use glowforge-dev/stable-diffusion-2-1-img2img-jonathan2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use glowforge-dev/stable-diffusion-2-1-img2img-jonathan2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("glowforge-dev/stable-diffusion-2-1-img2img-jonathan2", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Commit ·
6c599c3
1
Parent(s): d3a0ec4
image to image interface
Browse files1 unmodified line2345678910111213141515 unmodified lines3132333435363715 unmodified lines53545556575859603 unmodified lines6465666768697038 unmodified lines1091101111121131141151161171181196 unmodified lines12612712812913013113215 unmodified lines1481491501511521531541 unmodified line15615715815916016116216316416516618 unmodified lines1851861871881 unmodified linelicense: openrail++tags:- stable-diffusion- text-to-imageduplicated_from: stabilityai/stable-diffusion-2-1-base---# Stable Diffusion v2-1-base Model CardThis model card focuses on the model associated with the Stable Diffusion v2-1-base model.This `stable-diffusion-2-1-base` model fine-tunes [stable-diffusion-2-base](https://huggingface.co/stabilityai/stable-diffusion-2-base) (`512-base-ema.ckpt`) with 220k extra steps taken, with `punsafe=0.98` on the same dataset.- Use it with the [`stablediffusion`](https://github.com/Stability-AI/stablediffusion) repository: download the `v2-1_512-ema-pruned.ckpt` [here](https://huggingface.co/stabilityai/stable-diffusion-2-1-base/resolve/main/v2-1_512-ema-pruned.ckpt).- Use it with 🧨 [`diffusers`](#examples)15 unmodified linesyear = {2022},pages = {10684-10695}}## Examples15 unmodified linespipe = pipe.to("cuda")prompt = "a photo of an astronaut riding a horse on mars"image = pipe(prompt).images[0]image.save("astronaut_rides_horse.png")```3 unmodified lines# Uses## Direct UseThe model is intended for research purposes only. Possible research areas and tasks include- Safe deployment of models which have the potential to generate harmful content.38 unmodified lines[LAION-5B](https://laion.ai/blog/laion-5b/), which contains adult, violent and sexual content. To partially mitigate this, we have filtered the dataset using LAION's NFSW detector (see Training section).### BiasWhile the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.Stable Diffusion vw was primarily trained on subsets of [LAION-2B(en)](https://laion.ai/blog/laion-5b/),which consists of images that are limited to English descriptions.Texts and images from communities and cultures that use other languages are likely to be insufficiently accounted for.This affects the overall output of the model, as white and western cultures are often set as the default. Further, theability of the model to generate content with non-English prompts is significantly worse than with English-language prompts.Stable Diffusion v2 mirrors and exacerbates biases to such a degree that viewer discretion must be advised irrespective of the input or its intent.6 unmodified lines- LAION-5B and subsets (details below). The training data is further filtered using LAION's NSFW detector, with a "p_unsafe" score of 0.1 (conservative). For more details, please refer to LAION-5B's [NeurIPS 2022](https://openreview.net/forum?id=M3Y74vmsMcY) paper and reviewer discussions on the topic.**Training Procedure**Stable Diffusion v2 is a latent diffusion model which combines an autoencoder with a diffusion model that is trained in the latent space of the autoencoder. During training,- Images are encoded through an encoder, which turns images into latent representations. The autoencoder uses a relative downsampling factor of 8 and maps images of shape H x W x 3 to latents of shape H/f x W/f x 4- Text prompts are encoded through the OpenCLIP-ViT/H text-encoder.15 unmodified lines- `512-inpainting-ema.ckpt`: Resumed from `512-base-ema.ckpt` and trained for another 200k steps. Follows the mask-generation strategy presented in [LAMA](https://github.com/saic-mdal/lama) which, in combination with the latent VAE representations of the masked image, are used as an additional conditioning.The additional input channels of the U-Net which process this extra information were zero-initialized. The same strategy was used to train the [1.5-inpainting checkpoint](https://github.com/saic-mdal/lama).- `x4-upscaling-ema.ckpt`: Trained for 1.25M steps on a 10M subset of LAION containing images `>2048x2048`. The model was trained on crops of size `512x512` and is a text-guided [latent upscaling diffusion model](https://arxiv.org/abs/2112.10752).In addition to the textual input, it receives a `noise_level` as an input parameter, which can be used to add noise to the low-resolution input according to a [predefined diffusion schedule](configs/stable-diffusion/x4-upscaling.yaml).- **Hardware:** 32 x 8 x A100 GPUs- **Optimizer:** AdamW1 unmodified line- **Batch:** 32 x 8 x 2 x 4 = 2048- **Learning rate:** warmup to 0.0001 for 10,000 steps and then kept constant## Evaluation ResultsEvaluations with different classifier-free guidance scales (1.5, 2.0, 3.0, 4.0,5.0, 6.0, 7.0, 8.0) and 50 steps DDIM sampling steps show the relative improvements of the checkpoints:Evaluated using 50 DDIM steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.18 unmodified linespages = {10684-10695}}*This model card was written by: Robin Rombach, Patrick Esser and David Ha and is based on the [Stable Diffusion v1](https://github.com/CompVis/stable-diffusion/blob/main/Stable_Diffusion_v1_Model_Card.md) and [DALL-E Mini model card](https://huggingface.co/dalle-mini/dalle-mini).*1 unmodified line234567891011121314151617181915 unmodified lines3536373839404115 unmodified lines57585960616263643 unmodified lines6869707172737438 unmodified lines1131141151161171181191201211221236 unmodified lines13013113213313413513615 unmodified lines1521531541551561571581 unmodified line16016116216316416516616716816917018 unmodified lines1891901911921 unmodified linelicense: openrail++tags:- stable-diffusion- image-to-imagewidget:- src: >-https://huggingface.co/datasets/mishig/sample_images/resolve/main/canny-edge.jpgprompt: Girl with Pearl Earringduplicated_from: stabilityai/stable-diffusion-2-1-base---# Stable Diffusion v2-1-base Model CardThis model card focuses on the model associated with the Stable Diffusion v2-1-base model.This `stable-diffusion-2-1-base` model fine-tunes [stable-diffusion-2-base](https://huggingface.co/stabilityai/stable-diffusion-2-base) (`512-base-ema.ckpt`) with 220k extra steps taken, with `punsafe=0.98` on the same dataset.- Use it with the [`stablediffusion`](https://github.com/Stability-AI/stablediffusion) repository: download the `v2-1_512-ema-pruned.ckpt` [here](https://huggingface.co/stabilityai/stable-diffusion-2-1-base/resolve/main/v2-1_512-ema-pruned.ckpt).- Use it with 🧨 [`diffusers`](#examples)15 unmodified linesyear = {2022},pages = {10684-10695}}## Examples15 unmodified linespipe = pipe.to("cuda")prompt = "a photo of an astronaut riding a horse on mars"image = pipe(prompt).images[0]image.save("astronaut_rides_horse.png")```3 unmodified lines# Uses## Direct UseThe model is intended for research purposes only. Possible research areas and tasks include- Safe deployment of models which have the potential to generate harmful content.38 unmodified lines[LAION-5B](https://laion.ai/blog/laion-5b/), which contains adult, violent and sexual content. To partially mitigate this, we have filtered the dataset using LAION's NFSW detector (see Training section).### BiasWhile the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases.Stable Diffusion vw was primarily trained on subsets of [LAION-2B(en)](https://laion.ai/blog/laion-5b/),which consists of images that are limited to English descriptions.Texts and images from communities and cultures that use other languages are likely to be insufficiently accounted for.This affects the overall output of the model, as white and western cultures are often set as the default. Further, theability of the model to generate content with non-English prompts is significantly worse than with English-language prompts.Stable Diffusion v2 mirrors and exacerbates biases to such a degree that viewer discretion must be advised irrespective of the input or its intent.6 unmodified lines- LAION-5B and subsets (details below). The training data is further filtered using LAION's NSFW detector, with a "p_unsafe" score of 0.1 (conservative). For more details, please refer to LAION-5B's [NeurIPS 2022](https://openreview.net/forum?id=M3Y74vmsMcY) paper and reviewer discussions on the topic.**Training Procedure**Stable Diffusion v2 is a latent diffusion model which combines an autoencoder with a diffusion model that is trained in the latent space of the autoencoder. During training,- Images are encoded through an encoder, which turns images into latent representations. The autoencoder uses a relative downsampling factor of 8 and maps images of shape H x W x 3 to latents of shape H/f x W/f x 4- Text prompts are encoded through the OpenCLIP-ViT/H text-encoder.15 unmodified lines- `512-inpainting-ema.ckpt`: Resumed from `512-base-ema.ckpt` and trained for another 200k steps. Follows the mask-generation strategy presented in [LAMA](https://github.com/saic-mdal/lama) which, in combination with the latent VAE representations of the masked image, are used as an additional conditioning.The additional input channels of the U-Net which process this extra information were zero-initialized. The same strategy was used to train the [1.5-inpainting checkpoint](https://github.com/saic-mdal/lama).- `x4-upscaling-ema.ckpt`: Trained for 1.25M steps on a 10M subset of LAION containing images `>2048x2048`. The model was trained on crops of size `512x512` and is a text-guided [latent upscaling diffusion model](https://arxiv.org/abs/2112.10752).In addition to the textual input, it receives a `noise_level` as an input parameter, which can be used to add noise to the low-resolution input according to a [predefined diffusion schedule](configs/stable-diffusion/x4-upscaling.yaml).- **Hardware:** 32 x 8 x A100 GPUs- **Optimizer:** AdamW1 unmodified line- **Batch:** 32 x 8 x 2 x 4 = 2048- **Learning rate:** warmup to 0.0001 for 10,000 steps and then kept constant## Evaluation ResultsEvaluations with different classifier-free guidance scales (1.5, 2.0, 3.0, 4.0,5.0, 6.0, 7.0, 8.0) and 50 steps DDIM sampling steps show the relative improvements of the checkpoints:Evaluated using 50 DDIM steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.18 unmodified linespages = {10684-10695}}*This model card was written by: Robin Rombach, Patrick Esser and David Ha and is based on the [Stable Diffusion v1](https://github.com/CompVis/stable-diffusion/blob/main/Stable_Diffusion_v1_Model_Card.md) and [DALL-E Mini model card](https://huggingface.co/dalle-mini/dalle-mini).*
README.md+20-16