From 3167b358c01aaf2dd51f18322852e81556fc2c8b Mon Sep 17 00:00:00 2001 From: Stephan Auerhahn Date: Sat, 12 Aug 2023 05:59:57 +0000 Subject: [PATCH] use feature to install pytorch --- .devcontainer/devcontainer.json | 26 +++++++++++----- .../pytorch-1.13+cu117/devcontainer.json | 30 ++++++++++++++----- .../pytorch-2.0+cu118/devcontainer.json | 19 ++++++++++-- 3 files changed, 58 insertions(+), 17 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fb4c8bf..b3cd068 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "Python 3", + "name": "Python 3", "image": "mcr.microsoft.com/devcontainers/python:1-3.10-bullseye", "features": { "ghcr.io/devcontainers-contrib/features/hatch:2": { @@ -13,6 +13,10 @@ }, "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { "packages": "libgl1-mesa-glx" + }, + "ghcr.io/stability-ai/devcontainer-features/pytorch:1.0.1": { + "version": "2.0.1", + "cudaVersion": "cpu" } }, "customizations": { @@ -23,11 +27,19 @@ "ms-python.black-formatter" ], "settings": { - "editor.defaultFormatter": "ms-python.black-formatter", - "editor.formatOnSave": true + "[python]": { + "diffEditor.ignoreTrimWhitespace": false, + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true, + "editor.wordBasedSuggestions": false + }, + "python.analysis.typeCheckingMode": "basic", + "black-formatter.args": [ + "-l 88" + ] } } - }, - "postCreateCommand": "git config --global --add safe.directory '*'; pip install -r requirements/pt2.txt; pip install -e ." - -} + }, + "postCreateCommand": "git config --global --add safe.directory '*'", + "postAttachCommand": "pip install -U -r requirements/pt2.txt;pip install -U -e ." +} \ No newline at end of file diff --git a/.devcontainer/pytorch-1.13+cu117/devcontainer.json b/.devcontainer/pytorch-1.13+cu117/devcontainer.json index 2e62c80..23d7753 100644 --- a/.devcontainer/pytorch-1.13+cu117/devcontainer.json +++ b/.devcontainer/pytorch-1.13+cu117/devcontainer.json @@ -1,8 +1,8 @@ { - "name": "Python 3", + "name": "Python 3", "image": "mcr.microsoft.com/devcontainers/python:1-3.8-bullseye", "features": { - "ghcr.io/devcontainers/features/nvidia-cuda:1": { + "ghcr.io/devcontainers/features/nvidia-cuda:1": { "cudaVersion": "11.7" }, "ghcr.io/devcontainers-contrib/features/hatch:2": { @@ -16,6 +16,10 @@ }, "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { "packages": "libgl1-mesa-glx" + }, + "ghcr.io/stability-ai/devcontainer-features/pytorch:1.0.1": { + "version": "1.13.1", + "cudaVersion": "cu117" } }, "customizations": { @@ -26,11 +30,23 @@ "ms-python.black-formatter" ], "settings": { - "editor.defaultFormatter": "ms-python.black-formatter", - "editor.formatOnSave": true + "[python]": { + "diffEditor.ignoreTrimWhitespace": false, + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true, + "editor.wordBasedSuggestions": false + }, + "python.analysis.typeCheckingMode": "basic", + "black-formatter.args": [ + "-l 88" + ] } } }, - "runArgs": ["--gpus", "all"], - "postCreateCommand": "git config --global --add safe.directory '*'; pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117; pip install -r requirements/pt13.txt; pip install -e ." -} + "runArgs": [ + "--gpus", + "all" + ], + "postCreateCommand": "git config --global --add safe.directory '*'", + "postAttachCommand": "pip install -U -r requirements/pt13.txt;pip install -U -e ." +} \ No newline at end of file diff --git a/.devcontainer/pytorch-2.0+cu118/devcontainer.json b/.devcontainer/pytorch-2.0+cu118/devcontainer.json index cf187e9..560d1b1 100644 --- a/.devcontainer/pytorch-2.0+cu118/devcontainer.json +++ b/.devcontainer/pytorch-2.0+cu118/devcontainer.json @@ -16,6 +16,10 @@ }, "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { "packages": "libgl1-mesa-glx" + }, + "ghcr.io/stability-ai/devcontainer-features/pytorch:1.0.1": { + "version": "2.0.1", + "cudaVersion": "cu118" } }, "customizations": { @@ -26,8 +30,16 @@ "ms-python.black-formatter" ], "settings": { - "editor.defaultFormatter": "ms-python.black-formatter", - "editor.formatOnSave": true + "[python]": { + "diffEditor.ignoreTrimWhitespace": false, + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true, + "editor.wordBasedSuggestions": false + }, + "python.analysis.typeCheckingMode": "basic", + "black-formatter.args": [ + "-l 88" + ] } } }, @@ -35,5 +47,6 @@ "--gpus", "all" ], - "postCreateCommand": "git config --global --add safe.directory '*'; pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2+cu118 --index-url https://download.pytorch.org/whl/cu118;pip install -r requirements/pt2.txt;pip install -e ." + "postCreateCommand": "git config --global --add safe.directory '*'", + "postAttachCommand": "pip install -U -r requirements/pt2.txt;pip install -U -e ." } \ No newline at end of file