EveryDream2trainer/doc/SETUP.md

115 lines
5.1 KiB
Markdown
Raw Permalink Normal View History

## For Runpod/Vast instructions see [Cloud Setup](/doc/CLOUD_SETUP.md)
2023-02-09 17:56:14 -07:00
## For Google Colab see [Train_Colab.ipynb](/Train_Colab.ipynb)
2022-12-17 20:32:48 -07:00
## Install Python
2022-12-18 11:03:44 -07:00
Install Python 3.10 from here if you do not already have Python 3.10.x installed.
2022-12-17 20:32:48 -07:00
https://www.python.org/downloads/release/python-3109/
https://www.python.org/ftp/python/3.10.9/python-3.10.9-amd64.exe
Download and install Git from [git-scm.com](https://git-scm.com/).
or [Git for windows](https://gitforwindows.org/)
2022-12-17 23:21:35 -07:00
Make sure Python 3.10 shows on your command window:
python --version
2022-12-18 11:03:44 -07:00
You should see ```Python 3.10.something```. 3.10.5, 3.10.9, etc. It needs to be 3.10.x.
2022-12-17 23:21:35 -07:00
If you have Python 3.10.x installed but your command window shows another version (3.8.x, 3.9.x) ask for assistance in the discord.
2022-12-18 11:03:44 -07:00
...or you can try setting the path to the 310 binaries before running the windows_setup.cmd if you know what you're doing.
2022-12-17 23:21:35 -07:00
SET PYTHON=C:\Python310\python.exe
2022-12-18 11:03:44 -07:00
*(you'll have to locate python 310 on your system on your own if you)*
2022-12-17 23:21:35 -07:00
2022-12-17 20:32:48 -07:00
## Clone this repo
Clone the repo from normal command line then change into the directory:
2022-12-18 11:03:44 -07:00
git clone https://github.com/victorchall/EveryDream2trainer
Then change into the folder:
2022-12-17 20:32:48 -07:00
2022-12-18 11:03:44 -07:00
cd EveryDream2trainer
2022-12-17 20:32:48 -07:00
## Windows
2022-12-18 11:03:44 -07:00
While still in the command window, run windows_setup.cmd to create your venv and install dependencies.
2022-12-17 20:32:48 -07:00
2022-12-17 20:38:39 -07:00
windows_setup.cmd
2022-12-17 20:32:48 -07:00
2022-12-17 23:21:35 -07:00
Double check your python version again after setup by running these two commands:
activate_venv.bat
python --version
2022-12-18 11:03:44 -07:00
Again, this should show 3.10.x
Finally, install CUDA 11.8 from this link: `https://developer.nvidia.com/cuda-11-8-0-download-archive`
## Local docker container
2023-03-31 09:49:54 -06:00
```sh
docker compose up
```
And you can either get a shell via:
```sh
docker exec -it everydream2trainer-docker-everydream2trainer-1 /bin/bash
```
Or go to your browser and hit `http://localhost:8888`. The web password is
`test1234` but you can change that in `docker-compose.yml`.
Your current source directory will be moutned to the Jupyter notebook.
2023-06-14 13:04:35 -06:00
## Local Linux install
2023-06-14 13:53:36 -06:00
### Preinstallation
* Make sure you have python3.10 installed. Often this is `python3` so check with `python3 -V`
2023-06-14 13:04:35 -06:00
* Make sure Linux Nvidia driver is up to date and working.
Check that `nvidia-smi` is working and shows your GPU.
2023-06-14 13:53:36 -06:00
Steps to update the driver may depend on the Linux distribution you use. For Ubuntu, use Gnome and open `Softwrae & Updates`, go to the `additional drivers` tab and select `Using NVIDIA driver metapackage from nvidia-driver-530 (proprietary)`. Currently `530` is the latest version, but you can use latest at your time of install.
2023-06-14 13:04:35 -06:00
*You will need to use the proprietary driver.*
2023-06-14 13:53:36 -06:00
* Install Cuda 11.8. You can use this link for Ubuntu: https://developer.nvidia.com/cuda-11-8-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local for Ubuntu 22.04 for instance. Your install may vary depending on Linux distribution, make sure to select appropriate options.
* Most problems arise from improper driver or cuda install and will not successfully run `nvidia-smi` (various errors like `command not found` or `driver mismatch`). Make sure `nvidia-smi` runs and prints your GPU information before continuing.
* Install git with `sudo apt-get git`
* Suggested: Enable git lfs support, follow instructions: https://github.com/git-lfs/git-lfs/blob/main/INSTALLING.md
* Optional: Enable remote desktop and/or SSH (see instructions for your distribution)
* Optional if you'd rather use conda instead of VENV: Install miniconda, `wget` the appropriate bash script then run it: https://docs.conda.io/en/latest/miniconda.html#linux-installers
### ED2 setup
2023-06-14 13:04:35 -06:00
* `git clone https://github.com/victorchall/EveryDream2trainer`
* `cd EveryDream2trainer`
* `python3 -m venv venv`
* `source venv/bin/activate`
2023-06-14 13:53:36 -06:00
At this point `python -V` should return 3.10 and `which python` should return something like `/home/username/EveryDream2trainer/venv/bin/python` so you can just use `python` to run instead of `python3` if you like. YMMV based on distribution.
2023-06-14 13:04:35 -06:00
* `pip install -r requirements.txt`
2023-06-14 13:53:36 -06:00
Should be good to go.
Conda should be something like this (untested)
* `git clone https://github.com/victorchall/EveryDream2trainer`
* `cd EveryDream2trainer`
* `conda create --name ed2 python=3.10`
* `conda activate ed2`
* `pip install -r requirements.txt`
2023-06-21 10:59:45 -06:00
### Ensure BitsandBytes can find CUDA
Bitsandbytes (AdamW8Bit, etc) needs to find the location of your CUDA libraries. It attempts to find it in a few locations, but this likely will require an extra step.
This may vary slightly based on distribution.
Find the cuda library location:
`find / -name libcudart.so* 2>/dev/null`
example result:
`/home/freon/EveryDream2trainer/venv/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/libcudart.so.11.0 /home/freon/ml-ed2/venv/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/libcudart.so.11.0`
Set path hint for bitsandbytes (should work with either example above)
`export LD_LIBRARY_PATH=/home/freon/EveryDream2trainer/venv/lib/python3.10/site-packages/nvidia/cuda_runtime/lib`
You may wish to set this up as part of a startup script such as your `~/.bashrc` to make sure it is set on every login.