Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Command errored out with exit status 128 #3

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b8df6e0
added cpuonly environment script
darkhemic Aug 25, 2022
572e2c3
install issue fix
darkhemic Aug 25, 2022
9c521f1
ease of use
darkhemic Aug 25, 2022
66b3957
lets you still install with cuda if you want
darkhemic Aug 25, 2022
ccad883
With WEBSITE NOW
darkhemic Aug 30, 2022
cb491bb
quick fix
darkhemic Aug 30, 2022
7d6c2c9
ANOTHER ONE
darkhemic Aug 30, 2022
a478b0d
readme changes
darkhemic Aug 30, 2022
d8a0d8a
trying to fix environment creation commands
darkhemic Aug 30, 2022
0d304dc
errors on my unclean install
darkhemic Aug 30, 2022
3f9d107
got upload instead of ignored
darkhemic Aug 30, 2022
f17b229
so far it's looking better
darkhemic Aug 30, 2022
a9d28bb
last edit i think
darkhemic Aug 30, 2022
dd9f9be
Merge pull request #1 from ModeratePrawn/main
darkhemic Sep 30, 2022
9ff8100
realesrgan cpu fix hopefully
darkhemic Sep 30, 2022
f06888d
easy to use scripts started
darkhemic Oct 1, 2022
dd9213f
Update README.md
darkhemic Oct 1, 2022
bf6b2a9
editing scripts and readme
darkhemic Oct 1, 2022
54ea7fe
scripts made executable
darkhemic Oct 1, 2022
3973a1a
Update run_sdco.sh
darkhemic Oct 1, 2022
97c8475
Update install_sdco.sh
darkhemic Oct 1, 2022
17af65f
adjustments
darkhemic Oct 1, 2022
55c4587
script editing
darkhemic Oct 1, 2022
adc93b3
fix
darkhemic Oct 1, 2022
759bbed
still not perfect
darkhemic Oct 1, 2022
ff9b7f3
Update README.md
darkhemic Oct 1, 2022
c51ada0
Update README.md
darkhemic Oct 1, 2022
38bea2a
Update README.md
darkhemic Oct 1, 2022
43ffafb
Update README.md
darkhemic Oct 1, 2022
19f3433
Update README.md
darkhemic Oct 1, 2022
ccd508b
windows bat installers
darkhemic Oct 1, 2022
e42f3e3
Update README.md
darkhemic Oct 1, 2022
e6c4eeb
Update README.md
darkhemic Oct 1, 2022
26f4068
Update README.md
darkhemic Oct 1, 2022
cf19467
Update README.md
darkhemic Oct 1, 2022
9078aba
Update README.md
darkhemic Oct 1, 2022
843cf9d
Update README.md
darkhemic Oct 1, 2022
0f32b07
Update README.md
darkhemic Oct 1, 2022
361d664
Update README.md
darkhemic Oct 1, 2022
c2689e1
GFPGAN model is needed in the folder
darkhemic Oct 1, 2022
0f22302
Update install_sdco.sh
darkhemic Oct 1, 2022
ad651f4
gfpgan
darkhemic Oct 1, 2022
e45100c
order of operations issue
darkhemic Oct 1, 2022
4544dfb
Update README.md
darkhemic Oct 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

model.ckpt
ldm/__pycache__/util.cpython-38.pyc
ldm/models/__pycache__/autoencoder.cpython-38.pyc
ldm/models/diffusion/__pycache__/__init__.cpython-38.pyc
ldm/models/diffusion/__pycache__/ddim.cpython-38.pyc
ldm/models/diffusion/__pycache__/ddpm.cpython-38.pyc
ldm/models/diffusion/__pycache__/plms.cpython-38.pyc
ldm/modules/__pycache__/attention.cpython-38.pyc
ldm/modules/__pycache__/ema.cpython-38.pyc
ldm/modules/__pycache__/x_transformer.cpython-38.pyc
ldm/modules/diffusionmodules/__pycache__/__init__.cpython-38.pyc
ldm/modules/diffusionmodules/__pycache__/model.cpython-38.pyc
ldm/modules/diffusionmodules/__pycache__/openaimodel.cpython-38.pyc
ldm/modules/diffusionmodules/__pycache__/util.cpython-38.pyc
ldm/modules/distributions/__pycache__/__init__.cpython-38.pyc
ldm/modules/distributions/__pycache__/distributions.cpython-38.pyc
ldm/modules/encoders/__pycache__/__init__.cpython-38.pyc
ldm/modules/encoders/__pycache__/modules.cpython-38.pyc
outputs/txt2img-samples/grid-0000.png
outputs/txt2img-samples/samples/00000.png
src/clip/
src/taming-transformers/
*.ckpt
*.png
condaenv.fintae5p.requirements.txt
GFPGAN/
*.pth
117 changes: 101 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,103 @@
# Stable Diffusion CPU only

This fork of Stable-Diffusion doesn't require a high end graphics card and runs exclusively on your cpu. It's been tested on Linux Mint 22.04 and Windows 10.

This isn't the fastest experience you'll have with stable diffusion but it does allow you to use it and most of the current set of features floating around on the internet such as txt2img, img2img, image upscaling with Real-ESRGAN and better faces with GFPGAN.

A install guide video is located here. https://www.youtube.com/watch?v=mTrA4uDiKzU&t=644s


##

## Requirements

### Windows and Linux requirements

Install Anaconda
https://www.anaconda.com/
Yes even on a linux system anaconda needs to be installed.

### Windows

##### Install Visual Studio Community Edition to build 1 file.
Click on the free download and make sure to check "Desktop Development with C++" when installing as per this image
(https://learn.microsoft.com/en-us/cpp/get-started/media/vs2022-installer-workloads.png?view=msvc-170)


https://visualstudio.microsoft.com/downloads/?q=build+tools



##### Install Git
https://git-scm.com/downloads
version control manager for code
we just use it to download repos from GitHub
Must be on system PATH, When installing select the option add to system PATH

##### Install Wget
used to download models for projects
Windows users need this verison
https://eternallybored.org/misc/wget/
download the .exe and I copied it to my C:/Windows/System directory (this isn't the correct way just the fastest to get it working)


reboot your system just to make sure everything is properly loaded up.

### Linux Mint 22.04

Install git and wget with the following command
```
sudo apt-get -y install git wget build-essential
```
## Installation of Stable-Diffusion-cpuonly

### Download Stable-Diffusion-cpuonly

Copy this github repository and extract the files.

### Download the CompVis Stable-diffusion model.

Go here and download the correct mode from here. You'll have to agree to the license setup an account but this is the bread and butter AI art generating learning model.

https://huggingface.co/CompVis/stable-diffusion-v-1-4-original

copy the file to your stable-diffusion-cpuonly-main directory

### Download the GFPGAN model

https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth

copy the file to your stable-diffusion-cpuponly-main directory

### Windows - Running the install script

open a terminal or powershell and cd to your stable-diffusion-cpuonly-main directory and run
```
.\install_sdco.bat
```

### Linux - Running the install script
open a terminal or powershell and cd to your stable-diffusion-cpuonly-main directory and run
```
bash -i install_sdco.sh
```

## Windows - Starting Stable-Diffusion-cpuonly

Run the following command

```
.\run_sdco.bat
```
## Linux - Starting Stable-Diffusion-cpuonly

Run the following command

```
bash -i run_sdco.sh
```


# Stable Diffusion
*Stable Diffusion was made possible thanks to a collaboration with [Stability AI](https://stability.ai/) and [Runway](https://runwayml.com/) and builds upon our previous work:*

Expand All @@ -19,23 +119,8 @@ this model uses a frozen CLIP ViT-L/14 text encoder to condition the model on te
With its 860M UNet and 123M text encoder, the model is relatively lightweight and runs on a GPU with at least 10GB VRAM.
See [this section](#stable-diffusion-v1) below and the [model card](https://huggingface.co/CompVis/stable-diffusion).


## Requirements
A suitable [conda](https://conda.io/) environment named `ldm` can be created
and activated with:
##

```
conda env create -f environment.yaml
conda activate ldm
```

You can also update an existing [latent diffusion](https://github.com/CompVis/latent-diffusion) environment by running

```
conda install pytorch torchvision -c pytorch
pip install transformers==4.19.2 diffusers invisible-watermark
pip install -e .
```


## Stable Diffusion v1
Expand Down
14 changes: 8 additions & 6 deletions environment.yaml → environment-cpuonly.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
name: ldm
name: sdco
channels:
- pytorch
- defaults
dependencies:
- python=3.8.5
- pip=20.3
- cudatoolkit=11.3
- pytorch=1.11.0
- torchvision=0.12.0
- numpy=1.19.2
- pip:
- lmdb
- pyyaml
- scipy
- tb-nightly
- tqdm
- yapf
- albumentations==0.4.3
- diffusers
- opencv-python==4.1.2.30
- opencv-python-headless
- pudb==2019.2
- invisible-watermark
- imageio==2.9.0
Expand All @@ -26,6 +30,4 @@ dependencies:
- transformers==4.19.2
- torchmetrics==0.6.0
- kornia==0.6
- -e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers
- -e git+https://github.com/openai/CLIP.git@main#egg=clip
- -e .
Binary file added images/attention-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/loopback.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/prompt_matrix.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/resizing.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/scripting.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/sd-upscale.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions install_sdco.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
echo This Script is now installing a Stable Diffusion cpu only variant.

mkdir "models/ldm/stable-diffusion-v1/"
mkdir "outputs/extras-samples"
mkdir "outputs/img2img-samples/samples"
mkdir "outputs/txt2img-samples/samples"

call conda install pytorch torchvision torchaudio cpuonly -c pytorch
call conda env create -f environment-cpuonly.yaml
call conda activate sdco

call pip install pynvml gradio keras-unet fairseq basicsr facexlib
call pip install -e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers
call pip install -e git+https://github.com/openai/CLIP.git@main#egg=clip
call pip install -e git+https://github.com/TencentARC/GFPGAN#egg=GFPGAN
call pip install -e git+https://github.com/xinntao/Real-ESRGAN#egg=realesrgan
call pip install -e git+https://github.com/hlky/k-diffusion-sd#egg=k_diffusion
copy sd-v1-4.ckpt "models/ldm/stable-diffusion-v1/model.ckpt"
del sd-v1-4.ckpt
copy GFPGANv1.3.pth "src/gfpgan/experiments/pretrained_models/GFPGANv1.3.pth"
del GFPGANv1.3.pth


23 changes: 23 additions & 0 deletions install_sdco.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

echo This Script is now installing a Stable Diffusion cpu only variant.

mkdir -p models/ldm/stable-diffusion-v1/
mkdir -p outputs/extras-samples
mkdir -p outputs/img2img-samples/samples
mkdir -p outputs/txt2img-samples/samples

conda install pytorch torchvision torchaudio cpuonly -c pytorch
conda env create -f environment-cpuonly.yaml
conda activate sdco

pip install pynvml gradio keras-unet fairseq basicsr facexlib
pip install -e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers
pip install -e git+https://github.com/openai/CLIP.git@main#egg=clip
pip install -e git+https://github.com/TencentARC/GFPGAN#egg=GFPGAN
pip install -e git+https://github.com/xinntao/Real-ESRGAN#egg=realesrgan
pip install -e git+https://github.com/hlky/k-diffusion-sd#egg=k_diffusion
cp sd-v1-4.ckpt models/ldm/stable-diffusion-v1/model.ckpt
rm sd-v1-4.ckpt
cp GFPGANv1.3.pth src/gfpgan/experiments/pretrained_models/GFPGANv1.3.pth
rm GFPGANv1.3.pth
4 changes: 4 additions & 0 deletions latent_diffusion.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Metadata-Version: 2.1
Name: latent-diffusion
Version: 0.0.1
License-File: LICENSE
8 changes: 8 additions & 0 deletions latent_diffusion.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
LICENSE
README.md
setup.py
latent_diffusion.egg-info/PKG-INFO
latent_diffusion.egg-info/SOURCES.txt
latent_diffusion.egg-info/dependency_links.txt
latent_diffusion.egg-info/requires.txt
latent_diffusion.egg-info/top_level.txt
1 change: 1 addition & 0 deletions latent_diffusion.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions latent_diffusion.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
torch
numpy
tqdm
1 change: 1 addition & 0 deletions latent_diffusion.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions logs/txt2img_logs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
prompt,outdir,skip_grid,skip_save,ddim_steps,fixed_code,ddim_eta,n_iter,H,W,C,f,n_samples,n_rows,scale,device,from_file,seed,unet_bs,turbo,precision,format
a painting of a virus monster playing guitar,outputs/txt2img-samples,False,False,50,False,0.0,1,512,512,4,8,5,0,7.5,cuda,,99270,1,False,autocast,png
3 changes: 3 additions & 0 deletions run_sdco.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
call conda activate sdco
python ./webui.py --no-half

3 changes: 3 additions & 0 deletions run_sdco.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
conda activate sdco
python ./webui.py --no-half
4 changes: 2 additions & 2 deletions scripts/latent_imagenet_diffusion.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"language_info": {
"name": "python"
},
"accelerator": "GPU"
"accelerator": "CPU"
},
"cells": [
{
Expand Down Expand Up @@ -426,4 +426,4 @@
"outputs": []
}
]
}
}
3 changes: 3 additions & 0 deletions stop_sdco.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

conda deactivate
4 changes: 4 additions & 0 deletions uninstall_sdco.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

conda env remove -n sdco

Loading