Updated runcpu.sh to use the gpu sometimes

This commit is contained in:
tkreindler 2025-10-26 03:18:59 +00:00
parent d513db792e
commit e72efbbf14
2 changed files with 10 additions and 9 deletions

View File

@ -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

View File

@ -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