{"id":5002,"date":"2024-03-06T10:18:03","date_gmt":"2024-03-06T02:18:03","guid":{"rendered":"https:\/\/www.1ai.net\/?p=5002"},"modified":"2024-03-06T10:18:03","modified_gmt":"2024-03-06T02:18:03","slug":"forge%e7%9a%84%e5%ae%89%e8%a3%85%e4%b8%8e%e4%bd%bf%e7%94%a8%ef%bc%8c%e6%af%94webui%e6%9b%b4%e5%a5%bd%e7%94%a8%e7%9a%84%e7%ae%80%e6%98%93%e9%ab%98%e6%95%88%e7%bb%98%e5%9b%be%e5%b7%a5%e5%85%b7","status":"publish","type":"post","link":"https:\/\/www.1ai.net\/en\/5002.html","title":{"rendered":"Installation and use of Forge, a simple and efficient drawing tool that is better than WebUI"},"content":{"rendered":"<p>The stable-diffusion-webui-forge tool is a<a href=\"https:\/\/www.1ai.net\/en\/tag\/stable-diffusion\" title=\"_Other Organiser\" target=\"_blank\" rel=\"noopener\">Stable Diffusion<\/a> WebUI (based on Gradio)<a href=\"https:\/\/www.1ai.net\/en\/tag\/ai%e7%bb%98%e5%9b%be%e5%b7%a5%e5%85%b7\" title=\"[View articles tagged with [AI drawing tools]]\" target=\"_blank\" rel=\"noopener\">AI Drawing Tools<\/a>The platform aims to simplify plugin development, optimize resource management, and accelerate inference.<a href=\"https:\/\/www.1ai.net\/en\/tag\/forge\" title=\"_Other Organiser\" target=\"_blank\" rel=\"noopener\">Forge<\/a>It's a name inspired by.\"<span class=\"wx_search_keyword_wrap\">Minecraft Forge<i class=\"wx_search_keyword\"><\/i><\/span>\u201c. The project aims to become the Forge of SD WebUI. Forge promises forever<strong>No unnecessary changes will be added to the Stable Diffusion WebUI user interface<\/strong>For those who are familiar with Stable Diffusion WebUI, they can use their experience with Automatic1111 WebUI to quickly get started with the operation of Forge.<\/p>\n<p>Off topic: Forge author has been active in<span class=\"wx_search_keyword_wrap\">AIGC<i class=\"wx_search_keyword\"><\/i><\/span>Drawing community. He has successively open-sourced excellent open-source software of ControlNet and Foooucs communities, and recently he has invested in the development of Forge, aiming to simplify the entry threshold of AIGC drawing for novices.<\/p>\n<p>At a resolution of 1024px image quality, Forge can achieve a significant performance acceleration compared to the original WebUI in terms of SDXL model inference rate:<\/p>\n<ul class=\"list-paddingleft-1\">\n<li>\u2022 If you use a common GPU, such as<strong>8GB video memory<\/strong>, you can expect the inference speed (it\/s) to increase by about<strong>30~45%, GPU memory peak (in Task Manager) reduced by about 700MB to 1.3GB, and maximum diffusion resolution (without OOM) increased by about 2 to 3 times<\/strong>, maximum diffusion batch size (no OOM)<strong>Increased by about 4 to 6 times<\/strong>.<\/li>\n<li>\u2022 If you use a lower performance GPU, such as<strong>6GB video memory<\/strong>, you can expect the inference speed (it\/s) to increase by about 60~75%, the GPU memory peak (in Task Manager) to decrease by about 800MB to 1.5GB, the maximum diffusion resolution (without OOM) to increase by about 3 times, and the maximum diffusion batch size (without OOM) to increase by about 4 times.<\/li>\n<li>\u2022 If you use performance<strong>Powerful GPU, such as 4090, with 24GB of video memory<\/strong>, you can expect inference speed (it\/s)<strong>Increased by about 3~6%, GPU memory peak (in Task Manager) reduced by about 1GB to 1.4GB, and maximum diffusion resolution (without OOM) increased by about 1.6 times<\/strong>, maximum diffusion batch size (no OOM)<strong>Increased by about 2 times<\/strong>.<\/li>\n<li>\u2022 If you use<strong><span class=\"wx_search_keyword_wrap\">ControlNet<i class=\"wx_search_keyword\"><\/i><\/span>To perform SDXL inference<\/strong>, Maximum ControlNet quantity (no OOM)<strong>Increased by about 2 times<\/strong>, the speed of SDXL+ControlNet is increased by about 30~45%.<\/li>\n<\/ul>\n<p>In addition, another very important change introduced by Forge is<strong>Unet Patcher<\/strong>. With Unet Patcher, plug-in ecosystem integrations such as Self-Attention Guidance, Kohya High Res Fix, FreeU, StyleAlign, Hypertile, etc. can be easily and efficiently implemented with about 100 lines of code, greatly simplifying the integration of the plug-in ecosystem. With the introduction of Unet Patcher, Forge can support more new plug-in ecosystems, including SVD, Z123, masked Ip-adapter, masked controlnet, photomaker and other new technology tools.<\/p>\n<p>In addition, Forge has added some efficient samplers, such as: DDPM, DDPM Karras, DPM++ 2M Turbo, DPM++ 2M SDE Turbo, LCM Karras, Euler A Turbo, etc.<\/p>\n<h2>sd-webui-forge installation<\/h2>\n<h3>Git Installation<\/h3>\n<p>If you are familiar with Git and have some development experience, you can use git clone to download the latest version of forge source code and install it locally.<\/p>\n<p>Environmental installation:<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"css\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__selector-tag\">git<\/span> <span class=\"code-snippet__selector-tag\">clone<\/span> <span class=\"code-snippet__selector-tag\">https<\/span>:\/\/<span class=\"code-snippet__selector-tag\">github<\/span><span class=\"code-snippet__selector-class\">.com<\/span>\/<span class=\"code-snippet__selector-tag\">lllyasviel<\/span>\/<span class=\"code-snippet__selector-tag\">stable-diffusion-webui-forge<\/span><span class=\"code-snippet__selector-class\">.git<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__selector-tag\">cd<\/span>\u00a0.\/<span class=\"code-snippet__selector-tag\">stable-diffusion-webui-forge<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"># <span class=\"code-snippet__selector-tag\">Linux<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__selector-tag\">pip3<\/span> <span class=\"code-snippet__selector-tag\">install<\/span> <span class=\"code-snippet__selector-tag\">torch<\/span> <span class=\"code-snippet__selector-tag\">torchvision<\/span> <span class=\"code-snippet__selector-tag\">torchaudio<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"># <span class=\"code-snippet__selector-tag\">window<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"># <span class=\"code-snippet__selector-tag\">pip3<\/span> <span class=\"code-snippet__selector-tag\">install<\/span> <span class=\"code-snippet__selector-tag\">torch<\/span> <span class=\"code-snippet__selector-tag\">torchvision<\/span> <span class=\"code-snippet__selector-tag\">torchaudio<\/span> <span class=\"code-snippet__selector-tag\">--index-url<\/span> <span class=\"code-snippet__selector-tag\">https<\/span>:\/\/<span class=\"code-snippet__selector-tag\">download<\/span><span class=\"code-snippet__selector-class\">.pytorch<\/span><span class=\"code-snippet__selector-class\">.org<\/span>\/<span class=\"code-snippet__selector-tag\">whl<\/span>\/<span class=\"code-snippet__selector-tag\">cu121<\/span><\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__selector-tag\">pip<\/span> <span class=\"code-snippet__selector-tag\">install<\/span> <span class=\"code-snippet__selector-tag\">-r<\/span> <span class=\"code-snippet__selector-tag\">requirements<\/span><span class=\"code-snippet__selector-class\">.txt<\/span> <span class=\"code-snippet__selector-tag\">-U<\/span><\/span><\/code><\/pre>\n<\/section>\n<p>Share the model with sd-web-ui to save disk waste. If you are a window user, modify webui-user.bat as follows:<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"sql\"><code><span class=\"code-snippet_outer\">@echo off<\/span><\/code><code><span class=\"code-snippet_outer\">\r\n<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">set<\/span> PYTHON=<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">set<\/span> GIT=<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">set<\/span> VENV_DIR=<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">set<\/span> COMMANDLINE_ARGS=<\/span><\/code><code><span class=\"code-snippet_outer\">\r\n<\/span><\/code><code><span class=\"code-snippet_outer\">@<span class=\"code-snippet__keyword\">REM<\/span> Uncomment <span class=\"code-snippet__keyword\">following<\/span> code <span class=\"code-snippet__keyword\">to<\/span> <span class=\"code-snippet__keyword\">reference<\/span> an existing A1111 checkout.<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">set<\/span>\u00a0A1111_HOME=[stable-diffusion-webui directory]<\/span><\/code><code><span class=\"code-snippet_outer\">\r\n<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">set<\/span> VENV_DIR=%A1111_HOME%\/venv<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">set<\/span> COMMANDLINE_ARGS=%COMMANDLINE_ARGS% ^<\/span><\/code><code><span class=\"code-snippet_outer\">  <span class=\"code-snippet__comment\">--ckpt-dir %A1111_HOME%\/models\/Stable-diffusion ^<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">  <span class=\"code-snippet__comment\">--hypernetwork-dir %A1111_HOME%\/models\/hypernetworks ^<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">  <span class=\"code-snippet__comment\">--embeddings-dir %A1111_HOME%\/embeddings ^<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">  <span class=\"code-snippet__comment\">--lora-dir %A1111_HOME%\/models\/Lora<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">\r\n<\/span><\/code><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__keyword\">call<\/span> webui.bat<\/span><\/code><code><span class=\"code-snippet_outer\">\r\n<\/span><\/code><\/pre>\n<\/section>\n<p>When you see the startup command as follows, the sharing is set up successfully:<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span class=\"code-snippet_outer\">Launching Web UI <span class=\"code-snippet__keyword\">with<\/span> <span class=\"code-snippet__built_in\">arguments<\/span>:-xformers --forge-ref-a1111-home=sd directory\/-ckpt-dir sd directory\/models\/Stable-diffusion-vae-dir sd directory\/models\/VAE-hypernetwork-dir sd directory\/models\/hypernetworks-dirs --embeddings-dir sd directory\/embeddings-lora-dir\/models\/lora-controlnet-dir sd directory\/models\/ControlNet-controlNet-controcess-models-dir sd directory\/extensions\/sd-we-bui-controlnet\/annoctor\/downloaders<\/span><\/code><\/pre>\n<\/section>\n<p>&nbsp;<\/p>\n<p>The official Linux operation guide is not provided, but I tested it based on my experience with sd-webui. In order not to damage the original code and avoid subsequent git update and merge conflicts, I chose to add webui-run.sh locally:<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"javascript\"><code><span class=\"code-snippet_outer\"> <span class=\"code-snippet__keyword\">export<\/span> venv_dir=<span class=\"code-snippet__string\">\"-\"<\/span><\/span><\/code><code><span class=\"code-snippet_outer\">\u00a0<span class=\"code-snippet__keyword\">export<\/span>\u00a0A1111_HOME=[stable-diffusion-webui directory]<\/span><\/code><code><span class=\"code-snippet_outer\"> .\/webui.sh --xformers --forge-ref-a1111-home=$A1111_HOM<\/span><\/code><\/pre>\n<\/section>\n<p>Then run .\/webui-run.sh to start the forge software.<\/p>\n<p><strong>Quick Tips<\/strong>\uff1aIf you like a clean and self-controllable environment like me, you can choose the above solution. You can also add an environment command alias to start it with one click. Add the following configuration to the local file ~\/.bash_aliases (if you do not restart the command line for the first time, you need to source ~\/.bash_aliases), and then you can start it with forge:<\/p>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\" data-lang=\"bash\"><code><span class=\"code-snippet_outer\"><span class=\"code-snippet__built_in\">alias<\/span>\u00a0forge=<span class=\"code-snippet__string\">&#039;conda activate [conda env] &amp;&amp; cd &quot;stable-diffusion-webui-forge directory&quot; &amp;&amp; .\/webui-run.sh&#039;<\/span><\/span><\/code><\/pre>\n<\/section>\n<h3>Installation package installation<\/h3>\n<p>For those who are not familiar with git operations, you can download the official one-click installation package. After downloading the installation package, decompress the file locally and use<code>update.bat<\/code>Update and reuse<code>.\/webui.bat<\/code>Run to start the forge software. The author reminds you to run<code>update.bat<\/code>This is very important, because the forge code is still under rapid iterative development. Make sure to update the latest code and environment in time, otherwise you may encounter some unknown potential bug versions. The way to share drawing models with sd-web-ui is exactly the same as the git solution.<\/p>\n<h3>Forge Launch<\/h3>\n<p>From the startup interface, we can see that Forge&#039;s user interface and sd-web-ui perfectly keep the WebUI unchanged. This greatly reduces the threshold for novice users to get started. In the startup interface, we can see the newly added SVD and Z123 tabs, which are the new features brought by the Unet Patcher mentioned above.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5003\" title=\"640-14\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/03\/640-14.png\" alt=\"640-14\" width=\"1080\" height=\"552\" \/><\/p>\n<p>In addition, the author mentioned that Forge maintained the consistency of the front-end interface and promised never to add any unnecessary changes. The back-end removed all WebUI codes related to resource management and rebuilt the entire back-end infrastructure, which was a major reconstruction process.<\/p>\n<p>Forge plugins are not shared, just like the webui, use the extension installation or manually copy from the webui.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5004\" title=\"640-15\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/03\/640-15.png\" alt=\"640-15\" width=\"1080\" height=\"313\" \/><\/p>\n<h2>sd-webui-forge experience<\/h2>\n<p>In the Linux environment with local rtx4090 24G video memory, using the sd_xl_base_1.0 model to draw, we can see the corresponding performance improvement. It takes 3.2 seconds, with an average of 7.18GB of video memory used, a peak of 8.46GB, and a system usage rate of 42.1%. I believe that for other machines with low video memory, there will be more significant inference improvements.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5006\" title=\"640-17\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/03\/640-17.png\" alt=\"640-17\" width=\"1080\" height=\"899\" \/><\/p>\n<p>Use the image enlargement algorithm R-ESRGAN 4x+ to enlarge the experience by 2X. The tool setting parameters are as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5005\" title=\"640-16\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/03\/640-16.png\" alt=\"640-16\" width=\"1080\" height=\"155\" \/><\/p>\n<p><span data-change-font=\"1\">It took 18.1 seconds, with an average of 13.6GB of video memory used, a peak of 17.72GB, and a system usage of 82.3%<\/span><span data-change-font=\"1\">.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5009\" title=\"640-20\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/03\/640-20.png\" alt=\"640-20\" width=\"1080\" height=\"902\" \/><\/p>\n<p>Forge mainly optimizes the use of video memory, which is more obvious for 30 series graphics cards, but not much for 40 series graphics cards. However, it would be great to have some new plugins, such as sd-forge-layerdiffusio, and the support for Playground v2.5 in the official feature list is also expected.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5007\" title=\"640-18\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/03\/640-18.png\" alt=\"640-18\" width=\"963\" height=\"195\" \/><\/p>\n<h3>Drawing experience<\/h3>\n<section class=\"code-snippet__fix code-snippet__js\">\n<ul class=\"code-snippet__line-index code-snippet__js\">\n<li><\/li>\n<\/ul>\n<pre class=\"code-snippet__js\"><code><span class=\"code-snippet_outer\">1girl, solo, portrait, dark hair, slicked back hair, simple background, shirt, parted lip, lips, expressionless<\/span><\/code><\/pre>\n<\/section>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5008\" title=\"640-19\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2024\/03\/640-19.png\" alt=\"640-19\" width=\"1024\" height=\"1024\" \/><\/p>\n<h3>appendix<\/h3>\n<ul class=\"list-paddingleft-1\">\n<li>\u2022\u00a0<strong>stable-diffusion-webui-forge<\/strong>: https:\/\/github.com\/llyasviel\/stable-diffusion-webui-forge<\/li>\n<li>\u2022\u00a0<strong>Installation package download<\/strong>: https:\/\/github.com\/lllyasviel\/stable-diffiusion-webui-forge\/releases\/download\/latest\/webui_forge_cu121_torch21.7z<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>the can-diffusion-webui-forge tool is an AI mapping tool platform based on the Stable Diffusion WebUI (based on Gradio) that aims to simplify plugin development, optimize resource management and accelerate reasoning. Forge's name is inspired by Minecraft Forge. The project aims to become the Forge of SD WebUI. Forge promised never to add any unnecessary changes to the Stable Diffusion WebUI interface, which could be used by students familiar with Stable Diffusion WebUI with Automatic<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[149,144],"tags":[541,1517,1516,197],"collection":[],"class_list":["post-5002","post","type-post","status-publish","format-standard","hentry","category-jiaocheng","category-baike","tag-ai","tag-forge","tag-stable-diffusion"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts\/5002","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/comments?post=5002"}],"version-history":[{"count":0,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts\/5002\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/media?parent=5002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/categories?post=5002"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/tags?post=5002"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/collection?post=5002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}