SAVRN
Search Contact SAVRN

Open-weight model · Text to image

stable-diffusion-inpainting

by SD v1.5 stable-diffusion-v1-5/stable-diffusion-inpainting

Modifications to the original model card are in red or green Stable Diffusion Inpainting is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input, with the extra capability of inpainting the pictures by using…

Parameters
Context
Weights15.2 GB
Licensecreativeml-openrail-m
AccessOpen weights
Monthly Downloads137.3k

Model Card

By SD v1.5, published under creativeml-openrail-m, revision 8a4288a76071.

Modifications to the original model card are in red or green Stable Diffusion Inpainting is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input, with the extra capability of inpainting the pictures by using a mask. The Stable-Diffusion-Inpainting was initialized with the weights of the Stable-Diffusion-v-1-2. First 595k steps regular training, then 440k steps of inpainting training at resolution 512x512 on “laion-aesthetics v2 5+” and 10% dropping of the text-conditioning to improve classifier-free classifier-free guidance sampling. For inpainting, the UNet has 5 additional input channels (4 for the encoded masked-image and 1 for the mask…

Read SD v1.5's full model card

Stable Diffusion Inpainting model card

This repository is a mirror of the now deprecatedruwnayml/stable-diffusion-inpainting, this repository or oganization are not affiliated in any way with RunwayML.

Modifications to the original model card are in red or green

Stable Diffusion Inpainting is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input, with the extra capability of inpainting the pictures by using a mask.

The Stable-Diffusion-Inpainting was initialized with the weights of the Stable-Diffusion-v-1-2. First 595k steps regular training, then 440k steps of inpainting training at resolution 512x512 on “laion-aesthetics v2 5+” and 10% dropping of the text-conditioning to improve classifier-free classifier-free guidance sampling. For inpainting, the UNet has 5 additional input channels (4 for the encoded masked-image and 1 for the mask itself) whose weights were zero-initialized after restoring the non-inpainting checkpoint. During training, we generate synthetic masks and in 25% mask everything.

Open In Spaces | :-------------------------:|:-------------------------:|

Examples:

You can use this both with the Diffusers library and RunwayML GitHub repository (now deprecated), Automatic1111.

Use with Diffusers

from diffusers import StableDiffusionInpaintPipeline

pipe = StableDiffusionInpaintPipeline.from_pretrained(
    "sd-legacy/stable-diffusion-inpainting",
    revision="fp16",
    torch_dtype=torch.float16,
)
prompt = "Face of a yellow cat, high resolution, sitting on a park bench"
#image and mask_image should be PIL images.
#The mask structure is white for inpainting and black for keeping as is
image = pipe(prompt=prompt, image=image, mask_image=mask_image).images[0]
image.save("./yellow_cat_on_park_bench.png")

How it works: image | mask_image :-------------------------:|:-------------------------:| |

prompt | Output :-------------------------:|:-------------------------:| Face of a yellow cat, high resolution, sitting on a park bench |

Use with Original GitHub Repository or AUTOMATIC1111

  1. Download the weights sd-v1-5-inpainting.ckpt
  2. Follow instructions here (now deprecated).
  3. Use it with AUTOMATIC1111

Model Details

  • Developed by: Robin Rombach, Patrick Esser
  • Model type: Diffusion-based text-to-image generation model
  • Language(s): English
  • License: The CreativeML OpenRAIL M license is an Open RAIL M license, adapted from the work that BigScience and the RAIL Initiative are jointly carrying in the area of responsible AI licensing. See also the article about the BLOOM Open RAIL license on which our license is based.
  • Model Description: This is a model that can be used to generate and modify images based on text prompts. It is a Latent Diffusion Model that uses a fixed, pretrained text encoder (CLIP ViT-L/14) as suggested in the Imagen paper.
  • Resources for more information: GitHub Repository, Paper.
  • Cite as:

    @InProceedings{Rombach_2022_CVPR, author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn}, title = {High-Resolution Image Synthesis With Latent Diffusion Models}, booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)}, month = {June}, year = {2022}, pages = {10684-10695} }

Uses

Direct Use

The 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.
  • Probing and understanding the limitations and biases of generative models.
  • Generation of artworks and use in design and other artistic processes.
  • Applications in educational or creative tools.
  • Research on generative models.

Excluded uses are described below.

### Misuse, Malicious Use, and Out-of-Scope Use Note: This section is taken from the DALLE-MINI model card, but applies in the same way to Stable Diffusion v1.

The model should not be used to intentionally create or disseminate images that create hostile or alienating environments for people. This includes generating images that people would foreseeably find disturbing, distressing, or offensive; or content that propagates historical or current stereotypes.

Out-of-Scope Use

The model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.

Misuse and Malicious Use

Using the model to generate content that is cruel to individuals is a misuse of this model. This includes, but is not limited to:

  • Generating demeaning, dehumanizing, or otherwise harmful representations of people or their environments, cultures, religions, etc.
  • Intentionally promoting or propagating discriminatory content or harmful stereotypes.
  • Impersonating individuals without their consent.
  • Sexual content without consent of the people who might see it.
  • Mis- and disinformation
  • Representations of egregious violence and gore
  • Sharing of copyrighted or licensed material in violation of its terms of use.
  • Sharing content that is an alteration of copyrighted or licensed material in violation of its terms of use.

Limitations and Bias

Limitations

  • The model does not achieve perfect photorealism
  • The model cannot render legible text
  • The model does not perform well on more difficult tasks which involve compositionality, such as rendering an image corresponding to “A red cube on top of a blue sphere”
  • Faces and people in general may not be generated properly.
  • The model was trained mainly with English captions and will not work as well in other languages.
  • The autoencoding part of the model is lossy
  • The model was trained on a large-scale dataset LAION-5B which contains adult material and is not fit for product use without additional safety mechanisms and considerations.
  • No additional measures were used to deduplicate the dataset. As a result, we observe some degree of memorization for images that are duplicated in the training data. The training data can be searched at https://rom1504.github.io/clip-retrieval/ to possibly assist in the detection of memorized images.

Bias

While the capabilities of image generation models are impressive, they can also reinforce or exacerbate social biases. Stable Diffusion v1 was trained on subsets of LAION-2B(en), which consists of images that are primarily 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, the ability of the model to generate content with non-English prompts is significantly worse than with English-language prompts.

Training

Training Data The model developers used the following dataset for training the model:

  • LAION-2B (en) and subsets thereof (see next section)

Training Procedure Stable Diffusion v1 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 a ViT-L/14 text-encoder.
  • The non-pooled output of the text encoder is fed into the UNet backbone of the latent diffusion model via cross-attention.
  • The loss is a reconstruction objective between the noise that was added to the latent and the prediction made by the UNet.

We currently provide six checkpoints, sd-v1-1.ckpt, sd-v1-2.ckpt and sd-v1-3.ckpt, sd-v1-4.ckpt, sd-v1-5.ckpt and sd-v1-5-inpainting.ckpt which were trained as follows,

  • sd-v1-1.ckpt: 237k steps at resolution 256x256 on laion2B-en. 194k steps at resolution 512x512 on laion-high-resolution (170M examples from LAION-5B with resolution >= 1024x1024).
  • sd-v1-2.ckpt: Resumed from sd-v1-1.ckpt. 515k steps at resolution 512x512 on "laion-improved-aesthetics" (a subset of laion2B-en, filtered to images with an original size >= 512x512, estimated aesthetics score > 5.0, and an estimated watermark probability < 0.5. The watermark estimate is from the LAION-5B metadata, the aesthetics score is estimated using an improved aesthetics estimator).
  • sd-v1-3.ckpt: Resumed from sd-v1-2.ckpt. 195k steps at resolution 512x512 on "laion-improved-aesthetics" and 10\% dropping of the text-conditioning to improve classifier-free guidance sampling.
  • sd-v1-4.ckpt: Resumed from stable-diffusion-v1-2.225,000 steps at resolution 512x512 on "laion-aesthetics v2 5+" and 10 % dropping of the text-conditioning to classifier-free guidance sampling.
  • sd-v1-5.ckpt: Resumed from sd-v1-2.ckpt. 595k steps at resolution 512x512 on "laion-aesthetics v2 5+" and 10% dropping of the text-conditioning to improve classifier-free guidance sampling.
  • sd-v1-5-inpaint.ckpt: Resumed from sd-v1-2.ckpt. 595k steps at resolution 512x512 on "laion-aesthetics v2 5+" and 10% dropping of the text-conditioning to improve classifier-free guidance sampling. Then 440k steps of inpainting training at resolution 512x512 on “laion-aesthetics v2 5+” and 10% dropping of the text-conditioning. For inpainting, the UNet has 5 additional input channels (4 for the encoded masked-image and 1 for the mask itself) whose weights were zero-initialized after restoring the non-inpainting checkpoint. During training, we generate synthetic masks and in 25% mask everything.

  • Hardware: 32 x 8 x A100 GPUs

  • Optimizer: AdamW
  • Gradient Accumulations: 2
  • Batch: 32 x 8 x 2 x 4 = 2048
  • Learning rate: warmup to 0.0001 for 10,000 steps and then kept constant

Evaluation Results

Evaluations with different classifier-free guidance scales (1.5, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0) and 50 PLMS sampling steps show the relative improvements of the checkpoints:

Evaluated using 50 PLMS steps and 10000 random prompts from the COCO2017 validation set, evaluated at 512x512 resolution. Not optimized for FID scores.

Inpainting Evaluation

To assess the performance of the inpainting model, we used the same evaluation protocol as in our LDM paper. Since the Stable Diffusion Inpainting Model acccepts a text input, we simply used a fixed prompt of photograph of a beautiful empty scene, highest quality settings.

Model FID LPIPS
Stable Diffusion Inpainting 1.00 0.141 (+- 0.082)
Latent Diffusion Inpainting 1.50 0.137 (+- 0.080)
CoModGAN 1.82 0.15
LaMa 2.21 0.134 (+- 0.080)

Environmental Impact

Stable Diffusion v1 Estimated Emissions Based on that information, we estimate the following CO2 emissions using the Machine Learning Impact calculator presented in Lacoste et al. (2019). The hardware, runtime, cloud provider, and compute region were utilized to estimate the carbon impact.

  • Hardware Type: A100 PCIe 40GB
  • Hours used: 150000
  • Cloud Provider: AWS
  • Compute Region: US-east
  • Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid): 11250 kg CO2 eq.

Citation

    @InProceedings{Rombach_2022_CVPR,
        author    = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
        title     = {High-Resolution Image Synthesis With Latent Diffusion Models},
        booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
        month     = {June},
        year      = {2022},
        pages     = {10684-10695}
    }

This model card was written by: Robin Rombach and Patrick Esser and is based on the DALL-E Mini model card.

Identity and Version

Repository
stable-diffusion-v1-5/stable-diffusion-inpainting
Publisher
SD v1.5
Task
Text to image
Modality
Image
Library
diffusers
Parameters
Not stated by the source
Languages
Not stated by the source
Revision
8a4288a76071f7280aedbdb3253bdb9e9d5d84bb
First published
2024-08-30
Last updated
2024-09-06

Files and Weights

27 files, 15.2 GB in total. The weights are 13 files totalling 15.2 GB in bin, ckpt, safetensors.

Weights13 files · 15.2 GB
Configuration9 files · 9.1 KB
Tokenizer3 files · 1.6 MB
Documentation1 file · 15.1 KB
Repository1 file · 1.8 KB
Every file
FileTypeSizeSHA-256
safety_checker/model.fp16.safetensorsWeights608.0 MB 08902f19b1cf
safety_checker/pytorch_model.binWeights1.2 GB 193490b58ef6
safety_checker/pytorch_model.fp16.binWeights608.1 MB 22ba87205445
sd-v1-5-inpainting.ckptWeights4.3 GB c6bbc15e3224
text_encoder/model.fp16.safetensorsWeights246.1 MB 77795e2023ad
text_encoder/pytorch_model.binWeights492.3 MB 770a47a9ffdc
text_encoder/pytorch_model.fp16.binWeights246.2 MB 05eee911f195
unet/diffusion_pytorch_model.binWeights3.4 GB af4e22eecaca
unet/diffusion_pytorch_model.fp16.binWeights1.7 GB a71dec5f3ee7
unet/diffusion_pytorch_model.fp16.safetensorsWeights1.7 GB 24b788b4a777
vae/diffusion_pytorch_model.binWeights334.7 MB 1b134cded8eb
vae/diffusion_pytorch_model.fp16.binWeights167.4 MB b7643b3e40b9
vae/diffusion_pytorch_model.fp16.safetensorsWeights167.3 MB 4fbcf0ebe55a
config.jsonConfiguration748 B
feature_extractor/preprocessor_config.jsonConfiguration342 B
model_index.jsonConfiguration548 B
safety_checker/config.jsonConfiguration4.8 KB
scheduler/scheduler_config.jsonConfiguration313 B
text_encoder/config.jsonConfiguration617 B
tokenizer/special_tokens_map.jsonConfiguration472 B
unet/config.jsonConfiguration748 B
vae/config.jsonConfiguration552 B
README.mdDocumentation15.1 KB
.gitattributesRepository1.8 KB
tokenizer/merges.txtTokenizer524.6 KB
tokenizer/tokenizer_config.jsonTokenizer806 B
tokenizer/vocab.jsonTokenizer1.1 MB

License and Download

License
creativeml-openrail-m
Access
Open weights, no gate
Download size
15.2 GB
Download from SD v1.5

Released by SD v1.5 through its official repository on Hugging Face.

Built From

Memory Requirements

PrecisionWeights in memory
As published15.2 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About stable-diffusion-inpainting

Can I use stable-diffusion-inpainting commercially?

Yes, with conditions. stable-diffusion-inpainting is released under CreativeML Open RAIL-M. CreativeML Open RAIL-M permits use, including commercial use, subject to the use-based restrictions in its attachment, which must be passed on downstream.

Similar Models

Model · Text to image

Juggernaut-XL-v9

RunDiffusion

The SDXL ecosystem is the single most mature corner of open image generation, and v9 is its most refined photorealism checkpoint. Choose Juggernaut XL v9 when you want: - Photorealism that holds up under scrutiny — skin texture, micro-contrast, and natural lighting that translates from concept to print. - Reasonable hardware — runs comfortably on 8 GB of VRAM, unlike newer DiT-based models that demand 16+ GB. - The full SDXL toolbox — drop-in compatibility with the thousands of SDXL ControlNets, IP-Adapter variants, AnimateDiff, regional prompting tools, and LoRAs already in your workflow. - Battle-tested reliability — 26+ months in production, used in agencies, studios, and shipping…

Open weights creativeml-openrail-m diffusers

Model · Text to image

Qwen-Image-Lightning

Lightx2v

Please refer to Qwen-Image-Lightning github to learn how to use the models. make sure to install diffusers from main (pip install git+https://github.com/huggingface/diffusers.git)

Open weights apache-2.0 diffusers

Model · Text to image

Z-Image-Lora

nphSi

+ Always use full LoRa name with "vrtlxxxx" trigger in prompt like "Alba Baptista (vrtlalbabaptista) in a swimming pool". "Woman" or "1girl" will NOT work due to my way i do captions. + Add the gender to the prompt for confusing names like "Alex Jones". + Remove the name when internal model knowledge is bad or censored or is confusing to model like "Sandy Cheeks" or "Kate Middleton". + When using a Lora with multiple triggers (vrtlxx,vrtlyy) do not use the real character name but only trigger or a combination of it. "vrtlMain" always combines all trigger-words. Angourie Rice, January Jones, Julianna Guill, Ursula Corbero, Judith Rakers, Alina Merkau, Kiernan Shipka, Leslie Bibb, Marie…

Open weights apache-2.0 diffusers

Model · Text to image

Flux2-Klein-9B-True-V2

Wikee Yang

Recommend smthemex/ComfyUIUniBlockSwap plugin for LOW VRAM users, it only requires 4-6GB of VRAM to run the full bf16 model. 您可以尝试一下全新的 ComfyUI GGUF 模型加载插件 smthemex/ComfyUIDifGGUF,它能适配更多的 GGUF 文件格式,并且将很快集成低显存(4-8GB)显卡的 GGUF 模型块卸载管理能力。 Recommend to try the new GGUF ComfyUI loader plugin, smthemex/ComfyUIDifGGUF, it compatible with more GGUF format, and will add low VRAM (4-8GB) management for GGUF soon. 1. 图像的真实感和质感进一步改善,基本接近香蕉(Nano Banana)的水平。 2. 提示词遵循和还原能力,参数适配性和LoRA兼容性进一步改善,。 The V2 version of this model has undergone a full fine-tuning based on FLUX.2-Klein-9B-True-V1. Compared to the V1 version, it has some improvements and enhancements as below: 1. The realism and texture of images…

Open weights other diffusers

Model · Text to image

Z-Image-Turbo-GGUF

Unsloth AI

Welcome to the official repository for the Z-Image(造相)project! Z-Image is a powerful and highly efficient image generation model with 6B parameters. Currently there are three variants: - Z-Image-Turbo – A distilled version of Z-Image that matches or exceeds leading competitors with only 8 NFEs (Number of Function Evaluations). It offers sub-second inference latency on enterprise-grade H800 GPUs and fits comfortably within 16G VRAM consumer devices. It excels in photorealistic image generation, bilingual text rendering (English & Chinese), and robust instruction adherence. - Z-Image-Base – The non-distilled foundation model. By releasing this checkpoint, we aim to unlock the full potential…

Open weights apache-2.0 ggml

Model · Text to image

FLUX.1-dev-gguf

City

This is a direct GGUF conversion of black-forest-labs/FLUX.1-dev As this is a quantized model not a finetune, all the same restrictions/original license terms still apply. The model files can be used with the ComfyUI-GGUF custom node. Place model files in ComfyUI/models/unet - see the GitHub readme for further install instructions. Please refer to this chart for a basic overview of quantization types.

Open weights other gguf