Skip to content

Commit

Permalink
added example config and action
Browse files Browse the repository at this point in the history
  • Loading branch information
WyvernIXTL committed Oct 15, 2024
1 parent 60a3ccf commit 11b87b2
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/webpage.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
- name: Deploy Webpage
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./public

125 changes: 125 additions & 0 deletions install.cfg
Original file line number Diff line number Diff line change
@@ -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 %}

0 comments on commit 11b87b2

Please sign in to comment.