Giter Site home page Giter Site logo

Comments (2)

victorchall avatar victorchall commented on May 24, 2024 4

Someone linked you were looking for help, can provide some insights perhaps.

You can cache the latents of your training images ahead of time to disk or sys ram, but the VAE isn't that large either. Caching too much to sys ram can run your sys ram usage up a lot. I purposely do not cache latents in EveryDream because it breaks crop jitter, but if your absolute goal is minimum vram use it makes sense. Caching them to disk is the safest, save as .pt (torch tensors) and read on the fly, maybe a hash dictionary of the filename and tensor. Keep in mind creating the cache ahead will take some time for larger datasets, depends on your goals.

I've found text encoder training makes a big difference when doing normal unfrozen unet training. Not sure if you intend to unfreeze text encoder, but if not, you could cache the embedding outputs of the text encoder as well. tokenize them, encode them, then cache those values same as above. Obviously means you cannot train the text encoder at all.

Extra flag in your zero_grad (optimizer.zero_grad(set_to_none=True)) will save a small amount of vram assuming you're on a new enough version of Torch.

from controlnet.

geroldmeisinger avatar geroldmeisinger commented on May 24, 2024 1

HuggingFace Diffusers ControlNet training script https://huggingface.co/docs/diffusers/training/controlnet uses different performance optimizations
min 8GB on Linux with DeepSpeed (which is only available on Linux right now), and 12GB on Windows

from controlnet.

Related Issues (20)

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.