From 58defa4240adf2346c2c23eb80a6bf82f337831c Mon Sep 17 00:00:00 2001 From: Nikita Selin Date: Thu, 28 Dec 2023 14:22:21 +1000 Subject: [PATCH 1/3] small http api fix and requirements update --- Dockerfile.cpu | 2 +- Dockerfile.cuda | 6 +++--- README.md | 4 ++-- carvekit/web/routers/api_router.py | 4 ++-- requirements.txt | 31 +++++++++++++++--------------- requirements_dev.txt | 2 +- requirements_test.txt | 2 +- 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/Dockerfile.cpu b/Dockerfile.cpu index 975093f..8fe55bb 100644 --- a/Dockerfile.cpu +++ b/Dockerfile.cpu @@ -2,7 +2,7 @@ FROM python:3.10.4 as builder WORKDIR /app # Models download stage -RUN pip3 install --no-cache-dir tqdm==4.64.0 requests==2.27.1 +RUN pip3 install --no-cache-dir tqdm==4.66.1 requests==2.31.0 RUN mkdir -p ./carvekit/utils/ RUN mkdir -p ./carvekit/ml/files COPY ./carvekit/__init__.py ./carvekit/__init__.py diff --git a/Dockerfile.cuda b/Dockerfile.cuda index b5d31df..8c77652 100644 --- a/Dockerfile.cuda +++ b/Dockerfile.cuda @@ -2,7 +2,7 @@ FROM python:3.10.4 as builder WORKDIR /app # Models download stage -RUN pip3 install --no-cache-dir tqdm==4.64.0 requests==2.27.1 +RUN pip3 install --no-cache-dir tqdm==4.66.1 requests==2.31.0 RUN mkdir -p ./carvekit/utils/ RUN mkdir -p ./carvekit/ml/files COPY ./carvekit/__init__.py ./carvekit/__init__.py @@ -14,7 +14,7 @@ COPY ./carvekit/ml/files/models_loc.py ./carvekit/ml/files/models_loc.py RUN python3 -c "from carvekit.ml.files.models_loc import download_all; download_all();" RUN rm -rf ./carvekit -FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime +FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime WORKDIR /app RUN apt-get update && apt-get -y install libgl1 libglib2.0-0 # Install cv2 dep. @@ -22,7 +22,7 @@ COPY --from=builder /root/.cache/carvekit /root/.cache/carvekit # Install requirements COPY requirements.txt ./ -RUN pip3 install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu113 +RUN pip3 install --no-cache-dir -r requirements.txt COPY requirements_test.txt ./ RUN pip3 install --no-cache-dir -r requirements_test.txt diff --git a/README.md b/README.md index 8f44cc7..d2f0961 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,8 @@ It can be briefly described as > The project supports python versions from 3.8 to 3.10.4 ## 🏷 Setup for GPU processing: 1. Make sure you have an NVIDIA GPU with 8 GB VRAM. -2. Install `CUDA Toolkit and Video Driver for your GPU` -3. `pip install carvekit --extra-index-url https://download.pytorch.org/whl/cu113` +2. Install `CUDA Toolkit 12.1 and Video Driver for your GPU` +3. `pip install carvekit --extra-index-url https://download.pytorch.org/whl/cu121` > The project supports python versions from 3.8 to 3.10.4 ## 🧰 Interact via code: ### If you don't need deep configuration or don't want to deal with it diff --git a/carvekit/web/routers/api_router.py b/carvekit/web/routers/api_router.py index c452cac..dbe1a15 100644 --- a/carvekit/web/routers/api_router.py +++ b/carvekit/web/routers/api_router.py @@ -113,8 +113,8 @@ async def removebg( scale=scale, position=position, channels=channels, - add_shadow=add_shadow, - semitransparency=semitransparency, + add_shadow="false", + semitransparency="false", bg_color=bg_color, ) except ValidationError as e: diff --git a/requirements.txt b/requirements.txt index ff21cf1..6f4c218 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,17 +1,16 @@ -requests~=2.27.1 -torch~=1.11.0 -Pillow==9.0.1 +requests~=2.31.0 +torch~=2.1.2 +Pillow==10.1.0 typing~=3.7.4.3 -torchvision~=0.12.0 -opencv-python~=4.5.5.64 -numpy~=1.22.4 -loguru~=0.6.0 -uvicorn~=0.17.6 -fastapi~=0.78.0 -starlette~=0.19.1 -pydantic~=1.9.1 -click~=8.1.3 -tqdm~=4.64.0 -setuptools~=62.3.2 -aiofiles~=0.8.0 -python-multipart~=0.0.5 \ No newline at end of file +torchvision~=0.16.2 +opencv-python~=4.8.1.78 +numpy~=1.26.2 +loguru~=0.7.2 +uvicorn~=0.25.0 +fastapi~=0.108.0 +pydantic~=2.5.3 +click~=8.1.7 +tqdm~=4.66.1 +setuptools~=69.0.3 +aiofiles~=23.2.1 +python-multipart~=0.0.6 \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt index eb6a8d8..1c7365f 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,2 +1,2 @@ -pre-commit==2.20.0 +pre-commit==3.6.0 diff --git a/requirements_test.txt b/requirements_test.txt index d1c2e1d..9f5995c 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,2 +1,2 @@ -pytest~=7.0.0 +pytest~=7.4.3 From b08d76c2d72d9a0fdbffb870acee9243fd1f142d Mon Sep 17 00:00:00 2001 From: Nikita Selin Date: Thu, 28 Dec 2023 14:43:16 +1000 Subject: [PATCH 2/3] The latest version of NumPy no longer supports Python 3.8, therefore we will discontinue its use. --- .github/workflows/master.yml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index e935eec..a082f07 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -12,7 +12,7 @@ jobs: test_package: strategy: matrix: - python-version: [3.8, 3.9, 3.10.4] + python-version: [3.9, 3.10.13] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index d2f0961..919c068 100644 --- a/README.md +++ b/README.md @@ -71,12 +71,12 @@ It can be briefly described as ## 🏷 Setup for CPU processing: 1. `pip install carvekit --extra-index-url https://download.pytorch.org/whl/cpu` -> The project supports python versions from 3.8 to 3.10.4 +> The project has been tested on Python versions ranging from 3.9 to 3.10.13. ## 🏷 Setup for GPU processing: 1. Make sure you have an NVIDIA GPU with 8 GB VRAM. 2. Install `CUDA Toolkit 12.1 and Video Driver for your GPU` 3. `pip install carvekit --extra-index-url https://download.pytorch.org/whl/cu121` -> The project supports python versions from 3.8 to 3.10.4 +> The project has been tested on Python versions ranging from 3.9 to 3.10.13. ## 🧰 Interact via code: ### If you don't need deep configuration or don't want to deal with it ``` python From 5256ac821909ff9870ebea4b98f58e3087bdf405 Mon Sep 17 00:00:00 2001 From: Nikita Selin Date: Thu, 28 Dec 2023 14:48:49 +1000 Subject: [PATCH 3/3] Fixed python version --- .github/workflows/master.yml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a082f07..d43ea10 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -12,7 +12,7 @@ jobs: test_package: strategy: matrix: - python-version: [3.9, 3.10.13] + python-version: [3.9, 3.10.4, 3.11.7] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index 919c068..e90ef2e 100644 --- a/README.md +++ b/README.md @@ -71,12 +71,12 @@ It can be briefly described as ## 🏷 Setup for CPU processing: 1. `pip install carvekit --extra-index-url https://download.pytorch.org/whl/cpu` -> The project has been tested on Python versions ranging from 3.9 to 3.10.13. +> The project has been tested on Python versions ranging from 3.9 to 3.11.7. ## 🏷 Setup for GPU processing: 1. Make sure you have an NVIDIA GPU with 8 GB VRAM. 2. Install `CUDA Toolkit 12.1 and Video Driver for your GPU` 3. `pip install carvekit --extra-index-url https://download.pytorch.org/whl/cu121` -> The project has been tested on Python versions ranging from 3.9 to 3.10.13. +> The project has been tested on Python versions ranging from 3.9 to 3.11.7. ## 🧰 Interact via code: ### If you don't need deep configuration or don't want to deal with it ``` python