gbtb / nix-stable-diffusion

Flake for running SD on NixOS
113 stars 21 forks source link

Nvidia support #1

Closed ProducerMatt closed 2 years ago

ProducerMatt commented 2 years ago

I have an Nvidia GPU, if you put up an Nvidia branch I'd happily test it for you. In the meantime I'll take a jab at converting it myself, but I've never worked with a flake like this before so idk how far I'll get on it.

gbtb commented 2 years ago

Hello.

On a first glance it seems that it is only required to override torch with cudaSupport=true. Here is draft PR - https://github.com/gbtb/nix-stable-diffusion/pull/2. I've made two variants, with and without mkl - nix develop .#invokeai-nvidia-mkl and nix develop .#invokeai-nvidia. Unfortunately, I can't confirm that this shells even build, because of some timeout errors when downloading magma (probably my ISP is messing it up). But you can try it nevertheless :smiley:

ProducerMatt commented 2 years ago

Wow, it worked first try! Thank you :)

gbtb commented 2 years ago

Great! Btw, which one of the devshells worked for you - with or without mkl?

ProducerMatt commented 2 years ago

Both of them appear to work! But what does MKL change?

gbtb commented 2 years ago

Both of them appear to work! But what does MKL change?

It changes blas implementation, it appears there is a bug in opencv4 that causes conflict of two incompatible blas versions. On my machine invokeai works only if I replace blas in opencv4 with different provider.

Thank you for the testing! I will clean up my PR a little bit and merge into master.

gbtb commented 2 years ago

PR merged, slightly changed shell name - nix develop .#invokeai.nvidia