diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4337bc39..011b31aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -167,7 +167,7 @@ package-api-twine: cache: key: files: - - api/dev-requirements.txt + - api/requirements/dev.txt paths: - .cache/pip policy: pull-push diff --git a/README.md b/README.md index 9c077399..c003a682 100644 --- a/README.md +++ b/README.md @@ -172,13 +172,26 @@ Update pip itself: ### Install pip packages -You can install of the necessary packages at once using [the `requirements.txt` file](./api/requirements.txt): +You can install all of the necessary packages at once using [the `requirements/base.txt` file](./api/requirements/base.txt) +and the `requirements/` file for your platform: ```shell -> pip install -r requirements.txt +> pip install -r requirements/base.txt -r requirements/amd-linux.txt +# or +> pip install -r requirements/base.txt -r requirements/amd-windows.txt +# or +> pip install -r requirements/base.txt -r requirements/amd-windows-nightly.txt +# or +> pip install -r requirements/base.txt -r requirements/cpu.txt +# or +> pip install -r requirements/base.txt -r requirements/nvidia.txt ``` -_Or_ you can install them manually using pip: +Only install one of the platform-specific requirements files, otherwise you may end up with the wrong version of +PyTorch or the ONNX runtime. The ONNX runtime nightly packages used by `amd-windows-nightly.txt` can be substantially +faster than the latest release, but may not always be stable. + +If you prefer, you can install all of the packages manually using pip: ```shell > pip install "numpy>=1.20,<1.24" diff --git a/api/Makefile b/api/Makefile index c5d59850..142ddd9a 100644 --- a/api/Makefile +++ b/api/Makefile @@ -13,7 +13,7 @@ pip: check-venv pip install -r requirements.txt pip-dev: check-venv - pip install -r dev-requirements.txt + pip install -r requirements/dev.txt test: python -m coverage run -m unittest discover -s tests/ diff --git a/api/requirements/amd-linux.txt b/api/requirements/amd-linux.txt new file mode 100644 index 00000000..aecfb7de --- /dev/null +++ b/api/requirements/amd-linux.txt @@ -0,0 +1,5 @@ +--index-url https://download.pytorch.org/whl/rocm5.2 +torch +--index-url https://download.pytorch.org/whl/rocm5.2 +torchvision +onnxruntime \ No newline at end of file diff --git a/api/requirements/amd-windows-nightly.txt b/api/requirements/amd-windows-nightly.txt new file mode 100644 index 00000000..2d8225ca --- /dev/null +++ b/api/requirements/amd-windows-nightly.txt @@ -0,0 +1,6 @@ +--index-url https://download.pytorch.org/whl/cpu +torch +--index-url https://download.pytorch.org/whl/cpu +torchvision +--index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/ +ort-nightly-directml \ No newline at end of file diff --git a/api/requirements/amd-windows.txt b/api/requirements/amd-windows.txt new file mode 100644 index 00000000..681b884a --- /dev/null +++ b/api/requirements/amd-windows.txt @@ -0,0 +1,5 @@ +--index-url https://download.pytorch.org/whl/cpu +torch +--index-url https://download.pytorch.org/whl/cpu +torchvision +onnxruntime-directml \ No newline at end of file diff --git a/api/requirements/base.txt b/api/requirements/base.txt new file mode 100644 index 00000000..1b2b664e --- /dev/null +++ b/api/requirements/base.txt @@ -0,0 +1,26 @@ +### Specific versions ### +numpy>=1.20,<1.24 +protobuf<4,>=3.20.2 + +### AI packages ### +accelerate +diffusers +onnx +# onnxruntime has many platform-specific packages +safetensors +transformers + +#### Upscaling and face correction +basicsr +codeformer-perceptor +facexlib +gfpgan +realesrgan + +### Server packages ### +boto3 +flask +flask-cors +jsonschema +pyyaml +setproctitle \ No newline at end of file diff --git a/api/requirements/cpu.txt b/api/requirements/cpu.txt new file mode 100644 index 00000000..4de3bff5 --- /dev/null +++ b/api/requirements/cpu.txt @@ -0,0 +1,4 @@ +--index-url https://download.pytorch.org/whl/cpu +torch +--index-url https://download.pytorch.org/whl/cpu +torchvision diff --git a/api/dev-requirements.txt b/api/requirements/dev.txt similarity index 100% rename from api/dev-requirements.txt rename to api/requirements/dev.txt diff --git a/api/requirements/nvidia.txt b/api/requirements/nvidia.txt new file mode 100644 index 00000000..fcca051d --- /dev/null +++ b/api/requirements/nvidia.txt @@ -0,0 +1,5 @@ +--index-url https://download.pytorch.org/whl/cu117 +torch +--index-url https://download.pytorch.org/whl/cu117 +torchvision +onnxruntime-gpu