Getting SD v2 running in Stable Diffusion UIs (specifically Stable-Diffusion-UI by github user cmdr2)

#9
by Fodellm - opened

Greetings,

 Big fan of the work you all are doing, and the community that's developing around Stable Diffusion!

I was THRILLED to discover that v2 of the .ckpt had come out, so I downloaded it & stuck it in my stable-diffusion models directory (within the directory for the aforementioned UI, which I've come to really love) the same way I did with other previous models, such as when updating from v1.4 to v1.5... Only to find that it didn't work.

This wasn't a huge surprise, v2 being hosted in an entirely different repository, having different .yaml files & other components to consider besides the model .ckpt itself. But I'm hoping that it's as simple as sticking a couple of those other such files into the appropriate directories to get it generating images with v2.

So:

  1. Is this the case? If so, which files are necessary and where should they be installed in the UI directory?

  2. What do I need to do to get it up and running on the new model?

    I'd really rather not have to downgrade to using cmd line/Python and putting in a million arguments by hand for each batch if I don't have to, when I already set up two different GUIs and they work so splendidly (at least with v1.5 and 1.4). I'm psyched to try out the new model, and I'm sure many others are in the same boat, so I thought it was worth asking about here.

Thanks for any assistance!

There is a guide on YouTube by Nerdy Rodent on how to install this locally.
https://www.youtube.com/watch?v=rN8D0pQJ7SY

This is a bit easier to explain if you speak a little python, but I can try...
the ckpt files are not code or bits of images, they are a frozen state of objects in a running bit of software. python, like all object oriented languages, has during runtime lots of "objects" it manages in memory. In this case those objects are nodes in a huge array of ML. in very very oversimplified terms, you know those boxes with staggered pegs that you drop a ball at the top and see where it lands on the bottom, and each time it lands in a different place? ML is kind of like that, but the software ingests images and then fine tunes the pegs so the balls fall where you want them. some pegs need to be larger or smaller or square or triangular or tilted, etc. Once this box of altered pegs gives you good results you freeze it and put it on the website.

now back to computer terms: you have objects, they are tiny areas of memory with numbers representing the fine tuned numbers we arrived at, and they can now be written into a file. it could be as wasteful as XML, JSON or YAML, or they can be dumped in a more compressed form like a python pickle. now anyone with the same version of python and the pickle library can import that file and hey-presto you have the objects in memory again. you can keep training it and dump it again, or you can run prompts through it (again, I am over-simplifying it here, not getting into GAN and stuff). However if you have a different version of python the format could change. if you have a new version of the software and now each node object has 12 parameters instead of 8 or 10, the pickled data is kind of meaningless. you have to retrain. you can't read the content of the old object into the code of the new object because they are most probably not compatible.

so unless Stability adds some special code to allow backward compatibility (which is painful and makes no practical sense in development time) it just won't happen. new versions that break the object definition will inevitably come with new pickles. you can also see it's almost 50% bigger. meaning more nodes of fatter nodes, because more features or higher accuracy.

There is already a rudimentary implementation for automatic1111, check the github.
Aparently there is also a workaround to make the 512 inpainting model work with it, have to look in the SD reddit for that

The cmdr2 version now has a SD2.0 beta version. You can check the git or Discord for more details.

Sign up or log in to comment