Code Monkey home page Code Monkey logo

scal-sdt's Introduction

SCAL-SDT

Stable Diffusion trainer with scalable dataset size and hardware usage.

[!] IN EARLY DEVELOPMENT, CONFIGS AND ARGUMENTS SUBJECT TO BREAKING CHANGES

Features

  • Can run with 10G or less VRAM without losing speed thanks to xformers memory efficient attention and int8 optimizers.
  • Aspect Ratio Bucketing
  • DreamBooth
  • CLIP skip
  • WandB logging

Getting Started

Install Requirements

Linux is recommended. (If you care to install bitsandbytes on Windows)

Python 3.10. Will not work on 3.7.
Torch 1.13 and CUDA 11.6. Match exact version is recommended but not required.

xformers is required for efficient VRAM usage. Easiest way to install it is conda install -c "xformers/label/dev" xformers.

WandB (pip install wandb) is recommended for logging stats and previews.

pip install -r requirements.txt

Config

Documentation: configs/README.md. (Link)

configs/native.yaml (for native training) and configs/dreambooth.yaml (for DreamBooth) provided as examples.

Then?

If you are running native training, proceed to the next step.
If you are running DreamBooth, run this to generate class (regularization) images:

python gen_class_imgs.py --config configs/your_config.yaml

Then run the training:

python train.py --config configs/your_config.yaml

Note although the checkpoints have .ckpt extension, they are NOT directly usable to interfaces based on the official SD code base like WebUI. To convert them into SD checkpoints:

python convert_to_sd.py PATH_TO_THE_CKPT OUTPUTDIR --no-text-encoder --unet-dtype fp16

--no-text-encoder --unet-dtype fp16 results a ~2GB checkpoint, containing fp16 UNet and fp32 VAE weights, WebUI supports loading that. For further reducing checkpoint size to ~1.6GB if target clients have external VAE already, add --no-vae to remove VAE weights from checkpoint, leaving fp16 UNet weights only.

If you are not using WebUI and having issues, remove --no-text-encoder.

TPUs or other computing units?

You may change trainer.accelerator. (Docs)

Advanced

Check out the wiki. Contains some information for training efficiently.

scal-sdt's People

Contributors

ccrcmcpe avatar

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.