ホーム AI・IT How to easily set up an AI image generation environment using Stability Matrix

How to easily set up an AI image generation environment using Stability Matrix

三浦 拓海 三浦 拓海 • 更新: • 公開: • 読了約 46 分
目次

Hello. I haven't been able to write articles lately due to other activities, but since AUTOMATIC1111 Ver1.6 was officially released yesterday, I will write about how to install it again.


I previously wrote about how to install Ver1.5, but

the installer has also been updated, and it has been reborn as an installer that can collectively install Automatic 1111, Comfy UI, SD.Next (Vladmandic), VoltaML, InvokeAI, Fooocus.

Comfy UI I was planning to write a separate installation article for , but I was too busy to write it... I'm glad I can introduce them all together this time.

So, let's get started.





What has changed in Ver1.6?

naa500c1a2966



Since it's a major update, quite a lot has changed.


・ Support for Refiner function

First, a big change is that it now supports the SDXL Refiner function. As I introduced before, SDXL uses a two-stage image generation method.

First, you create the foundation of the image, such as the composition, with the Base model, and then you improve the fine details with the Refiner model to generate a high-quality image.

Simply put, it means that after doing txt2img, it does the finishing touches with img2img.
Although 1.5 supported SDXL, it didn't fully support this key feature, so generating with something like Comfy UI was more efficient, but now this is finally within reach.


The movement is similar to the Hires. fix function.
That function performs Img2Img again after Txt2Img to enlarge and finish the image, right?

This new feature feels like being able to switch to a finishing model during that Img2Img process.
If you are fine with using the same model for the finishing touches, then the Hires. fix function is perfectly fine.


 Since most user-distributed SDXL models do not have a Refiner model, you might be able to expand the range of your image creation while maintaining your own unique style by setting a model whose composition and artistic elements you like as the Base model and setting a model whose art style and finish you like as the Refiner model.



 I have personally experienced that this is a very logical feature, as I have been using similar processes to improve quality while adding and correcting details.



・ Added Style Editor dialog

 Like the Hanafuda mark, the style button has also changed.
 If you press the pencil button located below the Generate button, the style editor will open in the center of the screen.






・ Many new samplers added

 The number of samplers in this range has increased.


 So the 3M series has started too, huh.




・ Improved memory usage

Memory usage during model generation has become significantly more efficient.

Last time, just loading the model consumed an insane amount of memory.
It was announced at the time, but it seems to have been improved in version 1.6.




・ UI changes and more

There have been quite a few changes made to the UI as well.
The Hanafuda icon is gone, and features like model and LoRA selection are now displayed in tabs at all times.


Considering stability, it might be better to wait until around version 1.6.1, when bugs have been ironed out, before installing it.

I want to write this article while I have the time, so I will be building a new environment at this time.




Installation using Stability Matrix



As I introduced at the beginning, this time I will introduce an installer that allows you to easily set up various local AI generation applications.

It is convenient to be able to share models, LoRA, LyCORIS, VAE, and Embeddings.

This article will mainly explain the installation of AUTOMATIC1111 Ver1.6, but I may write articles about other apps in the future.
I think it is a good opportunity for those who are interested to try out other apps as well.

Also, Git and Python, which previously had to be installed in advance, are embedded here, so it seems there is no need for separate installation.
This is helpful for beginners.

https://github.com/LykosAI/StabilityMatrix

Also, it seems that a model browser that imports from ️ CivitAI has been implemented, which is apparently convenient for downloading models.

Not limited to CivitAI, uploaded models can be deleted at any time for the author's convenience, so I think it is best to properly download and save your favorites.



Now, let's actually install it.
https://github.com/LykosAI/StabilityMatrix/releases

I think you should select the latest one from this URL.
This time, I will use v2.3.3 which was released four days ago.




Unzip the downloaded zip file and move StabilityMatrix.exe to your preferred location.
In the future, whenever you want to launch the WebUI, you will launch it from this file.

Now, let's launch it for the first time and proceed with the installation.




Although it is written like this for the Portable Mode check below, I could not specify a folder when I checked it, so I have left it unchecked this time.








Before pressing Launch, I will check the settings with the gear icon.


Since you cannot see everything as it is, I will connect the images.



Now, click the Launch button.

It takes a long time only for the first time, so please wait patiently.



After a while, the WebUI launched successfully in the browser.

This completes the installation of the WebUI.





If you want to install other applications



StabilityMatrix You can see the currently installed applications by clicking the cardboard box icon "Packages" on the left side of the screen.








What is the folder structure like?



 Now, I mentioned that installing with Stability Matrix allows you to manage models, LoRA, LyCORIS, VAE, and Embeddings all at once, but you might be wondering, what is the folder structure like for that?.

 You want to include the models and LoRA you already have, right?
 Right?


 Actually, you can even add those by Stability Matrix screen using drag and drop.

 Next, click the file icon on the left side of the screen labeled " Checkpoints ".

 If you press the Models Folder button at the top right of the image, it will open the local folder for models in Explorer.



 "Wait? There's more than just LoRA and LyCORIS.
 VAE , TextualInversion , upscalers , and so on!!"


 We can accommodate those demands of yours as well.


 This time, I added the TextualInversion item. For
upscalers,
you would just need to add ESRGAN, for example.

 It is extremely convenient because whatever you add here can be used commonly across any application.





️ Import models from CivitAI



 You might be wondering what it means to import from ️ CivitAI, but for this, we will use the "Model Browser" icon on the left side of the screen.


 Honestly, it is a crazy feature that is lighter than browsing CivitAI in a browser.

 You can download models directly from here.





Japanese translation of the Settings section






WebUI reference example: Hakanatori's usual settings


 Although this overlaps with the content introduced in my previous article, some settings are no longer necessary now.
 I felt that just linking to the article was hard to read, so I will write down only the parts that can be used in the 1.6 environment here.





1⃣ Launch WebUI and change the following items from settings.



・ Saving images/grids 's Images filename pattern to
 

[date][model_name][sampler]_[seed]

Copy and paste this.

 Now, when you generate an image, the image name will be
[Date][Model Name][Sampler][Seed Value].

 You can see the detailed information of the image by dropping it into the PNG Info tab in the WebUI, but it is often convenient to be able to see this kind of information in the file name later on.





・ Saving images/grids 's Save copy of large images as JPG Uncheck this.

 I usually generate images in PNG format, but if this is checked, a copy will also be saved as a JPG when generating large images.

 It might be useful if you are extremely tight on memory, but I turn it off because it's annoying not being able to tell at a glance which one is the PNG.

 By the way, PNG is a file format with little image degradation and is slightly heavier, while JPEG is a lighter file format with characteristic image degradation.





・ Upscaling of Upscaler for img2img Select your favorite upscaler.

 This is a setting for if you have added upscalers around the explanation of the folder structure.
When upscaling with img2img, it will now use the upscaler set here every time.


 The article regarding upscalers is here.

https://note.com/hcanadli12345/n/n5cd1861b474f

 It seems like more have been added recently, but I believe I have introduced the fairly standard ones.




- Img2img - Apply color correction to img2img results to match original colors. - Check this box.

The function that adds noise back to an image and redraws it is called Img2Img .
To put it simply, it feels like blurring the entire screen and then turning it back into a picture, and since colors gradually mix with the surroundings during this process, the saturation of the picture may drop each time it is used.

By checking this box, a process is applied at the end of the regeneration to bring it closer to the saturation of the original image, which prevents the image's saturation from dropping continuously.

I use a method where I create a base with Txt2Img and then repeat Img2Img multiple times or combine images to improve the quality of the illustration, so having the saturation drop every time was fatal.
Learning this setting made things much easier, so I highly recommend it.


Previously, this setting item was located under the Stable Diffusion section, but it seems it was moved, perhaps because Stable Diffusion XL was added.




- User Interface - [info] Quicksettings list - Add CLIP_stop_at_last_layers after CLIP_stop_at_last_layers.

By configuring this setting, you will be able to change the Clip skip setting at any time from the top of the main WebUI page.

In the illustration community, Clip skip is often set to 2, but I change it quite frequently to experiment.
The higher the number, the greater the change, and you can sometimes create images that deviate from the prompt's instructions.


* In previous articles, I also added sd_vae here to add a VAE selection window, but thanks to the addition of SDXL models, it has become necessary to link specific VAEs, so I will describe how to set them individually later.




- Similarly, at the bottom of User Interface,

Hires fix: show hires checkpoint and sampler selection
Hires fix: show hires prompt and negative prompt

check these boxes.


By installing this, when you turn txt2img Hires.fix ON,

during Hires.fix you will also be able to re-configure checkpoints, samplers, and
prompts & negative prompts.


Using a style LoRA from the beginning can sometimes change the entire composition of the image, but by using this, you can bring out the true potential of the model in the first half and then apply the style during upscaling, all in one go.





・ Sampler parameters Check everything except the samplers you want to use.


Stable Diffusion has something called samplers, and each one draws images differently.
There are quite a few of them, but you can hide the samplers you check here, so let's do that.

Until now, I recommended the ones circled in green in the image, such as DPM++ 2M Karras or DPM++ 2M SDE Karras, but this time new samplers circled in orange have been added, so I intend to uncheck those and test them in the near future.
That said, there are already people who have posted verification articles, so this is just for me to personally get a feel for them.

As the samplers settle down, I think the number of checks here will increase.


For more details regarding samplers, please see hoshikat's blog.

https://hoshikat.hatenablog.com/entry/2023/06/30/212231#%E8%BF%B7%E3%81%A3%E3%81%9F%E3%82%89DPM-2M-Karras





Once you have finished the settings up to this point, please click Apply settings at the top of the screen and then restart with Reload UI.

From this point on, the settings will be applied.

Also, if you want to apply the content during the middle of the configuration process, there is no problem with doing so at any time.





2⃣ Setting VAE for each model



SDXL and previous SD1.5 models, etc., cannot use the same additional training models or VAEs.

Therefore, I will write down how to set which VAE you want to use for each model individually.


From the image generation screen tab, please select Checkpoints to display the thumbnails of the models you have installed.

By clicking the tool icon in the upper right of the thumbnail, you can use the function to edit metadata.

Here, you can set the preferred VAE individually.
Since this is my own 1.5 model, I set the VAE for 1.5 models that I have been using until now.



This is the SDXL version of the counterfeit series, an anime-style model that many people are indebted to.

Therefore, I have set the sdxl_vae.safetensors for SDXL that I currently have.





Extensions I personally use



easy-prompt-selector & wildcards



Extensions in Install from URL and

https://github.com/blue-pen5805/sdweb-easy-prompt-selector

insert and install.




Extensions
in Install from URL and

https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards.git

insert and install.


I have installed the two extensions introduced here.
Please see the link page for details.





Tiled Diffusion & VAE


Extensions in Install from URL and

https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111.git

enter and install

When regenerating an image to a larger size, this extension allows you to generate large images even on low-spec PCs by using the procedure of dividing the image into tiles and generating multiple small images.

https://note.com/hcanadli12345/n/n9a3fcbfa2c7e

For more details, please see this explanatory article.

If you want to finish with a rich illustration, this is an extension you will definitely want to use.





From here, press Extensions tab's Available and press Load from: to install extensions from the list.

https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui-extensions/master/index.json

I think the URL is already entered, so just Load from: and the list will be loaded at the bottom of the screen.

From here, we will use the search function to find extensions.





After Detailer


Search for "After Detailer" and install !After Detailer manipulations.

This is an extension that, after generating an image, automatically faces, hands, or bodies, and re-renders and composites specific parts in detail.

By partially enlarging and generating, then automatically compositing, the detail of those areas is improved.

Also, you can set prompts and negative prompts for each, so you can use methods such as specifying fine expressions or clothing patterns in these fields.

I plan to write detailed explanations for this in a separate article in the future, so I appreciate your patience.



ControlNet


Search for "sd-webui-controlnet" and install sd-webui-controlnet manipulations.

This is the well-known ControlNet. I explained it in quite some detail in an article on FANBOX, but since that is no longer available, I plan to move the article.

Simply put, it is an extension that allows you to specify poses, compositions, expressions, and elements when generating images.
It is very useful when you want to reduce the randomness and create the illustration you intended.

https://note.com/hcanadli12345/n/nb2315a4cabd9

https://note.com/hcanadli12345/n/n1ab807153c7c

For more details, please check these articles.





3D Openpose Editor


Search for "3D Openpose Editor" and install 3D Openpose Editor tab.


There is a feature called ControlNet used to specify poses as mentioned earlier, and this is an extension that allows you to create the base poses for it using a 3D mannequin.Openpose.





Aspect Ratio selector plus & Aspect Ratio Helper



Search for "plus" and install Aspect Ratio selector plus UI related.


Search for "Aspect Ratio Helper" and install Aspect Ratio Helper script, dropdown, UI related.






sd-webui-supermerger



Search for "supermerger" and install SuperMerger tab, models, installed.


It is a powerful extension that allows for model merging, block-weighted merging, LoRA merging, and more.
If you want to pursue your own unique art style, you should definitely try it.





In addition to this, I also use stable-diffusion-webui-model-toolkit, which allows you to check and fix model data.

I also use sdweb-merge-block-weighted-gui, which allows for block-weighted merging of models.


I will introduce these in more detail when I write an explanatory article.





Once you have finished installing all the extensions, go to Extensions, select Installed, click Apply and restart UI to confirm the installation, and restart to apply the extensions.

If they still do not reflect, try closing the WebUI once and restarting it again.





Q&A: The LoRA I installed has disappeared!?


 This is a common terrifying experience when setting up an SDXL environment for the first time.

 Simply put, if the model currently loaded as the main one is 2.0, older additional training models for 1.5 cannot be used, so they are hidden.

 Once you reload the 1.5 model and press the Refresh button in the LoRA selection window, they will become visible again.

 Sometimes they are visible even if they are old training models, but does that mean they can be used?





Q&A: Where did the LyCORIS tab go!?



 From version 1.5, LyCORIS has been included in the Automatic1111 WebUI by default.
 Therefore, it is now displayed together within the LoRA tab.

 Well, I think there are cases where it would have been better to keep them separate for reasons like supermerging, but that's just how it is, so let's manage and save them ourselves.





That concludes this article.

I have a strong desire to write articles about other AI illustration generation apps as well, but it might be difficult until my busy period passes.



Since the month has changed, I plan to update the content of the [wildcards] prompt configuration file distribution [easy-prompt-selector] that I distribute to members soon.
https://note.com/hcanadli12345/n/n8bad6a5cff9f

This time, I have also added adjective-related additions that affect the overall atmosphere of the illustrations and the appearance of the characters.
Other minor adjustments have been made, but I would also like to add a few backgrounds.
If you have any requests, please leave a comment and I will try to prepare them.


Well then, until next time.

This was Hakanadori.





同じカテゴリの記事

三浦 拓海
コンテンツディレクター 三浦 拓海
プロフィールを見る →

映画と連続ドラマの公開情報を追う担当。配給会社のプレスシートと公式サイトの発表日を確認したうえで執筆します。

おすすめの関連記事