From 11f9c0601cf8c7cdae06ec8711e0b1ed5e65fe50 Mon Sep 17 00:00:00 2001 From: Matthew Hammond Date: Wed, 1 Oct 2025 14:15:47 +0900 Subject: [PATCH 1/6] feat: containerize deployment --- deploy/nosana.json | 15 +++++++++++++++ docker/Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 deploy/nosana.json create mode 100644 docker/Dockerfile diff --git a/deploy/nosana.json b/deploy/nosana.json new file mode 100644 index 00000000..6935820c --- /dev/null +++ b/deploy/nosana.json @@ -0,0 +1,15 @@ +{ + "version": "0.1", + "type": "container", + "ops": [ + { + "type": "container/run", + "id": "waldo", + "args": { + "image": "docker.io/matthammond962/waldo:v1.0.0-alpha", + "gpu": true, + "expose": 5000 + } + } + ] +} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..4a5132fa --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,23 @@ +FROM pytorch/pytorch:2.7.1-cuda12.8-cudnn9-runtime + +RUN apt-get update && apt-get install -y \ + libglib2.0-0 \ + libsm6 \ + libxext6 \ + libxrender-dev \ + libgomp1 \ + && rm -rf /var/lib/apt/lists/* + +COPY . . + +# Install requirements using pip with the system Python +# Fix NumPy compatibility and replace opencv-python with opencv-python-headless for Docker compatibility +RUN pip install --no-cache-dir numpy==1.26.4 && \ + pip install --no-cache-dir -r requirements.txt && \ + pip uninstall -y opencv-python opencv-python-headless && \ + pip install opencv-python-headless==4.9.0.80 && \ + pip install huggingface_hub + +RUN hf download jinggu/jing-model vit_g_ps14_ak_ft_ckpt_7_clean.pth --local-dir /workspace/deepcheat/VideoMAEv2 + +CMD ["python", "main.py"] \ No newline at end of file From 4aebbd52da9abcf52866a7149db83dbd079af56b Mon Sep 17 00:00:00 2001 From: Matthew Hammond Date: Wed, 1 Oct 2025 20:43:28 +0900 Subject: [PATCH 2/6] chore: add NO-MODEL build arg --- docker/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 4a5132fa..a30c987b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,7 @@ FROM pytorch/pytorch:2.7.1-cuda12.8-cudnn9-runtime +ARG NO_MODEL=false + RUN apt-get update && apt-get install -y \ libglib2.0-0 \ libsm6 \ @@ -16,8 +18,11 @@ RUN pip install --no-cache-dir numpy==1.26.4 && \ pip install --no-cache-dir -r requirements.txt && \ pip uninstall -y opencv-python opencv-python-headless && \ pip install opencv-python-headless==4.9.0.80 && \ - pip install huggingface_hub -RUN hf download jinggu/jing-model vit_g_ps14_ak_ft_ckpt_7_clean.pth --local-dir /workspace/deepcheat/VideoMAEv2 +# Conditionally download model +RUN if [ "$NO_MODEL" != "true" ]; then \ + pip install huggingface_hub && \ + hf download jinggu/jing-model vit_g_ps14_ak_ft_ckpt_7_clean.pth --local-dir /workspace/deepcheat/VideoMAEv2; \ + fi CMD ["python", "main.py"] \ No newline at end of file From 0a039d748a93e029bceb560ccbaada71d3e5bce9 Mon Sep 17 00:00:00 2001 From: Matthew Hammond Date: Wed, 1 Oct 2025 20:49:55 +0900 Subject: [PATCH 3/6] fix: resolve docker trailing && --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a30c987b..671fd955 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -17,7 +17,7 @@ COPY . . RUN pip install --no-cache-dir numpy==1.26.4 && \ pip install --no-cache-dir -r requirements.txt && \ pip uninstall -y opencv-python opencv-python-headless && \ - pip install opencv-python-headless==4.9.0.80 && \ + pip install opencv-python-headless==4.9.0.80 # Conditionally download model RUN if [ "$NO_MODEL" != "true" ]; then \ From 140f537ed236f4f9d7f8538fbe502a1e5821c759 Mon Sep 17 00:00:00 2001 From: Matthew Hammond Date: Wed, 1 Oct 2025 20:53:09 +0900 Subject: [PATCH 4/6] fix: no model logic gate --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 671fd955..426d789f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,7 +20,7 @@ RUN pip install --no-cache-dir numpy==1.26.4 && \ pip install opencv-python-headless==4.9.0.80 # Conditionally download model -RUN if [ "$NO_MODEL" != "true" ]; then \ +RUN if [ "$NO_MODEL" != "false" ]; then \ pip install huggingface_hub && \ hf download jinggu/jing-model vit_g_ps14_ak_ft_ckpt_7_clean.pth --local-dir /workspace/deepcheat/VideoMAEv2; \ fi From 7eb1156eb85b3b99c81353d58d3a46c91869d7fa Mon Sep 17 00:00:00 2001 From: Matthew Hammond Date: Wed, 1 Oct 2025 22:14:15 +0900 Subject: [PATCH 5/6] feat: create model symbo link --- deploy/nosana.json | 19 ++++++++++++++++--- docker/Dockerfile | 8 ++++++-- docker/entrypoint.sh | 8 ++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 docker/entrypoint.sh diff --git a/deploy/nosana.json b/deploy/nosana.json index 6935820c..99a2c3a1 100644 --- a/deploy/nosana.json +++ b/deploy/nosana.json @@ -6,10 +6,23 @@ "type": "container/run", "id": "waldo", "args": { - "image": "docker.io/matthammond962/waldo:v1.0.0-alpha", + "image": "docker.io/matthammond962/waldo:v1.0.0-alpha_no-model", "gpu": true, - "expose": 5000 - } + "expose": 5000, + "env": { + "MODEL_PATH": "/root/model" + } + }, + "resources": [ + { + "type": "HF", + "repo": "jinggu/jing-model", + "files": [ + "vit_g_ps14_ak_ft_ckpt_7_clean.pth" + ], + "target": "/root/model" + } + ] } ] } \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 426d789f..6dbb00d9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,9 +20,13 @@ RUN pip install --no-cache-dir numpy==1.26.4 && \ pip install opencv-python-headless==4.9.0.80 # Conditionally download model -RUN if [ "$NO_MODEL" != "false" ]; then \ +RUN if [ "$NO_MODEL" != "true" ]; then \ pip install huggingface_hub && \ hf download jinggu/jing-model vit_g_ps14_ak_ft_ckpt_7_clean.pth --local-dir /workspace/deepcheat/VideoMAEv2; \ fi -CMD ["python", "main.py"] \ No newline at end of file +# Copy and setup entrypoint script +COPY docker/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 00000000..3a721dc5 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ -n "$MODEL_PATH" ]; then + ln -s "$MODEL_PATH/vit_g_ps14_ak_ft_ckpt_7_clean.pth" /workspace/deepcheat/VideoMAEv2/vit_g_ps14_ak_ft_ckpt_7_clean.pth +fi + +echo "Running with model..." +exec python main.py From a44183ab78ccfc5d8e4ce6c0bf887f3a65011581 Mon Sep 17 00:00:00 2001 From: Matthew Hammond Date: Wed, 1 Oct 2025 22:38:33 +0900 Subject: [PATCH 6/6] fix: nosana modelless remote resources --- deploy/nosana.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/deploy/nosana.json b/deploy/nosana.json index 99a2c3a1..c901e000 100644 --- a/deploy/nosana.json +++ b/deploy/nosana.json @@ -10,19 +10,19 @@ "gpu": true, "expose": 5000, "env": { - "MODEL_PATH": "/root/model" - } - }, - "resources": [ - { - "type": "HF", - "repo": "jinggu/jing-model", - "files": [ - "vit_g_ps14_ak_ft_ckpt_7_clean.pth" - ], - "target": "/root/model" - } - ] + "MODEL_PATH": "/model" + }, + "resources": [ + { + "type": "HF", + "repo": "jinggu/jing-model", + "files": [ + "vit_g_ps14_ak_ft_ckpt_7_clean.pth" + ], + "target": "/model" + } + ] + } } ] } \ No newline at end of file