Skip to content

Code for the Exploration of Stable Diffusion spaces (prompt embedding and random latent spaces) via torch

License

Notifications You must be signed in to change notification settings

g-insana/sd_explorer

Repository files navigation

SD Explorer

DOI

Exploration of Stable Diffusion spaces (prompt embedding and diffusion noise spaces) via pytorch, python code and examples.

By Giuseppe Insana, December 2022

Requirements

torch, transfomers, diffusers, safetensors, PIL, matplotlib

Usage

Clone the repository and run the provided jupyter notebook.

Tutorial

Code and usage examples are all in the provided jupyter notebook. All the main functions have documentation on their usage and arguments.

Note: if the version on github is not rendering properly, try this one, via nbviewer.jupyter.org to preview the notebook before you run it on your environment (note: it jumps to usage examples).

Examples and main functionalities

  • Simple text2img and repeated sampling prompt2img([prompt1, prompt2], seed=seed, n_samples=3)
  • Interpolation between text prompts interpolate_prompts([prompt1, prompt2], interpolate_steps=5) From boy to car
  • Walking in embedding space beyond the correct point produced by a prompt images = beyond_prompt(prompt, walk_steps=8, walk_stepsize=0.01) green hair girl eating noodles
  • Circular or spiral spherical walks through the diffusion noise space with 2 or 3 seeds revolve_prompt(prompt, walk_steps=walk_steps, seed=seed, seed2=seed2) horses circular walk Click to play horses circular walk animation
  • Multiple variations over a prompt prompt_variations(prompt, variations=8)
  • Gradual interpolation between variations variate_prompt(prompt=prompt, seed=seed, seed2=seed2, var_steps=6) Terminator on a vespa

Inspiration

A walk through latent space with Stable Diffusion

About

Code for the Exploration of Stable Diffusion spaces (prompt embedding and random latent spaces) via torch

Resources

License

Stars

Watchers

Forks

Packages

No packages published