From 11b87b217732234547917ff885a7856d0eecef95 Mon Sep 17 00:00:00 2001 From: Adam McKellar Date: Tue, 15 Oct 2024 16:13:33 +0200 Subject: [PATCH] added example config and action --- .github/workflows/webpage.yaml | 26 +++++++ install.cfg | 125 +++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 .github/workflows/webpage.yaml create mode 100644 install.cfg diff --git a/.github/workflows/webpage.yaml b/.github/workflows/webpage.yaml new file mode 100644 index 0000000..1215831 --- /dev/null +++ b/.github/workflows/webpage.yaml @@ -0,0 +1,26 @@ +name: Webpage + +on: + push: + branches: + - main + paths: + - "install.cfg" + workflow_dispatch: + +permissions: + contents: write + +jobs: + webpage: + runs-on: ubuntu-latest + name: Compile Webpage + steps: + - uses: actions/checkout@v4 + - name: Compile Webpage + uses: instructions-d-installation/web-installation-instruction-action@v0.1.0 + - name: Deploy Webpage + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: ./public + \ No newline at end of file diff --git a/install.cfg b/install.cfg new file mode 100644 index 0000000..4b607b8 --- /dev/null +++ b/install.cfg @@ -0,0 +1,125 @@ +schema: + $schema: https://json-schema.org/draft/2020-12/schema + $id: https://github.com/instructions-d-installation/installation-instruction/examples/pytorch/instruction_pytorch.schema.yml + title: PyTorch Install Schema + description: This is a schema which is used for constructing interactive installation instructions. + type: object + $comment: by Adam McKellar + properties: + build: + title: Build + description: Use the latest or the tested version. + enum: + - stable + - preview + default: stable + os: + title: Operating System + description: The operating system you use. + enum: + - linux + - mac + - win + default: win + package: + title: Package Manager + description: The package manager you use. + enum: + - conda + - pip + default: pip + compute_platform: + title: Compute Platform + description: Should your gpu or your cpu handle the task? + enum: + - cu118 + - cu121 + - ro60 + - cpu + default: cu118 + required: + - build + - os + - package + - compute_platform + additionalProperties: false + +pretty: + stable: Stable (2.3.0) + preview: Preview (Nightly) + linux: Linux + mac: Mac + win: Windows + conda: Conda + pip: Pip + cu118: CUDA 11.8 + cu121: CUDA 12.1 + ro60: ROCm 6.0 + cpu: CPU + +------ + +{# Adams spaghetti code #} +{% if package == "conda" %} + conda install + + {% if os == "mac" %} + {% if compute_platform == "cpu" %} + pytorch{{ "-nightly" if build == "preview" }}::pytorch torchvision torchaudio + {% else %} + {{ raise("Mac does not support ROCm or CUDA!") }} + {% endif %} + {% else %} + pytorch torchvision torchaudio + + {% if compute_platform == "cu118" %} + pytorch-cuda=11.8 -c nvidia + {% elif compute_platform == "cu121" %} + pytorch-cuda=12.1 -c nvidia + {% elif compute_platform == "ro60" %} + {{ raise("ROCm is currently not supported with conda on linux and not supported at all on windows!") }} + {% else %} + cpuonly + {% endif %} + {% endif %} + + -c pytorch{{ "-nightly" if build == "preview" }} + +{% elif package == "pip" %} + pip3 install {{ "--pre" if build == "preview" }} torch torchvision torchaudio + + {% if os == "mac" %} + {{ raise("Mac does not support ROCm or CUDA!") if compute_platform != "cpu" }} + {% if build == "preview" %} + --index-url https://download.pytorch.org/whl/nightly/cpu + {% endif %} + {% else %} + + {% if compute_platform == "cu118" %} + --index-url https://download.pytorch.org/whl/{{ "nightly/" if build == "preview" }}cu118 + + {% elif compute_platform == "cu121" %} + {% if build == "preview" %} + --index-url https://download.pytorch.org/whl/nightly/cu121 + {% else %} + {% if os == "win" %} + --index-url https://download.pytorch.org/whl/cu121 + {% endif %} + {% endif %} + + {% elif compute_platform == "ro60" %} + {{ raise("Windows does not support ROCm!") if os != "linux" }} + --index-url https://download.pytorch.org/whl/{{ "nightly/" if build == "preview" }}rocm6.0 + + {# CPU #} + {% else %} + {% if build == "preview" %} + --index-url https://download.pytorch.org/whl/nightly/cpu + {% else %} + {% if os == "linux" %} + --index-url https://download.pytorch.org/whl/cpu + {% endif %} + {% endif %} + {% endif %} + {% endif %} +{% endif %} \ No newline at end of file