Skip to content

stablediffusion Setup

Stable Diffusion is a machine learning model developed by Stability AI to generate digital images from natural language descriptions. The model can be used for different tasks like generating image to image translations guided by text prompt and upscaling images. We will be following this guide to install the software:

Initial Setup

[ 10.0.0.10/16 ] [ nowhere ] [~]
→ yay -S miniconda
 -> Could not find all required packages:
        miniconda (Target)

[ 10.0.0.10/16 ] [ nowhere ] [~]
→ yay -S miniconda3
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur:1]  miniconda3-4.12.0-1

:: (1/1) Downloaded PKGBUILD: miniconda3
  1 miniconda3                       (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==>
:: (1/1) Parsing SRCINFO: miniconda3
==> Making package: miniconda3 4.12.0-1 (Sat 03 Sep 2022 12:38:58 PM CEST)
==> Retrieving sources...
  -> Downloading miniconda3-4.12.0.sh...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 73.0M  100 73.0M    0     0  6490k      0  0:00:11  0:00:11 --:--:-- 7318k
==> Validating source files with sha512sums...
    miniconda3-4.12.0.sh ... Passed
==> Making package: miniconda3 4.12.0-1 (Sat 03 Sep 2022 12:39:10 PM CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found miniconda3-4.12.0.sh
==> Validating source files with sha512sums...
    miniconda3-4.12.0.sh ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
==> Sources are ready.
==> Making package: miniconda3 4.12.0-1 (Sat 03 Sep 2022 12:39:11 PM CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Entering fakeroot environment...
==> Starting package()...
PREFIX=/home/nothing/.cache/yay/miniconda3/pkg/miniconda3/opt/miniconda3
Unpacking payload ...
Collecting package metadata (current_repodata.json): done
Solving environment: done

[...]

[ 10.0.0.10/16 ] [ nowhere ] [~]
→ echo "[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh" >> ~/.zshrc

[ 10.0.0.10/16 ] [ nowhere ] [~]
→ zsh

[ 10.0.0.10/16 ] [ nowhere ] [~]
→ conda --help
usage: conda [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.

Options:

positional arguments:
  command
    clean        Remove unused packages and caches.
    compare      Compare packages between conda environments.
    config       Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (/home/nothing/.condarc) by default.
    create       Create a new conda environment from a list of specified packages.
    help         Displays a list of available conda commands and their help strings.
    info         Display information about current conda install.
    init         Initialize conda for shell interaction. [Experimental]
    install      Installs a list of packages into a specified conda environment.
    list         List linked packages in a conda environment.
    package      Low-level conda package utility. (EXPERIMENTAL)
    remove       Remove a list of packages from a specified conda environment.
    uninstall    Alias for conda remove.
    run          Run an executable in a conda environment.
    search       Search for packages and display associated information. The input is a MatchSpec, a query language for conda packages. See examples below.
    update       Updates conda packages to the latest compatible version.
    upgrade      Alias for conda update.

optional arguments:
  -h, --help     Show this help message and exit.
  -V, --version  Show the conda version number and exit.

conda commands available from other packages:
  content-trust
  env

[ 10.0.0.10/16 ] [ nowhere ] [~]
→ mkdir stablediffusion

[ 10.0.0.10/16 ] [ nowhere ] [~]
→ cd stablediffusion

[ 10.0.0.10/16 ] [ nowhere ] [~/stablediffusion]
→ wget https://raw.githubusercontent.com/JoshuaKimsey/Linux-StableDiffusion-Script/main/linux-sd.sh -O linux-sd.sh

linux-sd.sh                                                                                         [ <=>                                                                                                                                                                                                                                                    ] 224.68K  --.-KB/s    in 0.1s

2022-09-03 13:11:39 (2.07 MB/s) - ‘linux-sd.sh’ saved [230076]


[ 10.0.0.10/16 ] [ nowhere ] [~/stablediffusion]
→ chmod +x linux-sd.sh

[ 10.0.0.10/16 ] [ nowhere ] [~/stablediffusion]
→ ./linux-sd.sh



WELCOME TO THE ULTIMATE STABLE DIFFUSION GUI ON LINUX


The definitive Stable Diffusion experience™ Now 100% Linux Compatible!

Please ensure you have Anaconda installed properly on your Linux system before running this.

Please refer to the original guide for more info and additional links for this project: https://rentry.org/guitard


Starting Ultimate Stable Diffusion installation...

Cloning Ultimate Stable Diffusion. Please wait...
Cloning into 'stable-diffusion'...
remote: Enumerating objects: 1121, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 1121 (delta 1), reused 2 (delta 0), pack-reused 1116
Receiving objects: 100% (1121/1121), 42.76 MiB | 7.54 MiB/s, done.
Resolving deltas: 100% (558/558), done.


########## MOVE MODEL FILE ##########

Please download the 1.4 AI Model from Huggingface (or another source) and move or copy it in the newly created directory: Models
Once you have sd-v1-4.ckpt in the Models directory, Press Enter...

Here we need to download the AI Model after registering on https://huggingface.co here:

[term1]
[ 10.0.0.10/16 ] [ nowhere ] [~/stablediffusion/Models]
→ mv ~/Downloads/sd-v1-4.ckpt .

[ 10.0.0.10/16 ] [ nowhere ] [~/stablediffusion/Models]
→ file model.ckpt
model.ckpt: Zip archive data, at least v0.0 to extract, compression method=store

[term2]
########## MOVE MODEL FILE ##########

Please download the 1.4 AI Model from Huggingface (or another source) and move or copy it in the newly created directory: Models
Once you have sd-v1-4.ckpt in the Models directory, Press Enter...
./Models/sd-v1-4.ckpt: OK

[...]


########## CUSTOMIZE LAUNCH ARGUMENTS ##########

Do you wish to customize the launch arguments for Ultimate Stable Diffusion?
(This will be where you select Optimized mode, auto open in browser, share to public, and more.)
1) Yes
2) No
#? 1
Starting customization of Ultimate Stable Diffusion launch arguments...


Do you want extra upscaling models to be run on the CPU instead of the GPU to save on VRAM at the cost of speed?
1) Yes
2) No
#? 2
Extra upscaling models will run on the GPU. Continuing...


Do you want for Ultimate Stable Diffusion to automatically launch a new browser window or tab on first launch?
1) Yes
2) No
#? 1
Setting Ultimate Stable Diffusion to open a new browser window/tab at first launch...


Do you want to run Ultimate Stable Diffusion in Optimized mode - Requires only 4GB of VRAM, but is significantly slower?
1) Yes
2) No
#? 2
Ultimate Stable Diffusion will launch in Standard Mode. Continuing...


Do you want to start Ultimate Stable Diffusion in Optimized Turbo mode - Requires more VRAM than regular optimized, but is faster (incompatible with Optimized Mode)?
1) Yes
2) No
#? 2
Ultimate Stable Diffusion will launch in Standard Mode. Continuing...


Do you want to create a public xxxxx.gradi.app URL to allow others to uses your interface? (Requires properly forwarded ports)
1) Yes
2) No
#? 2
Setting Ultimate Stable Diffusion to not open a public share URL. Continuing...


Customization of Ultimate Stable Diffusion is complete. Continuing...

Generating linux-setup.sh in ./ultimate-stable-diffusion
Running linux-setup.sh...
Relauncher: Launching...

Nihilist
Donate XMR to Nihilist:
8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o
7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8