{"id":1278,"date":"2023-08-28T12:18:36","date_gmt":"2023-08-28T19:18:36","guid":{"rendered":"https:\/\/letsbuildroboticswithshadow8472.com\/?p=1278"},"modified":"2023-08-28T12:18:36","modified_gmt":"2023-08-28T19:18:36","slug":"happy-birthday-stable-diffusion","status":"publish","type":"post","link":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2023\/08\/28\/happy-birthday-stable-diffusion\/","title":{"rendered":"Happy Birthday Stable Diffusion!"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Good Morning from my Robotics Lab! This is Shadow_8472 and today I am spending a week with Stable Diffusion to improve my skills at it. Let\u2019s get started!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The science of AI art goes back to around the time complete CPU\u2019s were first integrated into a single computer chip in the late 60\u2019s\/early 70\u2019s. At least a couple waves of AI craze came and went, but on August 22, 2022, Stable Diffusion was released as free and open source software.<br><br>In the year since, Stable Diffusion has proven to be quite the disruptive technology. I\u2019ve never had the cash to commission an online artist, but with a little effort, a decent amount of patience, and only an ounce of experience, I\u2019ve gotten subjectively better results than commissioned works posted by low-end digital artists. I feel sorry for the people losing their dream jobs to machines, but at the same time this is a frontier I can have fun exploring.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">One Week of Study<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019m setting myself a goal of spending two hours dedicated to learning Stable Diffusion every day this week. We\u2019ll see what happens.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Monday <\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">We won\u2019t talk about what didn\u2019t happen on Monday.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Tuesday <\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">I finally started researching for this topic after midnight. I started up Easy Diffusion, an intuitive webUI for Stable Diffusion, generated a number of images with a project for my sister in mind.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I ended up looking up tips and tutorials. Looks like the hot-shot web UI these days is Automatic1111. It has more options, but is proportionally harder to use. I might try it later in the week. Otherwise, most of my time actually working today was writing the introduction.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Wednesday <\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Easy Diffusion is definitely the way to so if all you\u2019re looking to do is goof around, because that is exactly what I did. So far as I can tell, I am at the exact bottom of graphics cards that can do this. I\u2019m finding it of use to go smaller for faster feedback while learning to prompt. Conclusion: img2img has a tendency to muddle things.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Still, the draw of potentially more powerful techniques is calling. I found a piece of software called Stability Matrix, which supports a number of web UI\u2019s \u2013 including Automatic1111, which every Stable Diffusion tutorial out there tends to go after. I ran into trouble with its integrated Python while setting it up (portable, in the end). I\u2019m hoping I can replace it with a later version tomorrow.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Thursday<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">I switched approach from last night and did an online search for my error:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<p class=\"wp-block-paragraph\">Multiple results pointed from people trying Python projects on Arch family systems like the one I\u2019m on. One source from December 2022 recommended a multi-step process involving the AUR. I figured riffling through the project\u2019s GitHub issues was worth a shot \u2013 to report it if nothing else. I searched for \u2018libcrypt.so.1\u2019, and the fix was to install libxcrypt-compat; I found it in the more trusted pacman repository [1].<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p class=\"wp-block-paragraph\">AUR: Arch User Repository<\/p>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">I installed Automatic1111 using Stability Matrix and loaded it up. My first impression when compared to Easy Diffusion: Wall of controls. Easy is easy in both the setup AND the relatively intuitive control scheme, but it seemingly doesn\u2019t support a lot of the tools I\u2019ve seen and want to learn.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Per tradition, I made a photo of an astronaut riding a horse. It was a flop, but I got an image nonetheless. Its immediate followup didn\u2019t finish when I told it to fix faces and I ran out of vRAM memory on my graphics card (to be fair, I didn\u2019t have next to everything closed).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sabbath starts tomorrow, and I\u2019ve been writing these mostly late at night. I can tell I\u2019m not likely to meet my time goal of a couple hours every day, but I feel getting to this step is a major accomplishment. Word count says 700+ words, so I could end it here and feel fine about it. I\u2019ll see what happens. I want to find the control that tells it my graphics card is barely up to this stuff.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Friday<\/h4>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<p class=\"wp-block-paragraph\">Time to start optimizing! For cotext, I\u2019m on an NVIDIA graphics card with 4GB of vRAM, which is enough to get a feel for the software if you have a minute or two of patients per image, but having more would be prudent. After trying a couple online videos, I found AUTOMATIC1111\u2019s GitHub had a list of optimizations [2] I\u2019ll be listing as &#8211;flags to the COMMANDLINE_ARGS variable in my start script. I don\u2019t have time this evening for a full test, but perhaps tomorrow night or Sunday I can do some benchmarking.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p class=\"wp-block-paragraph\">vRAM: Video RAM (Random Access Memory) *So glad to have finally looked this one up!*<\/p>\n<\/div>\n<\/div>\n\n\n\n<pre class=\"wp-block-verse\">xformers<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For NVIDIA cards, we have a library xformers. It speeds up image generation and lowers vRAM usage, but at the cost of consistency, which may not be a bad thing depending on the situation.<\/p>\n\n\n\n<pre class=\"wp-block-verse\">opt-split-attention\/opt-sub-quad-attention\/opt-split-attention-v1<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A \u201cblack magic\u201d optimization that should be automatically handled. I\u2019ll be selecting one via the webUI, though.<\/p>\n\n\n\n<pre class=\"wp-block-verse\">medvram\/lowvram<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This optimization breaks up the model to accommodate lesser graphics cards. The smaller the pieces though, the more time it will need to swap pieces out. Side note, but I believe it\u2019s MEDvram as in MEDium as opposed to the naive pronunciation I heard with MEDvram as in MEDical.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">opt-channelslast<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some procedures are exparimental optimization that is literally unknown if it\u2019s worth it at this time. I\u2019m skipping it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Saturday Night <\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">I took it off<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Sunday<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">I joined my father on shopping trip and we ran out of gas at a car wash. By the time I sat down to work on Stable Diffusion, I wasn\u2019t up to much more than an unguided self-tour of the settings. I don\u2019t know what most of the categories are supposed to do! I\u2019ll look each one up in time.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Monday Morning<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">As usual in recent months, I spend a while writing the Takeaway and Final Question, dressing up the citations, and copying everything out of LibreOffice and into WordPress for publication at noon.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Takeaway<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Progress! It might not be what I expected this week, but I\u2019m still satisfied that I have something to show off. The point I\u2019m at is to get to the same place as I was with Easy Diffusion before looking up the toys I came to Automatic1111 for.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As one final note, this week is also the anniversary of this blog. It caused a bit of a delay in getting this post scheduled by noon, but that would make it the third instance I can remember of a late post in twice as many years. I feel bad about it, but at the same time, it&#8217;s still a decent track record.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Final Question<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do you have a favorite interface for using Stable Diffusion?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">[1] PresTrembleyIIIEsq, et. all, &#8220;SD.Next \/ ComfyUI Install: Unexpected Error #54,&#8221; <em>github.com<\/em>, July 30, 2023. [Online]. <a href=\"https:\/\/github.com\/LykosAI\/StabilityMatrix\/issues\/54\">https:\/\/github.com\/LykosAI\/StabilityMatrix\/issues\/54<\/a>. [Accessed Aug. 8, 2023].<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">[2] AUTOMATIC1111, &#8220;Optimizations&#8221; <em>github.com<\/em>, August, 2023. [Online]. <a href=\"https:\/\/github.com\/AUTOMATIC1111\/stable-diffusion-webui\/wiki\/Optimizations\">https:\/\/github.com\/AUTOMATIC1111\/stable-diffusion-webui\/wiki\/Optimizations<\/a>. [Accessed Aug. 8, 2023].<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Good Morning from my Robotics Lab! This is Shadow_8472 and today I am spending a week with Stable Diffusion to improve my skills at it. Let\u2019s get started! The science of AI art goes back to around the time complete CPU\u2019s were first integrated into a single computer chip in the late 60\u2019s\/early 70\u2019s. At &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2023\/08\/28\/happy-birthday-stable-diffusion\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Happy Birthday Stable Diffusion!&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[268],"tags":[272,273,269,270,271,274],"class_list":["post-1278","post","type-post","status-publish","format-standard","hentry","category-ai-image-generation","tag-ai-art","tag-ai-image-generation","tag-automatic1111","tag-easy-diffusion","tag-stable-diffusion","tag-webui"],"_links":{"self":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/comments?post=1278"}],"version-history":[{"count":1,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1278\/revisions"}],"predecessor-version":[{"id":1279,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1278\/revisions\/1279"}],"wp:attachment":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/media?parent=1278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/categories?post=1278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/tags?post=1278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}