GithubHelp home page GithubHelp logo

beinsezii / quickdif Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 1.81 MB

Quick and easy Diffusers CLI

License: GNU General Public License v3.0

Python 99.90% Shell 0.10%
cli diffusers image-generation kandinsky linux pytorch stable-diffusion text2image txt2img wuerstchen stable-cascade

quickdif's Introduction

quickdif

Quick and easy CLI inference that just works™ for a variety of Diffusers models

Including

  • Verified working with Stable Diffusion (1.5/2.1/XL Base), Stable Cascade/Wuerstchen, Kandinsky22, Pixart
  • Supports many common settings found in GUIs
  • Iterate over parameters like prompt or CFG
  • Expand prompts with photo of {all|of|these} or photo of [one|of|these]
  • Some more advanced tweaks like multi-Lora, colored latents, and variance masks
  • Extremely small 1-shot script using accelerate for hot loading models
  • Load settings from JSON, TOML, PNG

Not Including

  • ControlNet + other Stable Diffusion extensions
  • Other diffusion models may or may not work properly
  • Multi-stage models: DFIF Stage 2, SDXL Refiner
  • Server/API for a perpetual instance
  • Output as grid
  • 100% maximum optimization
  • 1-click installer

Installation

You must have a recent Python version installed, at least 3.11+.

In essence you just need to install the pip packages from requirements.txt to your environment of choice, then you can run the quickdif script

Basic setup

> git clone https://github.com/Beinsezii/quickdif.git
> cd ./quickdif/

Create a venv in the quickdif folder

> python3 -m venv ./venv
# alternatively, it's recommended to use the full virtualenv if you have it
> virtualenv ./venv

Install dependencies

# replace with appropriate activation script for other shells
> source ./venv/bin/activate
# It's recommended to first install torch using the recommended commands from https://pytorch.org/get-started/locally/
> pip3 install torch --index-url https://download.pytorch.org/whl/rocm5.6 # AMD example
# finally
> pip3 install -Ur ./requirements.txt
> deactivate

Run quickdif

# See all options. Always refer to the script help over the other examples in this README
> ./quickdif.sh --help

# Run with defaults
> ./quickdif.sh "high resolution dslr photograph of pink roses in the misty rain"
# Custom model
> ./quickdif.sh -m "ptx0/terminus-xl-gamma-v1" "analogue photograph of a kitteon on the beach in golden hour sun rays"
# Single files work for Stable Diffusion
> ./quickdif.sh -m ./checkpoints/sd15/dreamshaper-v6.safetensors "colorful fantasy artwork side profile of a feminine robot in a dark cyberpunk city"
# Four dog and four cat images at twenty steps
> ./quickdif.sh "photo of a dog" "painting of a cat" -B 4 -s 20
# Colored latent for an offset noise effect
> ./quickdif.sh "underwater photograph of a dark cave full of bioluminescent glowing mushrooms" -g 9.0 -s 30 -C black -c 0.8
# Compile for a long job
> ./quickdif.sh $(cat prompts.txt) --compile
# Export favorite settings to the defaults JSON
> ./quickdif.sh -m "stabilityai/stable-cascade" -s 20 -n "blurry, noisy, cropped" --json ./quickdif.json
# Save a style to a custom JSON
> ./quickdif.sh "fantasy artwork of a kitten wearing gothic plate armor" -g 10 -G 0.5 --json ./epic_kitten.json
# Merge multiple configs
> ./quickdif.sh -I underwater_cave.png epic_kitten.json

F.A.Q.

Question Answer
Why not X popular UI? SD.Next's diffusers backend is extremely buggy/broken in multiple areas and InvokeAI (+non-diffusers UIs) only really supports Stable Diffusion.
Windows? The python script should work just fine but you'll need to set up the powershell/CMD stuff on your own.
Gradio? No. If a UI ever gets made for this it'll be its own separate entity that interfaces via API. Cramming a bad gradio interface into the main script wont do anyone any favors
Feature XYZ? Maybe. Things in the Not Including list may come eventually™ if this script winds up being useful enough

quickdif's People

Contributors

beinsezii avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

silentpatrik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.