Set up ML environments with PyTorch and auto-detect hardware. Use this when creating new ML projects, setting up PyTorch, or troubleshooting GPU/environment issues...
This skill creates isolated conda environments with PyTorch. It auto-detects your hardware (NVIDIA GPU, AMD GPU, or CPU) and installs the right PyTorch build, then validates it works. Designed for consistency across a small fleet of Linux boxes (NVIDIA, AMD Strix Halo, CPU).
When you ask me to set up a new ML project, I:
setup-universal.sh from the project dir β it creates a named conda
env (ml-<project> by default), installs PyTorch with the correct backend,
and common ML libraries. It also drops a .gitignore if one is missing.validate.sh to confirm the GPU/backend works.# From the new project directory:
bash ~/.claude/skills/ml-env/scripts/setup-universal.sh
bash ~/.claude/skills/ml-env/scripts/validate.sh
The setup script (~/.claude/skills/ml-env/scripts/setup-universal.sh):
nvidia-smi, AMD via rocminfo, else CPU).ml-<basename-of-cwd> (Python 3.13 by default).cu132, ROCm 7.2,
or CPU); gfx1151 uses its own verified tracks.setup-<project>-<timestamp>.log.conda activate ml-<project>
python -c "import torch; print(torch.__version__); print('cuda:', torch.cuda.is_available())"
Env names default to ml-<project-dir>. Override at setup time:
ENV_NAME=myexp PYTHON_VERSION=3.12 bash ~/.claude/skills/ml-env/scripts/setup-universal.sh
Where envs live: ~/.condarc (linux-dotfiles) points new envs at
~/conda/envs. Existing envs under ~/miniforge/envs are unaffected.
Overridable via environment variables β see the header of setup-universal.sh.
| Component | Default | Notes |
|---|---|---|
| Python | 3.13 | latest mature; all backends ship cp313. Use 3.12 only if a package needs it. |
| PyTorch | 2.13.0 | latest stable on cu132 / rocm7.2 |
| CUDA (NVIDIA) | cu132 | CUDA 13.2; runs on the fleet's driver 580.x via minor-version compat (verified on GB10/RTX 5090/RTX 3090). Drop to cu130 if a driver is ever too old. |
| ROCm (generic AMD) | rocm7.2 | latest on pytorch.org |
| gfx1151 (Strix Halo) | TheRock nightly | see below β official wheels do not work |
cu132 wheels (CUDA 13.2). Run on driver 580.x via minor-version compat.--pre --index-url β¦/whl/nightly/cu132.)rocm7.2 wheels. User must be in render and video groups:
sudo usermod -aG render,video $USER && newgrp render.β οΈ Official PyTorch wheels fail with HIP error: invalid device function.
The setup script offers two verified tracks:
pip install --index-url https://rocm.nightlies.amd.com/whl-multi-arch/ "torch[device-gfx1151]" "torchvision[device-gfx1151]" torchaudioPYTHON_VERSION=3.12). Wheels from
repo.radeon.com/rocm/manylinux/rocm-rel-7.2.1/.Environment variables: do not set HSA_ENABLE_SDMA,
PYTORCH_HIP_ALLOC_CONF, etc. globally β they cause subtle bugs. Set them only
per-process for a reproduced issue. (Matches the strix-halo-setup skill v2.0.0.)
For GTT memory (amd-ttm), flash-SDPA source builds, and kernel-backport
checks, use the dedicated strix-halo-setup skill (~/Projects/amdtest).
ml-env intentionally does not duplicate that. See
TROUBLESHOOTING.md for the summary.
Works everywhere. Good for development/testing before scaling to GPU.
cd ~/your-ml-project # any dir; the env name defaults to ml-<this-dir>
ENV_NAME=ml-<project> bash ~/.claude/skills/ml-env/scripts/validate.sh
Checks Python, PyTorch, backend (CUDA/ROCm), device name + compute capability / gfx arch, and runs a real matmul.
GPU not detected:
nvidia-smi # NVIDIA driver present?
rocminfo | grep gfx # AMD arch (expect gfx1151 on Strix Halo)
groups | grep -E "render|video" # AMD requires these
PyTorch installed but cuda.is_available() is False:
nvidia-smi's "CUDA
Version" line, or drop to cu130/cu128.CUDA out of memory / slow training: these are general PyTorch questions β see
the PyTorch docs (mixed precision, gradient checkpointing, torch.cuda.empty_cache).
This skill focuses on environment setup, not training tuning.
For hardware-specific issues, WSL2, and full Strix Halo setup, see TROUBLESHOOTING.md. For updating packages, see UPDATE.md.
Both live in ~/.claude/skills/ml-env/scripts/: