Diffusers

Latest version: v0.29.1

Safety actively analyzes 640974 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 12 of 14

0.7.2

This patch release fixes a bug that broken the Flax Stable Diffusion Inference.
Thanks a mille for spotting it camenduru in https://github.com/huggingface/diffusers/issues/1145 and thanks a lot to pcuenca and kashif for fixing it in https://github.com/huggingface/diffusers/pull/1149


* Flax: Flip sin to cos in time embeddings 1149 by pcuenca

0.7.1

This patch release makes `accelerate` a soft dependency to avoid an error when installing `diffusers` with pre-existing `torch`.


* Move accelerate to a soft-dependency 1134 by patrickvonplaten

0.7.0

:heart: PyTorch + Accelerate

:warning: The PyTorch pipelines now require `accelerate` for improved model loading times!
Install Diffusers with `pip install --upgrade diffusers[torch]` to get everything in a single command.

0.6.0

:art: Finetuned Stable Diffusion inpainting

The first official stable diffusion checkpoint fine-tuned on **inpainting** has been released.

You can try it out in the official [demo here](https://huggingface.co/spaces/runwayml/stable-diffusion-inpainting)

or code it up yourself :computer: :

python
from io import BytesIO

import torch

import PIL
import requests
from diffusers import StableDiffusionInpaintPipeline


def download_image(url):
response = requests.get(url)
return PIL.Image.open(BytesIO(response.content)).convert("RGB")


img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"
image = download_image(img_url).resize((512, 512))
mask_image = download_image(mask_url).resize((512, 512))

pipe = StableDiffusionInpaintPipeline.from_pretrained(
"runwayml/stable-diffusion-inpainting",
revision="fp16",
torch_dtype=torch.float16,
)
pipe.to("cuda")

prompt = "Face of a yellow cat, high resolution, sitting on a park bench"

output = pipe(prompt=prompt, image=image, mask_image=mask_image)
image = output.images[0]


**gives**:

`image` | `mask_image` | `prompt` | | **Output** |
:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|-------------------------:|
<img src="https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png" alt="drawing" width="200"/> | <img src="https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png" alt="drawing" width="200"/> | ***Face of a yellow cat, high resolution, sitting on a park bench*** | **=>** | <img src="https://huggingface.co/datasets/patrickvonplaten/images/resolve/main/test.png" alt="drawing" width="200"/> |

:warning: This release deprecates the unsupervised noising-based inpainting pipeline into `StableDiffusionInpaintPipelineLegacy`.
The new `StableDiffusionInpaintPipeline` is based on a Stable Diffusion model finetuned for the inpainting task: https://huggingface.co/runwayml/stable-diffusion-inpainting

> **Note**
> When loading `StableDiffusionInpaintPipeline` with a non-finetuned model (i.e. the one saved with `diffusers<=0.5.1`), the pipeline will default to `StableDiffusionInpaintPipelineLegacy`, to maintain backward compatibility :sparkles:

python
from diffusers import StableDiffusionInpaintPipeline

pipe = StableDiffusionInpaintPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")

assert pipe.__class__ .__name__ == "StableDiffusionInpaintPipelineLegacy"


**Context**:

Why this change? When Stable Diffusion came out ~2 months ago, there were many unofficial in-painting demos using the original v1-4 checkpoint (`"CompVis/stable-diffusion-v1-4"`). These demos worked reasonably well, so that we integrated an **experimental** `StableDiffusionInpaintPipeline` class into `diffusers`. Now that the official inpainting checkpoint was released: https://github.com/runwayml/stable-diffusion we decided to make this our **official** pipeline and move the old / hacky one to `"StableDiffusionInpaintPipelineLegacy"`.

:rocket: ONNX pipelines for image2image and inpainting
Thanks to the contribution by zledas (552) this release supports `OnnxStableDiffusionImg2ImgPipeline` and `OnnxStableDiffusionInpaintPipeline` optimized for CPU inference:

python
from diffusers import OnnxStableDiffusionImg2ImgPipeline, OnnxStableDiffusionInpaintPipeline

img_pipeline = OnnxStableDiffusionImg2ImgPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4", revision="onnx", provider="CPUExecutionProvider"
)

inpaint_pipeline = OnnxStableDiffusionInpaintPipeline.from_pretrained(
"runwayml/stable-diffusion-inpainting", revision="onnx", provider="CPUExecutionProvider"
)

:earth_africa: Community Pipelines

Two new community pipelines have been added to `diffusers` :fire:

Stable Diffusion Interpolation example

Interpolate the latent space of Stable Diffusion between different prompts/seeds.
For more info see [stable-diffusion-videos](https://github.com/nateraw/stable-diffusion-videos).

For a code example, see [Stable Diffusion Interpolation](https://github.com/huggingface/diffusers/tree/main/examples/community#stable-diffusion-interpolation)

* Add Stable Diffusion Interpolation Example by nateraw in 862

Stable Diffusion Interpolation Mega

One Stable Diffusion Pipeline with all functionalities of [Text2Image](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py), [Image2Image](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py) and [Inpainting](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py)

For a code example, see [Stable Diffusion Mega](https://github.com/huggingface/diffusers/tree/main/examples/community#stable-diffusion-mega)

* All in one Stable Diffusion Pipeline by patrickvonplaten in 821

:memo: Changelog
* [Community] One step unet by patrickvonplaten in 840
* Remove unneeded use_auth_token by osanseviero in 839
* Bump to 0.6.0.dev0 by anton-l in 831
* Remove the last of ["sample"] by anton-l in 842
* Fix Flax pipeline: width and height are ignored 838 by camenduru in 848
* [DeviceMap] Make sure stable diffusion can be loaded from older trans… by patrickvonplaten in 860
* Fix small community pipeline import bug and finish README by patrickvonplaten in 869
* Fix training push_to_hub (unconditional image generation): models were not saved before pushing to hub by pcuenca in 868
* Fix table in community README.md by nateraw in 879
* Add generic inference example to community pipeline readme by apolinario in 874
* Rename frame filename in interpolation community example by nateraw in 881
* Add Apple M1 tests by anton-l in 796
* Fix autoencoder test by pcuenca in 886
* Rename StableDiffusionOnnxPipeline -> OnnxStableDiffusionPipeline by anton-l in 887
* Fix DDIM on Windows not using int64 for timesteps by hafriedlander in 819
* [dreambooth] allow fine-tuning text encoder by patil-suraj in 883
* Stable Diffusion image-to-image and inpaint using onnx. by zledas in 552
* Improve ONNX img2img numpy handling, temporarily fix the tests by anton-l in 899
* [Stable Diffusion Inpainting] Deprecate inpainting pipeline in favor of official one by patrickvonplaten in 903
* [Communit Pipeline] Make sure "mega" uses correct inpaint pipeline by patrickvonplaten in 908
* Stable diffusion inpainting by patil-suraj in 904
* ONNX supervised inpainting by anton-l in 906

0.5.1

This patch release fixes an bug with Flax's NFSW safety checker in the pipeline.

https://github.com/huggingface/diffusers/pull/832 by patil-suraj

0.5.0

:ear_of_rice: JAX/Flax integration for super fast Stable Diffusion on TPUs.
We added JAX support for Stable Diffusion! You can now run Stable Diffusion on Colab TPUs (and GPUs too!) for faster inference.

Check out this TPU-ready colab for a Stable Diffusion pipeline: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion_fast_jax.ipynb)
And a detailed blog post on Stable Diffusion and parallelism in JAX / Flax :hugs: https://huggingface.co/blog/stable_diffusion_jax

The most used models, schedulers and pipelines have been ported to JAX/Flax, namely:
- Models: `FlaxAutoencoderKL`, `FlaxUNet2DConditionModel`
- Schedulers: `FlaxDDIMScheduler`, `FlaxDDIMScheduler`, `FlaxPNDMScheduler`
- Pipelines: `FlaxStableDiffusionPipeline`


Changelog:
- Implement FlaxModelMixin 493 by mishig25 , patil-suraj, patrickvonplaten , pcuenca
- Karras VE, DDIM and DDPM flax schedulers 508 by kashif
- initial flax pndm scheduler 492 by kashif
- FlaxDiffusionPipeline & FlaxStableDiffusionPipeline 559 by mishig25 , patrickvonplaten , pcuenca
- Flax pipeline pndm 583 by pcuenca
- Add from_pt argument in .from_pretrained 527 by younesbelkada
- Make flax from_pretrained work with local subfolder 608 by mishig25

:fire: DeepSpeed low-memory training
Thanks to the :hugs: `accelerate` integration with [DeepSpeed](https://github.com/microsoft/DeepSpeed), a few of our training examples became even more optimized in terms of VRAM and speed:
* DreamBooth is now trainable on 8GB GPUs thanks to a contribution from Ttl! Find out how to run it [here](https://github.com/Ttl/diffusers/blob/f115e8f22dd3195f62f1b38c51a2ca765284aa0e/examples/dreambooth/README.md#training-on-a-8-gb-gpu).
* The [Text2Image finetuning example](https://github.com/huggingface/diffusers/tree/main/examples/text_to_image) is also fully compatible with DeepSpeed.

:pencil2: Changelog
* Revert "[v0.4.0] Temporarily remove Flax modules from the public API by anton-l in 755)"
* Fix push_to_hub for dreambooth and textual_inversion by YaYaB in 748
* Fix ONNX conversion script opset argument type by justinchuby in 739
* Add final latent slice checks to SD pipeline intermediate state tests by jamestiotio in 731
* fix(DDIM scheduler): use correct dtype for noise by keturn in 742
* [Tests] Fix tests by patrickvonplaten in 774
* debug an exception by LowinLi in 638
* Clean up resnet.py file by natolambert in 780
* add sigmoid betas by natolambert in 777
* [Low CPU memory] + device map by patrickvonplaten in 772
* Fix gradient checkpointing test by patrickvonplaten in 797
* fix typo docstring in unet2d by natolambert in 798
* DreamBooth DeepSpeed support for under 8 GB VRAM training by Ttl in 735
* support bf16 for stable diffusion by patil-suraj in 792
* stable diffusion fine-tuning by patil-suraj in 356
* Flax: Trickle down `norm_num_groups` by akash5474 in 789
* Eventually preserve this typo? :) by spezialspezial in 804
* Fix indentation in the code example by osanseviero in 802
* [Img2Img] Fix batch size mismatch prompts vs. init images by patrickvonplaten in 793
* Minor package fixes by anton-l in 809
* [Dummy imports] Better error message by patrickvonplaten in 795
* add or fix license formatting in models directory by natolambert in 808
* [train_text2image] Fix EMA and make it compatible with deepspeed. by patil-suraj in 813
* Fix fine-tuning compatibility with deepspeed by pink-red in 816
* Add diffusers version and pipeline class to the Hub UA by anton-l in 814
* [Flax] Add test by patrickvonplaten in 824
* update flax scheduler API by patil-suraj in 822
* Fix dreambooth loss type with prior_preservation and fp16 by anton-l in 826
* Fix type mismatch error, add tests for negative prompts by anton-l in 823
* Give more customizable options for safety checker by patrickvonplaten in 815
* Flax safety checker by pcuenca in 825
* Align PT and Flax API - allow loading checkpoint from PyTorch configs by patrickvonplaten in 827

Page 12 of 14

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.