diff --git a/tools/export-seg-model.sh b/tools/export-seg-model.sh index 911effa..261fad5 100755 --- a/tools/export-seg-model.sh +++ b/tools/export-seg-model.sh @@ -28,7 +28,12 @@ OUT="${REPO}/models/segment" MODEL="${1:-yolo26n-seg}" IMGSZ="${2:-640}" -WORK="$(mktemp -d)" +# Not `mktemp -d`: the default TMPDIR is `/tmp`, which on most current Linux +# distributions is a tmpfs — RAM, sized at half of physical memory. The venv +# below pulls torch, several gigabytes of it, and installing that into RAM +# either evicts the user's page cache or fails outright with ENOSPC on a +# machine that has hundreds of gigabytes of actual disk free. +WORK="$(mktemp -d -p "${TMPDIR:-/var/tmp}")" trap 'rm -rf "${WORK}"' EXIT echo "==> exporting ${MODEL} at imgsz=${IMGSZ} in ${WORK}"