2022-09-15 14:53:41 +00:00
|
|
|
---
|
|
|
|
title: Windows
|
|
|
|
---
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
## **Notebook install (semi-automated)**
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
We have a
|
|
|
|
[Jupyter notebook](https://github.com/lstein/stable-diffusion/blob/main/notebooks/Stable-Diffusion-local-Windows.ipynb)
|
|
|
|
with cell-by-cell installation steps. It will download the code in this repo as
|
|
|
|
one of the steps, so instead of cloning this repo, simply download the notebook
|
|
|
|
from the link above and load it up in VSCode (with the appropriate extensions
|
|
|
|
installed)/Jupyter/JupyterLab and start running the cells one-by-one.
|
2022-09-11 17:05:38 +00:00
|
|
|
|
|
|
|
Note that you will need NVIDIA drivers, Python 3.10, and Git installed
|
2022-09-15 14:53:41 +00:00
|
|
|
beforehand - simplified
|
|
|
|
[step-by-step instructions](https://github.com/lstein/stable-diffusion/wiki/Easy-peasy-Windows-install)
|
2022-09-11 17:05:38 +00:00
|
|
|
are available in the wiki (you'll only need steps 1, 2, & 3 ).
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
## **Manual Install**
|
|
|
|
|
|
|
|
### **pip**
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
See
|
|
|
|
[Easy-peasy Windows install](https://github.com/lstein/stable-diffusion/wiki/Easy-peasy-Windows-install)
|
2022-09-11 15:52:43 +00:00
|
|
|
in the wiki
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
---
|
|
|
|
|
2022-09-11 15:52:43 +00:00
|
|
|
### **Conda**
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
1. Install Anaconda3 (miniconda3 version) from here:
|
|
|
|
https://docs.anaconda.com/anaconda/install/windows/
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
2. Install Git from here: https://git-scm.com/download/win
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
3. Launch Anaconda from the Windows Start menu. This will bring up a command
|
|
|
|
window. Type all the remaining commands in this window.
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
4. Run the command:
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
```bash
|
|
|
|
git clone https://github.com/lstein/stable-diffusion.git
|
|
|
|
```
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
This will create stable-diffusion folder where you will follow the rest of
|
|
|
|
the steps.
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
5. Enter the newly-created stable-diffusion folder. From this step forward make
|
|
|
|
sure that you are working in the stable-diffusion directory!
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
```bash
|
|
|
|
cd stable-diffusion
|
|
|
|
```
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
6. Run the following two commands:
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
```bash
|
|
|
|
conda env create -f environment.yaml (step 6a)
|
|
|
|
conda activate ldm (step 6b)
|
|
|
|
```
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
This will install all python requirements and activate the "ldm" environment
|
|
|
|
which sets PATH and other environment variables properly.
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
7. Run the command:
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
```bash
|
|
|
|
python scripts\preload_models.py
|
|
|
|
```
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
This installs several machine learning models that stable diffusion requires.
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
Note: This step is required. This was done because some users may might be
|
|
|
|
blocked by firewalls or have limited internet connectivity for the models to
|
|
|
|
be downloaded just-in-time.
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
8. Now you need to install the weights for the big stable diffusion model.
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
- For running with the released weights, you will first need to set up an
|
|
|
|
acount with Hugging Face (https://huggingface.co).
|
|
|
|
- Use your credentials to log in, and then point your browser at
|
|
|
|
https://huggingface.co/CompVis/stable-diffusion-v-1-4-original.
|
|
|
|
- You may be asked to sign a license agreement at this point.
|
|
|
|
- Click on "Files and versions" near the top of the page, and then click on
|
|
|
|
the file named `sd-v1-4.ckpt`. You'll be taken to a page that prompts you
|
|
|
|
to click the "download" link. Now save the file somewhere safe on your
|
|
|
|
local machine.
|
|
|
|
- The weight file is >4 GB in size, so downloading may take a while.
|
|
|
|
|
|
|
|
Now run the following commands from **within the stable-diffusion directory**
|
|
|
|
to copy the weights file to the right place:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
mkdir -p models\ldm\stable-diffusion-v1
|
|
|
|
copy C:\path\to\sd-v1-4.ckpt models\ldm\stable-diffusion-v1\model.ckpt
|
|
|
|
```
|
|
|
|
|
|
|
|
Please replace `C:\path\to\sd-v1.4.ckpt` with the correct path to wherever
|
|
|
|
you stashed this file. If you prefer not to copy or move the .ckpt file, you
|
|
|
|
may instead create a shortcut to it from within
|
|
|
|
`models\ldm\stable-diffusion-v1\`.
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
9. Start generating images!
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
```bash
|
|
|
|
# for the pre-release weights
|
|
|
|
python scripts\dream.py -l
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
# for the post-release weights
|
|
|
|
python scripts\dream.py
|
|
|
|
```
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
10. Subsequently, to relaunch the script, first activate the Anaconda command
|
|
|
|
window (step 3),enter the stable-diffusion directory (step 5,
|
|
|
|
`cd \path\to\stable-diffusion`), run `conda activate ldm` (step 6b), and
|
|
|
|
then launch the dream script (step 9).
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
**Note:** Tildebyte has written an alternative
|
|
|
|
["Easy peasy Windows install"](https://github.com/lstein/stable-diffusion/wiki/Easy-peasy-Windows-install)
|
|
|
|
which uses the Windows Powershell and pew. If you are having trouble with
|
|
|
|
Anaconda on Windows, give this a try (or try it first!)
|
|
|
|
|
|
|
|
---
|
2022-09-11 15:52:43 +00:00
|
|
|
|
|
|
|
### Updating to newer versions of the script
|
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
This distribution is changing rapidly. If you used the `git clone` method
|
|
|
|
(step 5) to download the stable-diffusion directory, then to update to the
|
|
|
|
latest and greatest version, launch the Anaconda window, enter
|
|
|
|
`stable-diffusion`, and type:
|
2022-09-11 15:52:43 +00:00
|
|
|
|
2022-09-15 14:53:41 +00:00
|
|
|
```bash
|
2022-09-11 15:52:43 +00:00
|
|
|
git pull
|
2022-09-11 17:05:38 +00:00
|
|
|
conda env update -f environment.yaml
|
2022-09-11 15:52:43 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
This will bring your local copy into sync with the remote one.
|