GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - LambdaLabsML/lambda-diffusers

BranchesTags
Open more actions menu

Latest commit

 

History

67 Commits
67 Commits

Folders and files

NameName
Last commit message
Last commit date
benchmarks
benchmarks
 
 
docs
docs
 
 
lambda_diffusers
lambda_diffusers
 
 
notebooks
notebooks
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
setup.py
setup.py
 
 

Repository files navigation

Lambda Diffusers

Additional models and pipelines for 🤗 Diffusers created by Lambda Labs

  • Stable Diffusion Image Variations
  • Pokemon text to image

🦄 Other exciting ML projects at Lambda: ML Times, Distributed Training Guide, Text2Video, GPU Benchmark.

Installation

git clone https://github.com/LambdaLabsML/lambda-diffusers.git
cd lambda-diffusers
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Stable Diffusion Image Variations

A fine-tuned version of Stable Diffusion conditioned on CLIP image embeddings to enabel Image Variations.

Open In Colab Open in Spaces Open in Replicate

  • Download the weights ported to 🤗 Diffusers here.
  • See the original training repo here.

Usage

from diffusers import StableDiffusionImageVariationPipeline
from PIL import Image

device = "cuda:0"
sd_pipe = StableDiffusionImageVariationPipeline.from_pretrained(
  "lambdalabs/sd-image-variations-diffusers",
  revision="v2.0",
  )
sd_pipe = sd_pipe.to(device)

im = Image.open("path/to/image.jpg")
tform = transforms.Compose([
    transforms.ToTensor(),
    transforms.Resize(
        (224, 224),
        interpolation=transforms.InterpolationMode.BICUBIC,
        antialias=False,
        ),
    transforms.Normalize(
      [0.48145466, 0.4578275, 0.40821073],
      [0.26862954, 0.26130258, 0.27577711]),
])
inp = tform(im).to(device)

out = sd_pipe(inp, guidance_scale=3)
out["images"][0].save("result.jpg")

Pokemon text to image

Stable Diffusion fine tuned on Pokémon by Lambda Labs.

Open in Replicate Open In Colab Open in Spaces

Put in a text prompt and generate your own Pokémon character, no "prompt engineering" required!

If you want to find out how to train your own Stable Diffusion variants, see this example from Lambda Labs.

Girl with a pearl earring, Cute Obama creature, Donald Trump, Boris Johnson, Totoro, Hello Kitty

Model description

Trained on BLIP captioned Pokémon images using 2xA6000 GPUs on Lambda GPU Cloud for around 15,000 step (about 6 hours, at a cost of about $10).

Usage

import torch
from diffusers import StableDiffusionPipeline
from torch import autocast

pipe = StableDiffusionPipeline.from_pretrained("lambdalabs/sd-pokemon-diffusers", torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "Yoda"
scale = 10
n_samples = 4

# Sometimes the nsfw checker is confused by the Pokémon images, you can disable
# it at your own risk here
disable_safety = False

if disable_safety:
  def null_safety(images, **kwargs):
      return images, False
  pipe.safety_checker = null_safety

with autocast("cuda"):
  images = pipe(n_samples*[prompt], guidance_scale=scale).images

for idx, im in enumerate(images):
  im.save(f"{idx:06}.png")

Benchmarking inference

We have updated the original benchmark using xformers and a newer version of Diffusers, see the new results here (original results can still be found here).

Usage

Ensure that NVIDIA container toolkit is installed on your system and then run the following:

git clone https://github.com/LambdaLabsML/lambda-diffusers.git
cd lambda-diffusers/scripts
make bench

Currently xformers does not support H100. The "without xformers" results below are generated by running the benchmark with --xformers no (can be set in scripts/Makefile)

Results

With xformers, raw data can be found here.

Without xformers, raw data can be found here.

H100 MIG performance, raw data can be found here.

Cost analysis

Links

  • Captioned Pokémon dataset
  • Model weights in Diffusers format
  • Original model weights
  • Training code

Trained by Justin Pinkney (@Buntworthy) at Lambda Labs.

About

No description, website, or topics provided.

Resources

Readme
MIT license
Activity
Custom properties

Stars

575 stars

Watchers

11 watching

Forks

84 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.