NokiMo
Furkan Gözükara
Furkan Gözükara

patreon


Auto Installer Script (.bat) Files For Stable Diffusion XL (SDXL) On Your PC

Updated 19 September 2023 : Fixed gradio and other bugs working perfect

July 8: Now we are using official repo weights. Not anymore leaked weights. You need to accept terms of new repo links (Repo 1 , Repo 2).

Please upvote this reddit thread if possible.

Join discord and tell me your discord username to get a special rank : SECourses Discord

Patreon exclusive posts index

Video tutorial for this post step by step (and 8 GB VRAM settings) : https://youtu.be/__7VNmnn5iU

First accept terms and conditions on both of the below Hugging Face repositories.

You need a free Hugging Face account so get one if you didn't get previously : click here to join

Repo 1 , Repo 2

Then get a Hugging Face token for yourself from here 

Then download install.bat and run.bat files

If you have 12 GB or lower VRAM having GPU please use run_low_vram.bat

Run install.bat file with double click

After it is finished installation enter inside stable-diffusion-xl-demo folder and edit app2.py file. You can even use notepad but i prefer to use notepad++ for editing. Right click file and click edit

Find access_token and change it to your token

e.g. access_token = "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" //this is a real token you can use

Save the changes then double click and start run.bat. It will start the Gradio interface

Watch the tutorial video for more information. When you first time run it, it will download the necessary weights and model files

Comments

this is too old i dont suggest you to use anymore. use swarmui or forge web ui or automatic1111 web ui. swarmui is amazing here full tutorial : https://youtu.be/HKX8_F1Er_w

Furkan Gözükara

after running run.bat RuntimeError: Failed to import diffusers.pipelines.stable_diffusion_xl.pipeline_stable_diffusion_xl because of the following error (look up to see its traceback): numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

olga shulga

Hello again you were right. It took me a lot of time to fix but I fixed. please redownload install.bat and install again

Furkan Gözükara

yes i can help. what is your python version? also i am installing on my computer to verify it is working or not

Furkan Gözükara

Hi Sec, I double click to start run.bat then I get this message: Traceback (most recent call last): File "C:\Automatic1111install\auto sdxl\stable-diffusion-xl-demo\app2.py", line 1, in import gradio as gr ModuleNotFoundError: No module named 'gradio' Press any key to continue . . . Can you help with this?

John S

and here comfyui tutorial if you prefer that : https://youtu.be/FnMHbhvWUhE

Furkan Gözükara

so sorry that i missed your message. now i suggest automatic1111 : https://www.patreon.com/posts/automatic-for-ui-86307255

Furkan Gözükara

Yes if you have high ram very possible. I think it can be done with diffusers as well I should look for it. But I am pretty sure auto 1111 will get sdxl support very soon

Furkan Gözükara

Nice! I went with https://github.com/vladmandic/automatic/wiki/Diffusers for now, and swapping models from VRAM to RAM (I have 64gb) makes it a breeze to use SDXL on 12GB VRAM locally. Probably 8 as well.

Mikael Svenson

I just posted runpod script. It clones with git large and uses downloaded folder :)

Furkan Gözükara

Runpod script posted :)

Furkan Gözükara

Yep it is next. I will also make hopefully auto installer

Furkan Gözükara

Looking forward to runpod script 😍

indievish

Sure it is totally possible 👍

Furkan Gözükara

Thank you.. I'll change them a bit as I don't want it on my C drive

Mikael Svenson

they are downloaded into user cache folder. if you remember i deleted it in the video to show you. so they are permanent. it will use them when you run again. you will find inside here : C:\Users\ur_username\.cache\huggingface\hub yes alternatively you can clone and give cloned directory path in the app2.py file

Furkan Gözükara

When using the bat files, where are the safetensor files downloaded to? Or are they runtime only? Or I create a directory, set the SDXL_MODEL_DIR folder in enviroments, and that optimizes it? I'll clone huggingface repos and change the scripts - should fix it.

Mikael Svenson

thanks for letting us know. i think it will get much faster when sdxl 1.0 is released with other optimizations. it is slow due to vram usage i think. so the vram becomes full so it becomes too slow

Furkan Gözükara

Refiner step works for me on 12gb, but very slow. Using 11.7/12

Mikael Svenson

Hello. Sorry for late reply. I just uploaded run_low_vram.bat file. Can you try it please?

Furkan Gözükara

hello welcome. please use run_low_vram file. just uploaded it. it is for 12gb and below cards.

Furkan Gözükara

ami gives me this error with 16gb and an rtx 3060

esfera

Can you check that if xformers installed? I wonder if that paticular version is removed from wheels or not. I can check tomorrow and update scripts

Furkan Gözükara

yep out of memory error. you are running low vram settings right? i just did a test and it used only 8.8 gb vram. it should work with your card.

Furkan Gözükara

Still having this error: File "D:\AI\stable-diffusion-xl-demo\app2.py", line 52, in pipe_refiner.to("cuda") File "D:\AI\stable-diffusion-xl-demo\venv\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 681, in to module.to(torch_device, torch_dtype) File "D:\AI\stable-diffusion-xl-demo\venv\lib\site-packages\transformers\modeling_utils.py", line 1902, in to return super().to(*args, **kwargs) File "D:\AI\stable-diffusion-xl-demo\venv\lib\site-packages\torch\nn\modules\module.py", line 1145, in to return self._apply(convert) File "D:\AI\stable-diffusion-xl-demo\venv\lib\site-packages\torch\nn\modules\module.py", line 797, in _apply module._apply(fn) File "D:\AI\stable-diffusion-xl-demo\venv\lib\site-packages\torch\nn\modules\module.py", line 797, in _apply module._apply(fn) File "D:\AI\stable-diffusion-xl-demo\venv\lib\site-packages\torch\nn\modules\module.py", line 797, in _apply module._apply(fn) File "D:\AI\stable-diffusion-xl-demo\venv\lib\site-packages\torch\nn\modules\module.py", line 820, in _apply param_applied = fn(param) File "D:\AI\stable-diffusion-xl-demo\venv\lib\site-packages\torch\nn\modules\module.py", line 1143, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 122.00 MiB (GPU 0; 12.00 GiB total capacity; 10.99 GiB already allocated; 0 bytes free; 11.18 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF Press any key to continue . . . Looks like an out of memory error? Running an RTX 3080 12Gb Sorry for the long paste

Ralph Guevara

Good question. In code we don't have it anywhere. But I don't know if enabled in pipeline. But you can try easily. Don't install it and see if you will get error or not :) and you are welcome

Furkan Gözükara

Is the invisible watermark enabled? I see it in the requirements but don't know if it's disabled in code. Thanks for this, BTW.

Daniel Jennings

Sorry for ther late response, but now im out of work and trying the auto installer. Im getting this Memory Error, not to sure if there is a way to fix it. Here is the error via Github https://gist.github.com/zeuszl1/ea80ac6f35bca0eb0008b559908d7c94

Ralph Guevara

Awesome

Furkan Gözükara

Yep. Triton works only in Linux. It is optimization so a little bit slower but works great

Furkan Gözükara

Great job its working now, thx

Jack Steel

Just downloaded the install files, hit run and getting this popup - A matching Triton is not available, some optimizations will not be enabled. Error caught was: No module named 'triton' Is that fine?

Ralph Guevara

thanks for bringing into my attention. just updated run.bat file and also repo links. should work perfect now. dont forget to accept terms and set your access token

Furkan Gözükara

seems like run.bat is missing. unable to download it now, can you post another link for it?

Ali Rahmoun

just made update. please redownload scripts and make a new install. it should work now

Furkan Gözükara

just made update. please redownload scripts and make a new install. it should work now

Furkan Gözükara

correct. i am about to fix the error. they deleted the repo we used. i am updating links for a new repo. hopefully in 30 min

Furkan Gözükara

mine is hanging on loading model with this instruction: ``` A matching Triton is not available, some optimizations will not be enabled. Error caught was: No module named 'triton' Loading model E:\SDXL 0.9\stable-diffusion-xl-base-0.9 ```

Chad Gauthier

I am fixing the urls. It will be up soon.

Furkan Gözükara

I have gotten a little farther, I downloaded the non pruned models, and now am getting this, https://imgur.com/a/lz2ygWD

Jack Steel

here example screenshot : https://i.imgur.com/M2FlUV7.png

Furkan Gözükara

for example: model_key_base = r"C:\Users\King\Downloads\SDXL 0.9\stable-diffusion-xl-base-0.9" model_key_refiner = r"C:\Users\King\Downloads\SDXL 0.9\stable-diffusion-xl-refiner-0.9"

Furkan Gözükara

if you have downloaded all models from torrent yes you can edit app2.py file and make it use that folder.

Furkan Gözükara

I was able to grab the models, (using another link|dead now) is there a way to bypass Huggingface checking the site for them?

Jack Steel

Hello. Hugging face deleted the repo :/ I am working on a solution.

Furkan Gözükara

Hello. Hugging face deleted the repo :/ I am working on a solution.

Furkan Gözükara

A matching Triton is not available, some optimizations will not be enabled. Error caught was: No module named 'triton' Loading model nichijoufan777/stable-diffusion-xl-base-0.9 Couldn't connect to the Hub: 404 Client Error. (Request ID: 90e2dcf0-e285-48bf-a5bf-341de7bbffca)

Jack Steel

Hello, I am getting the following error when doing run.bat

Jack Steel


Related Creators