Categories: Tutorials

Boost Performance: Install and Update XFormers for 1.5x Faster Stable Diffusion

XFormers is the python library developed by Facebook AI Researchers. Installing Xformers provides an alternative way to decrease the inference time for NVIDIA GPUs which result in faster image generation with less VRAM memory allocation.

It is widely used by researchers for Computer Vision, NLP(Natural Language Processing), etc. Well, Stable Diffusion WebUI uses high end GPUs that run with CUDA and xformers. Lets see how we can install and upgrade the Xformers.

Steps to install Xformers for Automatic1111/Forge:

If haven’t installed the Xformers yet, then this section will help you to install the required version for Stable Diffusion WebUIs.

1. Make sure you have installed the Automatic1111 or Forge WebUI.

2. Now, its recommended to download and install CUDA 11.3 version (Latest versions sometime support) from the official NVIDIA page.

3. Select the appropriate configuration setup for your machine. Like in our case we have the Windows OS 10, x64 base architecture. You can check yours by moving to the system properties on “This PC” from home section. Here, the file size which we need to download is 2.7 GB approx. In your case, it can be different.

4. After downloading, install it by following the installation instructions.

5. Now, make sure you have enable the xformers args inside “webui-user.bat” file otherwise WebUI will not use it.

6. For confirmation that WebUI is using the Xformers or not, as usual click on webui.bat to start Automatic1111/Forge and move to command prompt, you will see “Launching webui with args = –xformers” message.

At the first attempt of image generation it will take some time (10-20 minutes) but after that your image generation will be faster.

Steps to Upgrade Xformers for Automatic1111/Forge:

While using different Stable Diffusion models, we sometime noticed a warning message that “you are using xformers…. version This program is tested to work with xformers…“.

If you are getting the same issue, so in this case you should upgrade the required Xformers version. Lets see how we can upgrade it.

1. First go to the Xformers python library official release on Pypi website.

2. Copy the download link from there and move to your stable diffusion directory. 

pip install xformers

3. Move and click to the address bar and type “cmd” to open command prompt on the respective directory.

4. Then paste the copied link by right clicking on the command prompt and press enter. It will start the processing for updates for Xformers.

If you face error that its unsupported then you should try lower version for getting it compatible. 

5. After getting installed, go to the Stable Diffusion directory and right click on “webui-user.bat” file and open your file with notepad or editor(we use notepad++). Add the required arguments:

–reinstall-xformers

Now save the file and restart Automatic1111 / Forge to get install all the necessary files and packages.

6. Now reedit and remove the args from the “webui-user.bat” file which you have added earlier and save the file, otherwise the files will get installed again.

For confirmation that Stable diffusion WebUI is really using Xformers and its updated or not , you can check the version on the bottom of the WebUI.

After installation, at the initial stage of image generation, it will take some time (10-20 minutes) for processing. After first attempt it will be faster.

Conclusion:

Xformers makes the image generation faster for Stable Diffusion WebUIs. Its is mostly used for NLP, Computer Vision, etc. which directs to consume less VRAM.

admage

Share
Published by
admage

Recent Posts

Tennibot: The Tennis Ball Roomba

While some tech companies have lofty goals to transform drug discovery through AI or to…

5 hours ago

19 Captivating Selfie Ideas to Slay Your Feed

The most important problem many people face is how to take a selfie shot. Here…

13 hours ago

ComfyUI: Transform Images/Text into Lengthy Videos with Pyramid Flow

Generating longer video with maximum consistency is one of the challenging task. But now it…

4 days ago

Amazon Introduces AI-Powered Video Ad Creation Tools

Businesses that sell on Amazon will have access to new generative AI tools allowing them…

6 days ago

Enhance Image Prompts with TIPO and DanTagGen

Are you searching for the best LLM that can optimize your prompts? Here it is.…

7 days ago

18 Captivating Fashion Photography Prompts for Camera Lenses

 Here, we tested all the prompts and sharing with you. All the prompts have distinct…

1 week ago