Stable Diffusion (local AI image generation) setup guide

Discussion in 'Lounge' started by Xeraser, Apr 30, 2023.

  1. Xeraser

    Xeraser Producer

    Joined:
    Dec 9, 2020
    Messages:
    342
    Likes Received:
    127
    Location:
    Japari Park
    What: local AI image generation.
    Why would AudioSex care: album covers, images for wavetable synthesizers.
    How: demons in your GPU, probably.
    What you need: Windows/Linux, 16GB of RAM, an NVIDIA GPU with (ideally) 8+GB of VRAM, around 20GB of storage minimum

    NO, YOU CAN'T GET GOOD HANDS OR TEXT OUT OF THE BOX (YET)

    Windows:​
    1. Install Git for Windows and make sure to check the box for the Windows Explorer integration.
    2. Right click anywhere, select 'Git Bash here' and execute
      Code:
      git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
    3. Download a model - this is what the AI will use to generate images (these weigh up to 8GB each)
      Stable Diffusion 1.5 (all-purpose but outdated), Deliberate (all-purpose, realistic), Dreamshaper (oil paintings, fantasy art, scenery), more can be found here (though you should use this filter)
    4. Place the model(s) you downloaded in the '/models/Stable-diffusion' folder
    5. Install Python 3.10 and choose 'add to PATH' - the Windows 7 installer can be found here
      IT HAS TO BE THIS SPECIFIC VERSION because python sucks ass
    6. (Optional): for a sizable speedup and VRAM usage reduction on Pascal (GTX 10xx) cards and newer, open up 'webui-user.bat' and add '--xformers' after 'COMMANDLINE_ARGS='
      FOR 4-6GB OF VRAM, ADD '--medvram' and expect it to take a while
      FOR <4GB OF VRAM, ADD '--lowvram' and go make some coffee
      FOR GTX 16XX CARDS, ADD '--precision full --no-half' in addition to '--medvram''
    7. Launch 'webui-user.bat' (NOT as an administrator), the first launch might take more than 15 minutes
    8. Visit 127.0.0.1:7860 on your browser of choice
    Linux:​
    1. Install python3 through whatever package manager you use ('wget git python3' for Red Hat and Arch-based, 'wget git python3 python3-venv' for Debian-based)
    2. Run
      Code:
      bash <(wget -qO- https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh)
      in your folder of choice
    • Run 'webui.sh'
    Recommended settings
    Start the WebUI, go to the "Settings" tab and do the following:​
    • 'Stable Diffusion' tab: enable 'Make K-diffusion samplers produce same images in a batch as when making a single image'
    • 'User interfaceì tab: paste 'sd_model_checkpoint, sd_vae, CLIP_stop_at_last_layers' in the quicksettings list box
    • 'Live previews' tab: DISABLE 'SHOW PROGRESSBAR' AND 'SHOW LIVE PREVIEWS OF THE CREATED IMAGE'
    • 'Sampler parameters' tab: set ETA noise seed delta to 31337
    • 'Actionsì tab: request browser notifications (useful)
    • CLICK THE BIG ORANGE APPLY SETTINGS BUTTON, CLOSE THE CMD WINDOWS AND RESTART THE WEBUI
    How to:
    [​IMG]

    How to get bigger images on SD1.5-based models:
    WIP, will write later​
     
    Last edited: May 2, 2023
    • Like Like x 8
    • Love it! Love it! x 3
    • Interesting Interesting x 2
    • List
  2.  
  3. RobertoCavally

    RobertoCavally Rock Star

    Joined:
    Jan 20, 2021
    Messages:
    525
    Likes Received:
    373
    Did not try this yet, but thank you in advance for your time/ work. :bow:

    Two things come to mind - can Python 3.10 be installed on W10? Can the 8GB models reside on i.e. 2nd SSD?

    Thanx
     
  4. Xeraser

    Xeraser Producer

    Joined:
    Dec 9, 2020
    Messages:
    342
    Likes Received:
    127
    Location:
    Japari Park
    Yeah, the first link is for Windows 8 through 11, the second one is for Windows 7 only. And yes, you can store them on a second drive. There's a way to change where it looks for models but I don't remember where that setting is stored - you can move the entire "models" folder somewhere else and symlink it back to where it was.
     
  5. fishnose

    fishnose Producer

    Joined:
    Oct 9, 2021
    Messages:
    246
    Likes Received:
    126
    That's a lot of hoops to jump through... but thanks!
     
  6. Xeraser

    Xeraser Producer

    Joined:
    Dec 9, 2020
    Messages:
    342
    Likes Received:
    127
    Location:
    Japari Park
    Nah not really, most of your time will he spent waiting for it to launch for the first time
     
  7. skeltoid

    skeltoid Kapellmeister

    Joined:
    May 2, 2018
    Messages:
    70
    Likes Received:
    50
    I am going to try this today.
    The way I interpreted all the AI web tools fine print is they also own anything you upload or make with them.
    I have a gtx1070 and a rtx3090ti -- will be interesting to see how they perform.
    Thanks for taking the time for all this information.
     
  8. Xeraser

    Xeraser Producer

    Joined:
    Dec 9, 2020
    Messages:
    342
    Likes Received:
    127
    Location:
    Japari Park
    Most online services "own" what you make, yes. Not sure if this applies to the paid ones too like NovelAI and Dreamstudio.
    In some ambiguous SD benchmark I found the 3090/Ti (the difference between them in SD is even less than the 10% difference in gaming) is like 9 times faster than the 1070 Ti (which is a little over half as fast as the 1080 Ti)
     
  9. skeltoid

    skeltoid Kapellmeister

    Joined:
    May 2, 2018
    Messages:
    70
    Likes Received:
    50
    Thanks Xeraser
    Great instructions - working on windows 10
    Did not take long at all.
    I think it is time to start learning python because I have no idea what just happened lol.
     
  10. Xeraser

    Xeraser Producer

    Joined:
    Dec 9, 2020
    Messages:
    342
    Likes Received:
    127
    Location:
    Japari Park
    Think it just took forever on mine due to my shitty 11 years old i5, good to know it's not supposed to take that long.
    You don't need to learn python for this, there are dozens of extensions available for this specific UI and even idiot-proof training scripts in case you want to add new data (images or even new concepts) to the models (though you might need all 24GB of VRAM depending on how you want to do it)
     
  11. skeltoid

    skeltoid Kapellmeister

    Joined:
    May 2, 2018
    Messages:
    70
    Likes Received:
    50
    says xformers unavailable
    when making 6 images it takes about 15 seconds with CPU (Ryzen 9 5800) and Video not going above 10% usage
    also with it open python is using 5gb of ram if anyone was curious of resources used
    any recommendations for websites to learn more?
    thanks again
     
  12. complete

    complete Producer

    Joined:
    Sep 19, 2013
    Messages:
    180
    Likes Received:
    106
  13. Xeraser

    Xeraser Producer

    Joined:
    Dec 9, 2020
    Messages:
    342
    Likes Received:
    127
    Location:
    Japari Park
    xformers not found on a 10xx series card or newer? That's odd, it should automatically download a prebuilt xformer library when using a compatible GPU
    Why are you using your CPU though? It shouldn't do that by default, check your GPU usage while it's generating.
    You can find some artists to prompt ("by" followed by the artist name) here Comparison of all Artists in Stable Diffusion (urania.ai)
    It's a paid plugin (both prices are ridiculous) that's EXTREMELY limited, there isn't a single good reason to consider it.
     
    Last edited: May 2, 2023
  14. recordingisfun

    recordingisfun Member

    Joined:
    Feb 2, 2012
    Messages:
    24
    Likes Received:
    7
    You can also give https://nightcafe.studio/ a try if setting this up looks too daunting. It has stable diffusion and much more! People are making some super detailed and amazing creations. It helps to use starting images as well to get more in line with what you're trying to create. :wink:
     
  15. Xeraser

    Xeraser Producer

    Joined:
    Dec 9, 2020
    Messages:
    342
    Likes Received:
    127
    Location:
    Japari Park
    Services like that work on a credit basis, sooner or later you'll have to pay up to keep using it and you're limited to what they offer in terms of features and models. If you have the hardware required to run this smoothly I wholly recommend it over using one of those services. Plus these services usually "claim" whatever you generate. Not an issue if you're using the images as inputs for wavetable synths but if you're trying to sell an album...
     
  16. skeltoid

    skeltoid Kapellmeister

    Joined:
    May 2, 2018
    Messages:
    70
    Likes Received:
    50
    it hovered around 10% use at idle it stays at 2%
    so it did use some
     
  17. Xeraser

    Xeraser Producer

    Joined:
    Dec 9, 2020
    Messages:
    342
    Likes Received:
    127
    Location:
    Japari Park
  18. John Thompson

    John Thompson Kapellmeister

    Joined:
    Oct 11, 2019
    Messages:
    110
    Likes Received:
    56
    Ok Audiosexualism, I am here, I will try to do this. Thanks to OP and all for sharing.

    [​IMG]
     
Loading...
Similar Threads - Stable Diffusion (local Forum Date
Stable Audio, diffusion models for Audio Lounge Sep 19, 2023
AI generated Art Gallery (Stable Diffusion) humor Nov 18, 2022
Moss stable Ableton 11 version? Live Mar 8, 2024
Whats the best thing/s about having a woman with you in a stable relationship Lounge Sep 5, 2022
Most stable Ableton version? Live Aug 15, 2022
Loading...