From 977aa56ab8f3348f3d13263238b5645433d023b3 Mon Sep 17 00:00:00 2001 From: Josh Bailey Date: Fri, 17 Nov 2023 01:54:15 +0000 Subject: [PATCH] Move to iqtlabs/torchserve. --- .github/workflows/docker-extras.yml | 102 -------------------------- .github/workflows/docker-test.yml | 23 +----- docker/Dockerfile.cuda-torchserve | 14 ---- docker/Dockerfile.orin-torchserve | 20 ----- docker/Dockerfile.torchserve | 9 --- docker/README.md | 4 +- tests/test_torchserve.sh | 2 +- torchserve-cuda.yml | 2 +- torchserve.yml | 2 +- torchserve/config.properties | 6 -- torchserve/install-orin-torchserve.sh | 23 ------ torchserve/install-torchserve.sh | 15 ---- torchserve/torchserve-entrypoint.sh | 2 - 13 files changed, 5 insertions(+), 219 deletions(-) delete mode 100644 docker/Dockerfile.cuda-torchserve delete mode 100644 docker/Dockerfile.orin-torchserve delete mode 100644 docker/Dockerfile.torchserve delete mode 100644 torchserve/config.properties delete mode 100755 torchserve/install-orin-torchserve.sh delete mode 100755 torchserve/install-torchserve.sh delete mode 100755 torchserve/torchserve-entrypoint.sh diff --git a/.github/workflows/docker-extras.yml b/.github/workflows/docker-extras.yml index 30cff735..e5eb41f3 100644 --- a/.github/workflows/docker-extras.yml +++ b/.github/workflows/docker-extras.yml @@ -6,108 +6,6 @@ on: tags: 'v*' jobs: - buildx-torchserve: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - - name: Change for main - id: change_version - run: if [ "${{ steps.get_version.outputs.VERSION }}" == "main" ]; then echo ::set-output name=VERSION::latest; else echo ::set-output name=VERSION::${{ steps.get_version.outputs.VERSION }}; fi - - name: Set up qemu - uses: docker/setup-qemu-action@v3 - with: - platforms: all - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - name: Docker Login - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }} - run: | - echo "${DOCKER_PASSWORD}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin - if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' - - name: Build and push platforms - uses: docker/build-push-action@v5 - with: - context: . - file: docker/Dockerfile.torchserve - platforms: linux/amd64,linux/arm64 - push: true - tags: iqtlabs/gamutrf-torchserve:${{ steps.change_version.outputs.VERSION }} - if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' - buildx-orin-torchserve: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - - name: Change for main - id: change_version - run: if [ "${{ steps.get_version.outputs.VERSION }}" == "main" ]; then echo ::set-output name=VERSION::latest; else echo ::set-output name=VERSION::${{ steps.get_version.outputs.VERSION }}; fi - - name: Set up qemu - uses: docker/setup-qemu-action@v3 - with: - platforms: all - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - name: Docker Login - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }} - run: | - echo "${DOCKER_PASSWORD}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin - if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' - - name: Build and push platforms - uses: docker/build-push-action@v5 - with: - context: . - file: docker/Dockerfile.orin-torchserve - platforms: linux/arm64 - push: true - tags: iqtlabs/gamutrf-orin-torchserve:${{ steps.change_version.outputs.VERSION }} - if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' - buildx-cuda-torchserve: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - - name: Change for main - id: change_version - run: if [ "${{ steps.get_version.outputs.VERSION }}" == "main" ]; then echo ::set-output name=VERSION::latest; else echo ::set-output name=VERSION::${{ steps.get_version.outputs.VERSION }}; fi - - name: Set up qemu - uses: docker/setup-qemu-action@v3 - with: - platforms: all - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - name: Docker Login - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }} - run: | - echo "${DOCKER_PASSWORD}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin - if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' - - name: Build and push platforms - uses: docker/build-push-action@v5 - with: - context: . - file: docker/Dockerfile.cuda-torchserve - platforms: linux/amd64 - push: true - tags: iqtlabs/gamutrf-cuda-torchserve:${{ steps.change_version.outputs.VERSION }} - if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' buildx-mqtt: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 15b2c905..6c89e9b7 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -1,33 +1,12 @@ name: docker-test on: [push, pull_request] jobs: - test-orin-torchserve: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up qemu - uses: docker/setup-qemu-action@v3 - with: - platforms: all - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - name: Build - uses: docker/build-push-action@v5 - with: - context: . - file: docker/Dockerfile.orin-torchserve - platforms: linux/arm64 - push: false - test-gamutrf-torchserve-image: + test-gamutrf-torchserve: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: docker build run: | - docker build -f docker/Dockerfile.torchserve . -t iqtlabs/gamutrf-torchserve:latest ./tests/test_torchserve.sh test-gamutrf-extra-images: runs-on: ubuntu-latest diff --git a/docker/Dockerfile.cuda-torchserve b/docker/Dockerfile.cuda-torchserve deleted file mode 100644 index 3cc0166a..00000000 --- a/docker/Dockerfile.cuda-torchserve +++ /dev/null @@ -1,14 +0,0 @@ -FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04 -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root -COPY torchserve/install-torchserve.sh /torchserve/install-torchserve.sh -RUN /torchserve/install-torchserve.sh --cuda cu118 -RUN /usr/local/bin/torchserve --help -COPY torchserve/config.properties /torchserve/config.properties -COPY torchserve/torchserve-entrypoint.sh /torchserve/torchserve-entrypoint.sh -ENTRYPOINT ["/torchserve/torchserve-entrypoint.sh"] - -# see Dockerfile.torchserve for example, but use -# docker run --gpus all -ti iqtlabs/gamutrf-cuda-torchserve:latest bash -# ensure nvidia-container-toolkit is installed (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) -# CUDA version on the host must be same or later, than that in this container. diff --git a/docker/Dockerfile.orin-torchserve b/docker/Dockerfile.orin-torchserve deleted file mode 100644 index 36c3bea6..00000000 --- a/docker/Dockerfile.orin-torchserve +++ /dev/null @@ -1,20 +0,0 @@ -FROM nvcr.io/nvidia/l4t-pytorch:r35.2.1-pth2.0-py3 -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root -COPY torchserve/install-orin-torchserve.sh /torchserve/install-orin-torchserve.sh -RUN /torchserve/install-orin-torchserve.sh -RUN /usr/local/bin/torchserve --help -COPY torchserve/config.properties /torchserve/config.properties -COPY torchserve/torchserve-entrypoint.sh /torchserve/torchserve-entrypoint.sh -CMD ["/torchserve/torchserve-entrypoint.sh"] - -# 0. Always start from a clean sdkmanager, installation of Ubuntu 20.04. DO NOT attempt an in-place JetPack upgrade, DO NOT try to install docker-ce, and DO NOT try to re-install/replace CUDA without re-imaging the entire system. -# 1. Install JetPack via apt: https://docs.nvidia.com/jetson/jetpack/install-jetpack/index.html#install-jetpack. apt show nvidia-jetpack should show 5.1.2. -# 2. sudo apt-get disc-upgrade, reboot -# 3. git clone https://github.com/iqtlabs/gamutrf -# 4. cd gamutrf ; vi tests/test_torchserve.sh -# Change the docker run command line as follows: -# a) Change gamutrf-torchserve to gamutrf-orin-torchserve -# b) Insert —-runtime nvidia as first args, after docker run -# 5. sudo apt-get install python3-pip -# 6. Run tests/test_torchserve.sh. A successful test will print JSON prediction results. It may take 60s after the container starts, for it to return inference results as the model server installs ultralytics diff --git a/docker/Dockerfile.torchserve b/docker/Dockerfile.torchserve deleted file mode 100644 index eb0609a2..00000000 --- a/docker/Dockerfile.torchserve +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:22.04 -ENV DEBIAN_FRONTEND=noninteractive -WORKDIR /root -COPY torchserve/install-torchserve.sh /torchserve/install-torchserve.sh -RUN /torchserve/install-torchserve.sh -RUN /usr/local/bin/torchserve --help -COPY torchserve/config.properties /torchserve/config.properties -COPY torchserve/torchserve-entrypoint.sh /torchserve/torchserve-entrypoint.sh -CMD ["/torchserve/torchserve-entrypoint.sh"] diff --git a/docker/README.md b/docker/README.md index fda0fc8d..c63920e5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -8,8 +8,6 @@ Description of the various files and their functions: - Dockerfile.base - - Dockerfile.mqtt - - Dockerfile.vkfft - -- Dockerfile.torchserve - -- Dockerfile.cuda-torchserve - - Dockerfile.airspyfm - Docker compose @@ -18,4 +16,4 @@ Docker compose - specgram.yml - - prometheus.yml - - monitoring.yml - -- freespacer.ym - \ No newline at end of file +- freespacer.yml - diff --git a/tests/test_torchserve.sh b/tests/test_torchserve.sh index 269dacca..ee531bff 100755 --- a/tests/test_torchserve.sh +++ b/tests/test_torchserve.sh @@ -13,7 +13,7 @@ torch-model-archiver --force --model-name yolov8n --version 1.0 --serialized-fil rm -rf model_store && mkdir model_store mv yolov8n.mar model_store/ # TODO: --runtime nvidia is required for Orin -docker run -v $(pwd)/model_store:/model_store -p 8080:8080 --rm --name testts --entrypoint timeout -d iqtlabs/gamutrf-torchserve 180s /torchserve/torchserve-entrypoint.sh --models yolov8n=yolov8n.mar +docker run -v $(pwd)/model_store:/model_store -p 8080:8080 --rm --name testts --entrypoint timeout -d iqtlabs/torchserve 180s /torchserve/torchserve-entrypoint.sh --models yolov8n=yolov8n.mar # TODO: use gamutRF test spectogram image wget https://github.com/pytorch/serve/raw/master/examples/object_detector/yolo/yolov8/persons.jpg wget -q --retry-connrefused --retry-on-host-error --body-file=persons.jpg --method=PUT -O- --header='Content-Type: image/jpg' http://127.0.0.1:8080/predictions/yolov8n | jq diff --git a/torchserve-cuda.yml b/torchserve-cuda.yml index 8d6e6043..8d05984c 100644 --- a/torchserve-cuda.yml +++ b/torchserve-cuda.yml @@ -4,7 +4,7 @@ networks: services: torchserve: restart: always - image: iqtlabs/gamutrf-cuda-torchserve:latest + image: iqtlabs/cuda-torchserve:latest networks: - gamutrf ports: diff --git a/torchserve.yml b/torchserve.yml index 9092acb5..87f7279d 100644 --- a/torchserve.yml +++ b/torchserve.yml @@ -4,7 +4,7 @@ networks: services: torchserve: restart: always - image: iqtlabs/gamutrf-torchserve:latest + image: iqtlabs/torchserve:latest networks: - gamutrf ports: diff --git a/torchserve/config.properties b/torchserve/config.properties deleted file mode 100644 index 52653c50..00000000 --- a/torchserve/config.properties +++ /dev/null @@ -1,6 +0,0 @@ -inference_address=http://0.0.0.0:8080 -management_address=http://0.0.0.0:8081 -metrics_address=http://0.0.0.0:8082 -install_py_dep_per_model=true -# batch_size=16 -# max_batch_delay=1000 diff --git a/torchserve/install-orin-torchserve.sh b/torchserve/install-orin-torchserve.sh deleted file mode 100755 index d481d73a..00000000 --- a/torchserve/install-orin-torchserve.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -set -e -apt-get update && \ - apt-get install -y \ - git \ - python3-pip \ - openjdk-17-jdk \ - wget \ - numactl - apt-get purge -y opencv-python && \ - pip install "opencv-python<4.8.0.76" && \ - echo /usr/local/lib/python3.8/dist-packages/opencv_python.libs > /etc/ld.so.conf.d/opencv.conf && \ - ldconfig && \ - pip config set global.no-cache-dir false && \ - git clone https://github.com/pytorch/serve -b v0.9.0 && \ - cd serve && \ - pip install -r requirements/common.txt && \ - pip install -r requirements/common_gpu.txt && \ - pip install -r requirements/torch_common.txt && \ - pip install . && \ - cd .. && \ - rm -rf serve diff --git a/torchserve/install-torchserve.sh b/torchserve/install-torchserve.sh deleted file mode 100755 index ba2dc13d..00000000 --- a/torchserve/install-torchserve.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -set -e -apt-get update && \ - apt-get install -y \ - git \ - python3-pip && \ - pip config set global.no-cache-dir false && \ - git clone https://github.com/pytorch/serve -b v0.9.0 && \ - cd serve && \ - python3 ./ts_scripts/install_dependencies.py --environment prod $* && \ - pip install . && \ - cd .. && \ - rm -rf serve - diff --git a/torchserve/torchserve-entrypoint.sh b/torchserve/torchserve-entrypoint.sh deleted file mode 100755 index f14b3adb..00000000 --- a/torchserve/torchserve-entrypoint.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec /usr/local/bin/torchserve --start --model-store /model_store --ts-config /torchserve/config.properties --ncs --foreground $*