All4Gis / dream-factory

Multi-threaded GUI manager for mass creation of AI-generated art with support for multiple GPUs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dream Factory

Multi-threaded GUI manager for mass creation of AI-generated art with support for multiple GPUs.

This is aimed at the user that wants to create a lot of AI artwork with minimal hands-on time. If you're looking for a repo that will allow you to spend hours tweaking a single image until it's perfect, there are better options. If you have hundreds of prompt ideas and want to easily and quickly (well, as quickly as your GPUs can manage!) see them rendered in hundreds of different variations and/or styles, then this is for you.

To illustrate, I've had an RTX 3060, RTX 3080Ti, and Tesla M40 running Dream Factory 24/7 for a couple weeks now, and they churn out roughly 5,000 images every day! Some samples (all straight out of Dream Factory other than some minor sharpening applied in Photoshop):

sample image 1 sample image 2 sample image 3 sample image 4
sample image 5 sample image 6 sample image 7 sample image 8
sample image 9 sample image 10 sample image 11 sample image 12

Some UI screenshots:

UI: status monitor UI: prompt editor UI: gallery UI: image viewer

Features

  • Based on Stable Diffusion, with an optional low-VRAM mode to enable support for GPUs with as little as 3GB of VRAM.
  • Multi-threaded engine capable of simultaneous management of multiple GPUs.
  • Powerful custom prompt file format that allows you to easily define compound prompt templates. Want to quickly create thousands of prompts from a template like "photo of a [adjective(s)] [animal] as a [profession], art by [artist(s)], [keyword(s)]" where each bracketed section needs to be filled in with dozens (or hundreds) of different items? No problem. Maybe you want your GPUs to create every possible combination, or maybe you want combinations to be picked randomly? Your choice. Maybe you want some items to be handled with different settings? Totally doable. Prompt files can be as complex or simple as you want — you can simply paste in a list of stand-alone prompts and go, too!
  • All prompt and creation settings are automatically embedded into output images as EXIF metadata (including the random seed used). Never wonder how you created an image again!
  • Easy web interface. Includes a built-in prompt file editor with context-sensitive highlighting, a gallery that displays your prompts and creation settings alongside your images, and at-a-glance information about the status of completed/ongoing work. Hate web interfaces? Turn it off via a configuration file — Dream Factory can be run completely via the command line if that's your thing!
  • Remote management. Access and fully manage your Dream Factory installation from anywhere (and easily download your created images in bulk as .zip files!). Can be configured to be accessible via LAN, WAN (internet), or just locally on the computer that Dream Factory is running on. Includes very basic HTTP-based authentication for WAN access.
  • Integrated optional ESRGAN upscaling with GFPGAN face correction.
  • Easy setup. If you can download a file and copy & paste 6 lines (see below), you can get this working. Uses Anaconda so Dream Factory will happily run alongside other Stable Diffusion repos without disturbing them.

Requirements

You'll need at least one Nvidia GPU, preferably with a decent amount of VRAM. 3GB of VRAM should be enough to produce 512x512 images, but more GPU memory will allow you to create larger images (and/or create them faster).

Setup

These instructions were tested on several Windows 10 desktops with a variety of modern Nvidia GPUs ranging from 8-12GB VRAM, and also on an Ubuntu Server 20.04.3 system with an old Nvidia Tesla M40 GPU (24GB VRAM).

[1] Install Anaconda, open the root terminal, and create a new environment (and activate it):

conda create --name dream-factory python=3.9
conda activate dream-factory

[2] Install a couple required Python packages:

conda install -c anaconda git urllib3

[3] Clone this repository and switch to its directory:

git clone https://github.com/rbbrdckybk/dream-factory
cd dream-factory

[4] Run the included setup script to finish the rest of your installation automatically:

python setup.py

[5] Download the Stable Diffusion pre-trained checkpoint file:

  • First register here (only requires email and name)
  • Then download the v1.4 checkpoint file (or browse here for a newer checkpoint file)
  • After downloading the checkpoint file, you'll need to rename it to model.ckpt and place it into the following directory:
\stable-diffusion\models\ldm\stable-diffusion-v1

This directory is located off the main dream-factory folder that you ran the setup script from in the previous step.

You're done! You can perform a test to make sure everything is working by running this (again, from the main dream-factory folder):

python dream-factory.py --prompt_file prompts/example-standard.prompts

This should start up the web interface with a simple example prompt file pre-loaded that your GPU(s) should start working on automatically. On the first run, several large files (~2GB total) will be downloaded automatically so it may take a few minutes before things start happening.

Eventually you should see images appearing in your \output folder (or you can click on the "Gallery" link within the web UI and watch for them there). If you're getting images, everything is working properly and you can move on to the next section.

If you're on Windows and see these errors appearing in the console:

OSError: Windows requires Developer Mode to be activated, or to run Python as an administrator, in order to create symlinks.

You'll need to enable developer mode to get things working. I tested installations on several different Windows desktops, and only one gave me this error. Not sure what causes it, but enabling developer mode fixed it for me.

Usage

Full instructions coming soon. Quick version:

After installation, open config.txt and make any desired edits.

Start Dream Factory with:

python dream-factory.py

The web UI should open automatically, if not go to http://localhost:8080 (assuming you didn't change the port in config.txt) via your browser.

Browse to 'Control Panel' in the top nav and select one of the two example prompt files via the dropdown. Your GPU(s) should immediately start working on whichever one you choose. If you browse to 'Gallery' in the top nav you'll see images appearing as they're completed.

To create your own prompt files, browse to 'Prompt Editor' in the top nav and open one of the example files and read through the comments to see how they work. Experiment with creating your own via one of the 'New ...' buttons at the top of the page. To execute your new prompt file, go back to 'Control Panel' and select it from the drop down.

You can update Dream Factory to the latest version by typing:

python setup.py --update

About

Multi-threaded GUI manager for mass creation of AI-generated art with support for multiple GPUs.

License:MIT License


Languages

Language:Python 54.6%Language:CSS 22.4%Language:HTML 22.3%Language:JavaScript 0.7%