From 5b739cb0d5cba7844664b1b0f491904ecffc2048 Mon Sep 17 00:00:00 2001 From: Tim Pietrusky Date: Tue, 4 Mar 2025 11:35:13 +0100 Subject: [PATCH 1/5] docs: created CONTRIBUTING.md for contributors; created a proper README --- official-templates/pytorch/CONTRIBUTING.md | 11 +++++++++++ official-templates/pytorch/README.md | 23 +++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 official-templates/pytorch/CONTRIBUTING.md diff --git a/official-templates/pytorch/CONTRIBUTING.md b/official-templates/pytorch/CONTRIBUTING.md new file mode 100644 index 00000000..78ecd150 --- /dev/null +++ b/official-templates/pytorch/CONTRIBUTING.md @@ -0,0 +1,11 @@ +## Build Instructions + +- To build with the default options, simply run `docker buildx bake`. +- To build a specific target, use `docker buildx bake `. +- To specify the platform, use `docker buildx bake --set .platform=linux/amd64`. + +Example: + +```bash +docker buildx bake 240-py311-cuda1241-devel-ubuntu2204 --set 240-py311-cuda1241-devel-ubuntu2204.platform=linux/amd64 +``` diff --git a/official-templates/pytorch/README.md b/official-templates/pytorch/README.md index 419cfdc2..528e1649 100644 --- a/official-templates/pytorch/README.md +++ b/official-templates/pytorch/README.md @@ -1,15 +1,16 @@ -## Build Instructions +# PyTorch Environment -- To build with the default options, simply run `docker buildx bake`. -- To build a specific target, use `docker buildx bake `. -- To specify the platform, use `docker buildx bake --set .platform=linux/amd64`. +Ready-to-use PyTorch + Python development environment with JupyterLab and common development tools pre-installed: -Example: +- Jupyter Notebook 6.5.5 +- JupyterLab with widgets and extensions +- Pre-configured workspace directory +- SSH access +- NGINX server +- Development tools (git, wget, curl) -```bash -docker buildx bake 240-py311-cuda1241-devel-ubuntu2204 --set 240-py311-cuda1241-devel-ubuntu2204.platform=linux/amd64 -``` +## Ports -## Exposed Ports - -- 22/tcp (SSH) +| Application | Port | Type | +| ----------- | ---- | ---- | +| SSH | 22 | TCP | From e7d04b0c5a653c1d802c71352f50aab6c6e2871f Mon Sep 17 00:00:00 2001 From: Tim Pietrusky Date: Tue, 4 Mar 2025 12:30:28 +0100 Subject: [PATCH 2/5] ci: update the README automatically --- .github/workflows/pytorch-dev.yml | 78 +++++++++++++++++++ official-templates/pytorch/update-template.sh | 62 +++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 .github/workflows/pytorch-dev.yml create mode 100755 official-templates/pytorch/update-template.sh diff --git a/.github/workflows/pytorch-dev.yml b/.github/workflows/pytorch-dev.yml new file mode 100644 index 00000000..48590206 --- /dev/null +++ b/.github/workflows/pytorch-dev.yml @@ -0,0 +1,78 @@ +name: Update PyTorch Templates + +on: + push: + branches-ignore: + - main + paths: + - "official-templates/pytorch/**" + pull_request: + paths: + - "official-templates/pytorch/**" + workflow_dispatch: + inputs: + specific_template: + description: "Specific template to update (leave empty to update all)" + required: false + type: string + +jobs: + update-templates: + runs-on: ubuntu-latest-public-m + strategy: + fail-fast: false + matrix: + include: + # Map PyTorch variants to template IDs + # CUDA variants + - target: 210-py310-cuda1180-devel-ubuntu2204 + template_id: runpod-torch-v21 + # Commented out for testing + # - target: 240-py311-cuda1241-devel-ubuntu2204 + # template_id: runpod-torch-v240 + # - target: 220-py310-cuda1211-devel-ubuntu2204 + # template_id: runpod-torch-v220 + # - target: 211-py310-cuda1211-devel-ubuntu2204 + # template_id: runpod-torch-v211 + # - target: 201-py310-cuda1180-devel-ubuntu2204 + # template_id: runpod-torch + # - target: 1131-py38-cuda1171-devel-ubuntu2204 + # template_id: runpod-torch-v1 + # # ROCM variants + # - target: 240-py310-rocm610-ubuntu2204 + # template_id: runpod-torch-v240-rocm61 + # - target: 201-py310-rocm57-ubuntu2204 + # template_id: runpod-torch-v201-rocm57 + # - target: 201-py39-rocm61-ubuntu2004 + # template_id: runpod-torch-v201-rocm61 + # - target: 201-py38-rocm56-ubuntu2004 + # template_id: runpod-torch-v201-rocm56 + # - target: 211-py39-rocm60-ubuntu2004 + # template_id: runpod-torch-v211-rocm60 + # - target: 212-py310-rocm602-ubuntu2204 + # template_id: runpod-torch-v212-rocm602 + # - target: 212-py310-rocm61-ubuntu2204 + # template_id: runpod-torch-v212-rocm61 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Skip if specific template is set and doesn't match + id: check_template + run: | + if [[ "${{ github.event.inputs.specific_template }}" != "" && "${{ github.event.inputs.specific_template }}" != "${{ matrix.template_id }}" ]]; then + echo "skip=true" >> $GITHUB_OUTPUT + else + echo "skip=false" >> $GITHUB_OUTPUT + fi + + - name: Make script executable + if: steps.check_template.outputs.skip != 'true' + run: chmod +x official-templates/pytorch/update-template.sh + + - name: Update template via script + if: steps.check_template.outputs.skip != 'true' + env: + RUNPOD_API_KEY: ${{ secrets.RUNPOD_API_KEY }} + run: ./official-templates/pytorch/update-template.sh ${{ matrix.template_id }} diff --git a/official-templates/pytorch/update-template.sh b/official-templates/pytorch/update-template.sh new file mode 100755 index 00000000..ec40a8f7 --- /dev/null +++ b/official-templates/pytorch/update-template.sh @@ -0,0 +1,62 @@ +#!/bin/bash +set -e + +# Check if template ID is provided +if [ -z "$1" ]; then + echo "Error: Template ID is required" + echo "Usage: $0 " + exit 1 +fi + +TEMPLATE_ID=$1 +README_PATH="official-templates/pytorch/README.md" +API_KEY=$RUNPOD_API_KEY + +# Check if API key is set +if [ -z "$API_KEY" ]; then + echo "Error: RUNPOD_API_KEY environment variable is not set" + exit 1 +fi + +# Read README content +if [ ! -f "$README_PATH" ]; then + echo "Error: README file not found at $README_PATH" + exit 1 +fi + +# Use Node.js to escape the README content for JSON +README_JSON=$(node -e "console.log(JSON.stringify(require('fs').readFileSync('$README_PATH', 'utf8')))") + +# Create GraphQL query +cat << EOF > query.json +{ + "query": "mutation AdminUpdatePodTemplate(\$input: AdminUpdatePodTemplateInput!) { adminUpdatePodTemplate(input: \$input) { id name } }", + "variables": { + "input": { + "id": "$TEMPLATE_ID", + "readme": $README_JSON + } + } +} +EOF + +# Execute GraphQL mutation +echo "Updating template $TEMPLATE_ID..." +response=$(curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer $API_KEY" \ + -d @query.json \ + https://api.runpod.io/graphql) + +# Check for errors +if echo "$response" | grep -q "errors"; then + echo "❌ GraphQL mutation failed for template $TEMPLATE_ID:" + echo "$response" + exit 1 +else + echo "✅ GraphQL mutation successful for template $TEMPLATE_ID:" + echo "$response" +fi + +# Clean up +rm query.json \ No newline at end of file From aef416db9587054aed231edbd4308fe6c324ee5b Mon Sep 17 00:00:00 2001 From: Tim Pietrusky Date: Tue, 4 Mar 2025 12:36:50 +0100 Subject: [PATCH 3/5] ci: update all templates --- .github/workflows/pytorch-dev.yml | 51 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pytorch-dev.yml b/.github/workflows/pytorch-dev.yml index 48590206..19fd9f6b 100644 --- a/.github/workflows/pytorch-dev.yml +++ b/.github/workflows/pytorch-dev.yml @@ -27,32 +27,31 @@ jobs: # CUDA variants - target: 210-py310-cuda1180-devel-ubuntu2204 template_id: runpod-torch-v21 - # Commented out for testing - # - target: 240-py311-cuda1241-devel-ubuntu2204 - # template_id: runpod-torch-v240 - # - target: 220-py310-cuda1211-devel-ubuntu2204 - # template_id: runpod-torch-v220 - # - target: 211-py310-cuda1211-devel-ubuntu2204 - # template_id: runpod-torch-v211 - # - target: 201-py310-cuda1180-devel-ubuntu2204 - # template_id: runpod-torch - # - target: 1131-py38-cuda1171-devel-ubuntu2204 - # template_id: runpod-torch-v1 - # # ROCM variants - # - target: 240-py310-rocm610-ubuntu2204 - # template_id: runpod-torch-v240-rocm61 - # - target: 201-py310-rocm57-ubuntu2204 - # template_id: runpod-torch-v201-rocm57 - # - target: 201-py39-rocm61-ubuntu2004 - # template_id: runpod-torch-v201-rocm61 - # - target: 201-py38-rocm56-ubuntu2004 - # template_id: runpod-torch-v201-rocm56 - # - target: 211-py39-rocm60-ubuntu2004 - # template_id: runpod-torch-v211-rocm60 - # - target: 212-py310-rocm602-ubuntu2204 - # template_id: runpod-torch-v212-rocm602 - # - target: 212-py310-rocm61-ubuntu2204 - # template_id: runpod-torch-v212-rocm61 + - target: 240-py311-cuda1241-devel-ubuntu2204 + template_id: runpod-torch-v240 + - target: 220-py310-cuda1211-devel-ubuntu2204 + template_id: runpod-torch-v220 + - target: 211-py310-cuda1211-devel-ubuntu2204 + template_id: runpod-torch-v211 + - target: 201-py310-cuda1180-devel-ubuntu2204 + template_id: runpod-torch + - target: 1131-py38-cuda1171-devel-ubuntu2204 + template_id: runpod-torch-v1 + # ROCM variants + - target: 240-py310-rocm610-ubuntu2204 + template_id: runpod-torch-v240-rocm61 + - target: 201-py310-rocm57-ubuntu2204 + template_id: runpod-torch-v201-rocm57 + - target: 201-py39-rocm61-ubuntu2004 + template_id: runpod-torch-v201-rocm61 + - target: 201-py38-rocm56-ubuntu2004 + template_id: runpod-torch-v201-rocm56 + - target: 211-py39-rocm60-ubuntu2004 + template_id: runpod-torch-v211-rocm60 + - target: 212-py310-rocm602-ubuntu2204 + template_id: runpod-torch-v212-rocm602 + - target: 212-py310-rocm61-ubuntu2204 + template_id: runpod-torch-v212-rocm61 steps: - name: Checkout repository From d9047e19167926ae5b587a813d616a8dfec27a8f Mon Sep 17 00:00:00 2001 From: Tim Pietrusky Date: Tue, 4 Mar 2025 12:40:51 +0100 Subject: [PATCH 4/5] docs: removed explicit tool mentions --- official-templates/pytorch/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/official-templates/pytorch/README.md b/official-templates/pytorch/README.md index 528e1649..c3ae46ad 100644 --- a/official-templates/pytorch/README.md +++ b/official-templates/pytorch/README.md @@ -7,7 +7,7 @@ Ready-to-use PyTorch + Python development environment with JupyterLab and common - Pre-configured workspace directory - SSH access - NGINX server -- Development tools (git, wget, curl) +- Development tools ## Ports From c0109a5051bbe959ea7fb971b254c3358b273fb4 Mon Sep 17 00:00:00 2001 From: Tim Pietrusky Date: Tue, 4 Mar 2025 16:57:13 +0100 Subject: [PATCH 5/5] ci: adding missing jupyter port --- official-templates/pytorch/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/official-templates/pytorch/README.md b/official-templates/pytorch/README.md index c3ae46ad..1e6c9089 100644 --- a/official-templates/pytorch/README.md +++ b/official-templates/pytorch/README.md @@ -13,4 +13,5 @@ Ready-to-use PyTorch + Python development environment with JupyterLab and common | Application | Port | Type | | ----------- | ---- | ---- | +| Jupyter | 8888 | HTTP | | SSH | 22 | TCP |