Using the Stable Diffusion WebUi

Using the Stable Diffusion WebUi

Installing Stable Diffusion is one thing using the Stable Diffusion WebUI to create decent checkpoints, and understanding the different weights and measures, sampling sets, and prompts is where the real magic (and frustration) happen.

Why Stable Diffusion?

Recently I wrote an article for my employer allcode.com on how to set up Stable Diffusion and use Dreambooth to train models based on your own images to personalise the outputs, thus allowing you to create artistic renditions of yourself with various prompts.

The critical element is that it can run on a local gaming PC (although you do have to train the models on a pay-on-demand server). I highly recommend you read that article if you are interested in how to set up the various systems.

A long, long time ago, I used to love art; painting, drawing, and sculpting were really enjoyable for me. But sadly, over the years, I’ve let the meagre skills I had atrophy and now trying to return to square one is just disheartening.

So I’m finding this fusion between coding, AI, writing and art really fascinating. I see a lot of artists complaining about AI art (and with good reason). I’m definitely finding people selling AI art really dubious and troubling. That said, it’s here, it’s not going away, and as I’ll show throughout these blog posts, it is not so easy. I can see it being a great tool for artists and a problem in years to come.

 

AI generated image of me as legolas

What’s the plan

Over a series of posts, I’m going to write up what all the parts of the Stable Diffusion WebUI interface do, what they mean and how they relate back to things like Dreambooth and training your own models. I’ll include a little about configs for training models and probably show how changes to the training affected the outputs. 

 

What won’t be covered

I’m not going to explain all the various installs, libraries, variations and forks of Stable Diffusion, nor am I going to compare the outputs to other AI art creators like Midsummer etc. I’m also not going to answer questions on how to resolve code breakages that happen, unless I happen to experience one while writing.  

Maybe when I’ve finished playing with Stable Diffusion, I’ll look at others in the future.

 

jamestyrrell as a Warhammer 40k Space Marine SD, Dreambooth

The WebUI homepage

Today I’ve set the scene for what I hope to create so for now I’m just going to give a high overview of the various tabs and what they do.

Holy sh*t, there are a lot of options here

If you’ve followed my tutorial at allcode.com, you’ve already installed Stable Diffusion, run your personalised images through Dreambooth and are ready to get down to business. The first thing you see when you open the WebUI is a lot of options that aside from the prompt option will make little sense. Not to even mention that this is tab 1 of 8.

WebUI screen shot

txt2img

This is probably the most recognizable tab, as it is the key point of popularity for the Stable Diffusion craze. It’s where you type in prompts (both negative and positive) and generate images. On a default install of Stable Diffusion you can still get access to the massive wealth of information on artists, celebrities and politicians when creating these prompts. However, do remember to complete the Dreambooth training if you want to personalise any generated images. 

img2img

Image to image AI art generation (img2img) uses the same principle as that of txt2img above. Users still enter in prompts for the AI. The main difference between these two is that a base image is included into the scenario

Users upload a base photo where the AI applies changes based on entered prompts. Continuous iteration of this process creates refined and sophisticated art.

Extras

In this section you have the ability to upscale your produced images to bigger sizes, all sizes are usually produced as 512×512 and other tools to improve the on images that you like but feel need work

  • GFPGAN, neural network that fixes faces
  • CodeFormer, face restoration tool as an alternative to GFPGAN
  • RealESRGAN, neural network upscaler
  • ESRGAN, neural network upscaler with a lot of third party models
  • SwinIR and Swin2SR neural network upscalers
  • LDSR, Latent diffusion super resolution upscaling

PNG info

If you have an image generated by Simple-Diffusion it should includes all the details of the prompt, negative prompts, seed, model and other information used to generate it. So rather than trying to rememver a prompt that you liked you can find the produced image and drag-and-drop the image onto the PNG info tab you will recover all the info and then send it to other areas of the WebUI

Checkpoint Merger

Combine and blend different checkpoints and models. 

Train

If you have a monster of a machine with 24Gb of VRAM on your GPU you can train your models locally, normally trying will just make the system crash and laugh at you. If you want you there is a “Dreambooth extension” which can be found in the Extensions tab described below which can help lower powered systems train but otherwise you’re better off training models on a service like https://www.runpod.io/ until either the systems get smarter (less GPU required) or the graphics cards get cheaper.  

Settings

The settings tab for Stable Diffusion WebUI allows you to customize the various options and preferences. The options and preferences available include things like the color scheme, where output images are stored, and the way that the program interacts with other programs or devices. In general, the settings tab is where you can fine-tune the way that the Stable Diffusion WebUI works to suit your needs and preferences.

Extensions

An extension is a small software program that can be installed in the Stable-Diffusion WebUI to add or modify the functionality. Extensions can be used to add features to the WebUI, such as a new tab, or to modify the behavior of Stable Diffusion, such as reducing the load for Dreambooth or blocking certain websites. Extensions can be installed and updated from this tab, and once installed, they can be turned on or off as required.

Advice from Stephen King

Advice from Stephen King

Here’s a list of some advice from the master of horror himself Stephen King. He writes like a machine. Definitely, someone to listen to. It all comes down to one thing though, write, write and write some more. Practice makes perfect and I really need to practice harder.

If you don’t succeed, get a bigger nail.

This advice comes from the huge number of rejection letters that Stephen King got, the idea was he had so many pinned on a nail in his wall that eventually it fell loose. So he got a bigger nail and kept going. 

Write 6 pages a day.

In his autobiography, Stephen King says something similar he also says he will “permit” a starting writer to start with a mere 1000 words a day. I think this is worth trying but man I bet George R. R. Martin would have apoplexy if he got told this. 

Go where the story takes you. 

As a self-proclaimed pantser this is very Stephen King. He doesn’t believe in plotting everything. There’s no way to be sure which I should do, but I have found planning very hard. Perhaps I should just write.  

The good ideas will stick with you.

Seems like good advice. If you write 6 pages of content every day, there are sure to be good ideas that you can file away for later. 

First, you read and copy other writers, then little by little you develop your style

I’m trying this with good dialogue, literally copying out conversations that I loved. It’s also true that I can hear when the language becomes too much. Writing dialogue is really hard. 

Writing is self-hypnosis, you need to have a routine. 

Christ, I need a routine in everything. My life is a mess. I have no good sleep or waking pattern. I need a new flat, with at least doors. I need a space where I can write and be on my own occasionally. 

Start with short stories and let them develop into novels or screenplays.

Okay, good news. This I can do. Hell, this I want to do, I am more interested in finding out that there are no large websites for short story collaboration, etc. There is https://theshortstory.co.uk/ but it has more broken links and doesn’t seem to work

Learn to write for different mediums. 

I think I’ll start by getting good at just writing in the first place. 

Look for ideas that you would really enjoy writing for longer periods. 

This all comes back to me needing to write more and more and find what I enjoy. I wrote a lot of stuff that never gets put out there. 

Get immersed in your writing process until the outside world is gone. 

Easy to say, hard to do in a single room flat where I work, sleep, eat and cook.

How to find your passion? Or Not…

There seems to be an obsessive refrain on the Internet these days that you have to find your passion, DWYL (Do What You Love), find your purpose, be in your element. With everyone apparently having the capacity to be rich, happy and fulfilled if you can just do find your personal sweet spot.

This sounds, to many of us, fantastic. I know I would greatly appreciate a sense of flow in everything I do, a purpose to my life, a passion that kept me focussed on a particular aim in the future.

I am also pretty sure that the excessive claims of many book writers and pundits are somewhat fanciful. Having said that, I can admit that they are correct, in so much as that if you can find your passion/element/purpose you can, if determined and persevering enough, turn it into a career. That’s not to say that I believe that all those passions can be turned into a fantastic million dollar money trees but I think they can turn into an important part of your life that means you can live while  doing what you love rather than wasting your time doing something you hate. What more can you ask from life?

Some people are even more sceptical about the “passion” industry Goals are for Losers. Passion is Overrated I have to say I have a lot of sympathy to what Scott says.  Passion is, by itself, not enough, lots of people are passionate and fail, lots of business have a good idea and collapse in ruin. There is a heavy dose of perseverance and as he puts it, investment in systems, that are required for success. But let’s go a step further than that, what if passion is really important, but there’s a big problem …

What if I don’t even have a passion?!

Worse than the potential overly optimistic yodelling of the successful few is a nagging fact, I’m not even sure I  have a passion for something, that’s not to say I don’t enjoy things, I love my job, I love a lot of activities but they don’t really constitute the overriding passion that seems to be necessary to call them something that drives my life.

More to the point  I don’t think I’m alone in this regard, many people say the same thing, there’s a whole set of questions on quora.com asking exactly that question. It is a question blossoming on all our entrepreneurial  lips, “how can I find my passion / element / positive synonym”. Are we the dysfunctional few, do we have a hole in our heads or heart where our passion should be? What kind of people are we, how can we achieve all this greatness promised to us when we are missing such a fundamentally important component.

Seek and ye shall find

The current way of thinking seems to be that we must find and try out every possible experience to  something that ignites our passion whether it be cooking or SCUBA diving, cycle touring or zoology, brainstorming, talking to people, searching the internet, thinking of what we dream and have dreamt of and more. It’s like we have to blindly sniff out from the world around us what we find entrancing and captivating. Don’t get me wrong, I appreciate this activity, and there is nothing wrong with, trying everything available to us in life, it is not only fascinating but it gives us the chance to really experience life rather than let it slide past.

But it is only recently that I have come to an slow realisation that our ‘passion’ might not really be what we are searching for. Or rather our passion might not be as simple as an activity that we can undertake. In Daniel Priestley’s book Entrepreneur revolution he talks about passion a lot but he gets it slightly closer by saying that it is hard to articulate and not just an activity.

[youtube]https://www.youtube.com/watch?v=NsxBFrdOVEQ[/youtube]

“so that the real frustration people have is that they’re expecting passion to hit them like it’s this clarity or clear bolt of lightning, or this hundred percent sentence that says ‘Oh, now I’ve discovered my passion’.”  – Daniel Priestley (2013)

In Simon Sinek’s book Start with why I think he made an important distinction for businesses and individuals when he said you have to start with why and that the outputs in our life or business are merely different ways we manifest our inner belief or purpose.

[youtube]qp0HIF3SfI4[/youtube]

But very, very few people or organizations know why they do what they do. And by “why” I don’t mean “to make a profit.” That’s a result. It’s always a result. By “why,” I mean: What’s your purpose? What’s your cause? What’s your belief? Why does your organization exist? Why do you get out of bed in the morning? And why should anyone care?” – Simon Sinek (2009)

I think both writers have the same idea, articulated differently, furthermore, it explains why people like me are finding it difficult to find the activity we are passionate about, because we’re framing it all wrong. It’s not right for us to ask “What is my passion?” but we should rather be asking “What is it that makes me do the things I enjoy?”

It’s not what we do, it’s what motivates us

I think this is so key, that I’m going to reiterate it. People undertaking a quest to discover their particular ‘passion’ are, for the most part, asking it in the wrong way. All our activities, all the things that make us get up in the morning, are just the whats and hows for our personal why.

People are searching for passion in the activities that we perform or hobbies that we enjoy. We get disheartened when something we like doesn’t constitute the all consuming passion that we think should be there. We are thinking as Daniel Priestley stated above, that there should be one clear and concise answer to a very complicated question.

We are looking for a simple answer, there are no simple answers for something as important as your life purpose. If it were so simple we wouldn’t need to search for it.

So why the confusion? I think partly it’s semantics, people who are successful have usually found a way to turn their purpose into a tangible activity that produces money. Some people point to artists, dancers and musicians who have found their element.  I can’t deny these people have achieved considerable success in what they do. I think though that these creative or business outlets are only part of the picture.

Many successful people are lucky enough to be passionate about a very particular activity, Olympians, world class magicians, Nobel prize winners, business men and women know why they get up in the morning, because they love what they do. It’s their raison d’être it’s not only their why but fortunately for them it’s a very clear activity as well. If you really are passionate about a hobby or activity it’s likely you already know it and do it every moment that you aren’t working already.

So where do we go from here?

I’m on a mission to find my purpose, my why, the reason I get up in the morning, not just some activities I enjoy but the reason behind the activities.

So for the next few weeks I’ll find methods, exercises and methods to help discover those things, post them here along with my review as to how they worked.

If you know of any methods to find your purpose or passion which focus on the why and NOT the activities let me know in the comments below and I promise I’ll try them out too :).