diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 22d9728..78558f8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,15 +6,9 @@ // Features to add to the dev container. More info: https://containers.dev/features. "features": { // CUDA support with GPU passthrough - "ghcr.io/devcontainers/features/nvidia-cuda:2": {}, + "ghcr.io/devcontainers/features/nvidia-cuda:2": {} - // Python - "ghcr.io/devcontainers/features/python:1": { - "version": "3.10" // sync with .python-version file - }, - - // (Optional) access to system's docker host - "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} + // Everythong else gets installed automatically by uv }, // Needed for GPU passthrough for CUDA in the container diff --git a/dev/runcpu.sh b/dev/runcpu.sh index 6290fd9..cc3b0ca 100644 --- a/dev/runcpu.sh +++ b/dev/runcpu.sh @@ -14,7 +14,14 @@ NANOCHAT_BASE_DIR="$HOME/.cache/nanochat" mkdir -p $NANOCHAT_BASE_DIR command -v uv &> /dev/null || curl -LsSf https://astral.sh/uv/install.sh | sh [ -d ".venv" ] || uv venv -uv sync --extra cpu + +# check if there's a Nvidia GPU installed (even if it's a mediocre one), if so still use CUDA +if nvidia-smi -L >/dev/null 2>&1; then + uv sync --extra gpu +else + uv sync --extra cpu +fi + source .venv/bin/activate if [ -z "$WANDB_RUN" ]; then WANDB_RUN=dummy