Live data from Hacker News

Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

constant.meiring.nz

101–110 of 141 posts

Re: Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

#103
I've been running Stable Diffusion on my M1 Macbook since the thread a few days ago about doing just that.

I am comically bad at getting it to generate what I want. e.g. "A furry watermelon" or "A dog flexing its biceps" just generates normal watermelons and normal dogs most of the time.

Any tips?

Re: Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

#104
post #33

Earlier quoted context omitted.

Google is paying, and yes, you can, but they will disconnect you after a while. And if you abuse it too much, you won't be able to use it until the following day... You can also buy Colab Pro and Colab Pro+, which have fewer limitations and faster GPUs.

How fast is the Colab stuff? Is Colab Pro/Pro+ a lot faster too? I run it locally and can generate images with 50 steps in about 6 seconds per image, would it be faster for me to use Colab Free/Pro/Pro+?

I'm on Colab Pro and get about 3 steps per second when generating a single 512x512 image at a time, with slight throughput improvement when I batch 2-3 images

Re: Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

#105
Not an Apple guy, but I think an Apple M chip will run at ⅓ the speed of a top end RTX GPU, however it uses system memory, so it can easily be 32GB or 64Gb. That's pretty compelling, and if this is really a new class of application, NVidia is going to have to think about more memory for mainstream-ish products.

Re: Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

#106
post #102

I’ll get downvoted, but it’s a genuine question: Will “a photo of tits and ass” generate photos of birds with donkeys, or will it rickroll you [0]? [0] https://twitter.com/qDot/status/1565076751465648128

Depends on if you are running stable diffusion with the safety filter on or not.

By default it's on, some forks have it turned off.

Re: Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

#107

anyone know how to get conda running on arch linux? `conda init bash` gives me some Python errors.

Yeah, I don't think that's an Arch Linux problem. I had similar problems on Windows, and one version of the project even was supposedly setup to run in Docker. What is the point of setting up Docker if the whole setup and build process is not turnkey?

Seems like all of these projects are broken until you speak shibboleth by guessing at random python incantations. By this point, it's starting to feel intentional, like a way to mark you as part of an in-crowd, not a "L-User".

Unfortunately, I don't remember what I did. I did eventually get SD to work (though not in Docker, just as a normal python project). If I had been sober at the time, I probably would have given up. I know you need no greater than Python 3.9.

Re: Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

#108
post #102

I’ll get downvoted, but it’s a genuine question: Will “a photo of tits and ass” generate photos of birds with donkeys, or will it rickroll you [0]? [0] https://twitter.com/qDot/status/1565076751465648128

As I understand it, SD was trained on this dataset:

https://rom1504.github.io/clip-retrieval/?back=https%3A%2F%2...

So go here, turn off the safety filter and you can search to see what SD was trained on. I suspect that if you actually want the bush tit bird and donkeys, you'll want to use that instead.

Re: Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

#109
post #73

Earlier quoted context omitted.

Recommendations: - Linux w/ Display drivers on CPU (and just...ditch miniconda please) - Use lower FP precision mode if available to use the tensor cores (also to double "effective" memory) - Batch things! - I don't know what the max resolution of the diffusion network is, you may have to just simply tile it past a certain point (with overlap please! ;P Hope that helps somewhat. A 3090 should be more than enough for…

I totally disagree with ditching miniconda. The Colab notebooks that make use of it have been super easy to run and modify. There is documentation everywhere and its very easy to find on SO, and Google. Its a joy to use and really like it for all of my Python workloads. I think of it like a Python VM that just works where ever I place it... so far, haven't been let down.

Miniconda is a pain as it introduces it's own package build format that (IMHO) just isn't very good. It might have been an improvement on python's binary packages when it was released, but now days the conda package format creates more problems than it solves.

>I think of it like a Python VM that just works where ever I place it.

That's called a virtualenv, which is a feature built into python. Miniconda is a thin wrapper around virtualenv (actual python packages) and the conda package format. If you're using an IDE it probably has virtualenv support baked in.

Personally I prefer to use python-poetry for managing virtual envs, but honestly just using the virtualenv command directly is not hard if you're already using conda from the CLI.

Re: Running Stable Diffusion on Your GPU with Less Than 10Gb of VRAM

#110
post #28

Earlier quoted context omitted.

For training you can often divide the batch size by n (and then only apply the backprop gradient stuff after each n batches for it to be mathematically equivalent). At a cost of speed, though.

Do libraries like torch and tensorflow facilitate this?

Quite trivial to implement this yourself if you want to. See gradient accumulation in fastai for instance https://www.kaggle.com/code/jhoward/scaling-up-road-to-the-t...
Post reply on HN