From 7fdfed35fe9ea47ea25c5fb7f005053c03c403e3 Mon Sep 17 00:00:00 2001 From: Josh Bailey Date: Mon, 6 Nov 2023 03:02:47 +0000 Subject: [PATCH 1/3] Build gamutRF image with bespoke torchsig libraries, for new augmentaton script. --- .github/workflows/docker-test.yml | 1 + .github/workflows/docker.yml | 9 +++++++++ docker/Dockerfile.torchsig | 14 ++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 docker/Dockerfile.torchsig diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 7f61bfac..9f6498fe 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -29,6 +29,7 @@ jobs: docker build -f Dockerfile.base . -t iqtlabs/gamutrf-base:latest cd .. docker build -f Dockerfile . -t iqtlabs/gamutrf:latest + docker build -f docker/Dockerfile.torchsig docker -t iqtlabs/gamutrf-torchsig:latest docker run -t iqtlabs/gamutrf:latest gamutrf-scan --help docker run -t iqtlabs/gamutrf:latest gamutrf-sigfinder --help docker run -t iqtlabs/gamutrf:latest gamutrf-api --help diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 23dfce09..fdc0e0a5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -84,3 +84,12 @@ jobs: push: true tags: iqtlabs/gamutrf:${{ steps.change_version.outputs.VERSION }} if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' + - name: Build and push gamutrf-torchsig + uses: docker/build-push-action@v5 + with: + context: docker + file: docker/Dockerfile.torchsig + platforms: linux/amd64,linux/arm64 + push: true + tags: iqtlabs/gamutrf-torchsig:${{ steps.change_version.outputs.VERSION }} + if: github.repository == 'iqtlabs/gamutrf' && github.event_name == 'push' diff --git a/docker/Dockerfile.torchsig b/docker/Dockerfile.torchsig new file mode 100644 index 00000000..b490d7ed --- /dev/null +++ b/docker/Dockerfile.torchsig @@ -0,0 +1,14 @@ +FROM ubuntu:22.04 as torchsig-builder +WORKDIR /root +ENV DEBIAN_FRONTEND noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends build-essential ca-certificates cmake git python3-pip python3-dev && pip install -U pip +RUN pip install git+https://github.com/TorchDSP/torchsig@v0.4.1 + +FROM iqtlabs/gamutrf:latest +WORKDIR /root +ENV DEBIAN_FRONTEND noninteractive +# TODO: find a better way cherrypick just Torchsig itself, without Torch et al. +COPY --from=torchsig-builder /usr/local/lib/python3.10/dist-packages/torchsig /usr/local/lib/python3.10/dist-packages/torchsig +RUN apt-get update && apt-get install -y --no-install-recommends python3-pip && pip3 install PyWavelets numba torch --extra-index-url https://download.pytorch.org/whl/cpu && apt-get purge -y python3-pip +RUN python3 -c "from torchsig.transforms import transforms" +RUN python3 -c "from gamutrf import grscan" From 10d83240b9e5a50028910ebc2e50340a8fa545ce Mon Sep 17 00:00:00 2001 From: Josh Bailey Date: Mon, 6 Nov 2023 03:31:04 +0000 Subject: [PATCH 2/3] hack torch pin. --- docker/Dockerfile.torchsig | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.torchsig b/docker/Dockerfile.torchsig index b490d7ed..77670121 100644 --- a/docker/Dockerfile.torchsig +++ b/docker/Dockerfile.torchsig @@ -2,13 +2,20 @@ FROM ubuntu:22.04 as torchsig-builder WORKDIR /root ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y --no-install-recommends build-essential ca-certificates cmake git python3-pip python3-dev && pip install -U pip -RUN pip install git+https://github.com/TorchDSP/torchsig@v0.4.1 +# Cause torch CPU only to be installed, no cuda dependencies +RUN pip install torch --extra-index-url https://download.pytorch.org/whl/cpu +RUN git clone https://github.com/TorchDSP/torchsig -b v0.4.1 +WORKDIR /root/torchsig +RUN sed -i -E "s/torch==[0-9\.]+/torch/g" pyproject.toml +RUN pip install . FROM iqtlabs/gamutrf:latest WORKDIR /root ENV DEBIAN_FRONTEND noninteractive -# TODO: find a better way cherrypick just Torchsig itself, without Torch et al. +# TODO: find a better way cherrypick just Torchsig itself, without Torch et al. Torchsig transforms have dependencies on +# Torch, even though we don't need Torch for the standalone transforms we want. COPY --from=torchsig-builder /usr/local/lib/python3.10/dist-packages/torchsig /usr/local/lib/python3.10/dist-packages/torchsig -RUN apt-get update && apt-get install -y --no-install-recommends python3-pip && pip3 install PyWavelets numba torch --extra-index-url https://download.pytorch.org/whl/cpu && apt-get purge -y python3-pip +COPY --from=torchsig-builder /usr/local/lib/python3.10/dist-packages/torch /usr/local/lib/python3.10/dist-packages/torch +RUN apt-get update && apt-get install -y --no-install-recommends python3-pip && pip3 install PyWavelets numba && apt-get purge -y python3-pip RUN python3 -c "from torchsig.transforms import transforms" RUN python3 -c "from gamutrf import grscan" From a42d368cd2bfd63a4dcaff11f11b87a879012132 Mon Sep 17 00:00:00 2001 From: Josh Bailey Date: Mon, 6 Nov 2023 03:42:39 +0000 Subject: [PATCH 3/3] smaller. --- docker/Dockerfile.torchsig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/Dockerfile.torchsig b/docker/Dockerfile.torchsig index 77670121..94ab31a7 100644 --- a/docker/Dockerfile.torchsig +++ b/docker/Dockerfile.torchsig @@ -14,8 +14,6 @@ WORKDIR /root ENV DEBIAN_FRONTEND noninteractive # TODO: find a better way cherrypick just Torchsig itself, without Torch et al. Torchsig transforms have dependencies on # Torch, even though we don't need Torch for the standalone transforms we want. -COPY --from=torchsig-builder /usr/local/lib/python3.10/dist-packages/torchsig /usr/local/lib/python3.10/dist-packages/torchsig -COPY --from=torchsig-builder /usr/local/lib/python3.10/dist-packages/torch /usr/local/lib/python3.10/dist-packages/torch -RUN apt-get update && apt-get install -y --no-install-recommends python3-pip && pip3 install PyWavelets numba && apt-get purge -y python3-pip +COPY --from=torchsig-builder /usr/local/lib/python3.10/dist-packages /usr/local/lib/python3.10/dist-packages RUN python3 -c "from torchsig.transforms import transforms" RUN python3 -c "from gamutrf import grscan"