docker/run.sh: translate UNSLOTH_GPUS index selectors to device= form
The header docstring advertises UNSLOTH_GPUS values like "0" and "0,1" but Docker reads a bare integer for --gpus as a COUNT, not an INDEX. UNSLOTH_GPUS=0 was therefore exposing zero GPUs, and the entrypoint's GPU check refused to start. Wrap bare-int and comma-list inputs as "device=$GPUS" so the documented values do what they say; "all" and already-quoted device= selectors pass through unchanged.
This commit is contained in:
parent
9723d72aa4
commit
4d34845f2b
1 changed files with 11 additions and 0 deletions
|
|
@ -34,6 +34,17 @@ set -euo pipefail
|
|||
|
||||
IMAGE="${UNSLOTH_IMAGE:-unsloth/unsloth:latest}"
|
||||
GPUS="${UNSLOTH_GPUS:-all}"
|
||||
# Translate index selectors to Docker's `device=` form. The header docstring
|
||||
# advertises UNSLOTH_GPUS values like "0" and "0,1" but Docker reads a bare
|
||||
# integer for --gpus as a COUNT, not an INDEX, so `UNSLOTH_GPUS=0` would
|
||||
# expose zero GPUs and the entrypoint would refuse to start. `all` and
|
||||
# already-quoted `device=...` / `"device=..."` selectors pass through.
|
||||
case "$GPUS" in
|
||||
all|"") ;;
|
||||
\"device=*|device=*) ;;
|
||||
*[!0-9]*) GPUS="\"device=${GPUS}\"" ;; # contains a non-digit (comma, UUID-prefix, etc.)
|
||||
*) GPUS="\"device=${GPUS}\"" ;; # bare integer: treat as an INDEX, per docstring
|
||||
esac
|
||||
HF_CACHE="${HF_HOME:-$HOME/.cache/huggingface}"
|
||||
TRITON_CACHE="${TRITON_CACHE_DIR:-$HOME/.cache/unsloth-triton}"
|
||||
WORK_DIR="${UNSLOTH_WORKDIR:-$PWD}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue