Coder Social home page Coder Social logo

Comments (7)

zwishenzug avatar zwishenzug commented on July 18, 2024 4

You can try this, edit the txt2img.py script.

Look for this code:

def load_model_from_config(config, ckpt, verbose=False):
    print(f"Loading model from {ckpt}")
    pl_sd = torch.load(ckpt, map_location="cpu")
    if "global_step" in pl_sd:

Change it to:

def load_model_from_config(config, ckpt, verbose=False):
    print(f"Loading model from {ckpt}")
    pl_sd = torch.load(ckpt, map_location="cuda")
    if "global_step" in pl_sd:

The difference here is "cuda" instead of "cpu". This will load the model directly to the GPU (vram) instead of loading it to the CPU (system ram) first.

This should reduce the system ram requirement.

from stablediffusion.

woctezuma avatar woctezuma commented on July 18, 2024 1

Not enough RAM, I believe.

from stablediffusion.

sliard avatar sliard commented on July 18, 2024 1

Yes, same error when I used a T4 16Go on GCP.
Same command on a A100 40Go run well.

from stablediffusion.

andypsu5155 avatar andypsu5155 commented on July 18, 2024 1

Thanks for the update! I ordered more RAM for my computer, and I'm hoping once I get it installed it will work for me!

from stablediffusion.

xiankgx avatar xiankgx commented on July 18, 2024

Yeah, seems like need more than 16GB of RAM. A system with 32 GB runs fine.

from stablediffusion.

andypsu5155 avatar andypsu5155 commented on July 18, 2024

Can you confirm if adding RAM solved the issue for you? I also have 16gbs of RAM, and a RTX 3090 and it keeps killing the process

from stablediffusion.

xiankgx avatar xiankgx commented on July 18, 2024

Can you confirm if adding RAM solved the issue for you? I also have 16gbs of RAM, and a RTX 3090 and it keeps killing the process

I can confirm this. I used AWS EC2 and changing to the next step higher instance type with more RAM (16->32) solved the issue. Or you can apply the modifications above, since not moving model weights to CPU first and directly to CUDA directly would also help with the issue.

from stablediffusion.

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.