Skip to main content

The library `pared` down the features of `diffusers` implemented the minimum function to generate images without using huggingface/diffusers to understand the inner workings of the library.

Project description

PareDiffusers

Screenshot 2024-01-17 at 10 53 49 PM

parediffusers on PyPI

The library pared down the features of diffusers implemented the minimum function to generate images without using huggingface/diffusers functions to understand the inner workings of the library.

Why PareDiffusers?

PareDiffusers was born out of a curiosity and a desire to demystify the processes of generating images by diffusion models and the workings of the diffusers library.

I will write blog-style notebooks understanding how works using a top-down approach. First, generate images using diffusers to understand the overall flow, then gradually replace code with Pytorch code. In the end, we will write the code for the PareDiffusers code that does not include diffusers code.

I hope that it helps others who share a similar interest in the inner workings of image generation.

Versions

  • v0.0.0: After Ch0.0.0, inprement StableDiffusionPipeline.
  • v0.1.2: After Ch0.1.0, imprement DDIMScheduler.
  • v0.2.0: After Ch0.2.0, imprement UNet2DConditionModel.
  • v0.3.1: After Ch0.3.0, imprement AutoencoderKL.

Table of Contents

Ch0.0.0 PareDiffusersPipeline Open In Colab

version: v0.0.0

  • Generate images using diffusers
  • Imprement StableDiffusionPipeline
  • Imprement DDIMScheduler
  • Imprement UNet2DConditionModel
  • Imprement AutoencoderKL

Ch0.0.1 Test parediffusers Open In Colab

  • Test PareDiffusersPipeline by pip install parediffusers.

Ch0.0.2 Play prompt_embeds Open In Colab

  • Play prompt_embeds, make gradation images by using two prompts.

Ch0.1.0: PareDDIMScheduler Open In Colab

version: v0.1.3

  • Imprement images using diffusers
  • Imprement StableDiffusionPipeline
  • Imprement DDIMScheduler
  • Imprement UNet2DConditionModel
  • Imprement AutoencoderKL

Ch0.1.1: Test parediffusers Open In Colab

  • Test PareDiffusersPipeline by pip install parediffusers.

Ch0.2.0: PareUNet2DConditionModel Open In Colab

version: v0.2.0

  • Generate images using diffusers
  • Imprement StableDiffusionPipeline
  • Imprement DDIMScheduler
  • Imprement UNet2DConditionModel
  • Imprement AutoencoderKL

Ch0.2.1: Test parediffusers Open In Colab

  • Test PareDiffusersPipeline by pip install parediffusers.

Ch0.3.0: PareAutoencoderKL Open In Colab

version: v0.3.1

  • Generate images using diffusers
  • Imprement StableDiffusionPipeline
  • Imprement DDIMScheduler
  • Imprement UNet2DConditionModel
  • Imprement AutoencoderKL

Ch0.3.1: Test parediffusers Open In Colab

  • Test PareDiffusersPipeline by pip install parediffusers.

Usage

import torch
from parediffusers import PareDiffusionPipeline

device = torch.device("cuda")
dtype = torch.float16
model_name = "stabilityai/stable-diffusion-2"

pipe = PareDiffusionPipeline.from_pretrained(model_name, device=device, dtype=dtype)
prompt = "painting depicting the sea, sunrise, ship, artstation, 4k, concept art"
image = pipe(prompt)
display(image)

Contribution

I am starting this project to help me understand the code in order to participate in diffusers' OSS. So, I think there may be some mistakes in my explanation, so if you find any, please feel free to correct them via an issue or pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parediffusers-0.3.2.tar.gz (22.8 kB view hashes)

Uploaded Source

Built Distribution

parediffusers-0.3.2-py3-none-any.whl (29.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page