Datasets:
File size: 1,128 Bytes
74f7b5f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #!/usr/bin/env bash
set -euo pipefail
ENV_PREFIX="${1:-$PWD/.venv}"
PYTHON_BIN="${PYTHON_BIN:-python3}"
TORCH_INDEX_URL="${TORCH_INDEX_URL:-https://download.pytorch.org/whl/cu128}"
if [[ ! -x "$(command -v "$PYTHON_BIN")" ]]; then
echo "Python executable not found: $PYTHON_BIN" >&2
exit 2
fi
"$PYTHON_BIN" -m venv "$ENV_PREFIX"
"$ENV_PREFIX/bin/python" -m pip install --upgrade pip setuptools wheel
"$ENV_PREFIX/bin/python" -m pip install \
--index-url "$TORCH_INDEX_URL" \
torch==2.8.0 torchvision==0.23.0
"$ENV_PREFIX/bin/python" -m pip install -r "$(dirname "$0")/requirements.txt"
"$ENV_PREFIX/bin/python" - <<'PY'
import cv2
import torch
import ultralytics
print(f"torch={torch.__version__}")
print(f"torchvision CUDA build={torch.version.cuda}")
print(f"ultralytics={ultralytics.__version__}")
print(f"opencv={cv2.__version__}")
print(f"cuda_available={torch.cuda.is_available()}")
if torch.cuda.is_available():
for index in range(torch.cuda.device_count()):
print(f"gpu[{index}]={torch.cuda.get_device_name(index)}")
PY
echo "Environment ready. Activate with: source $ENV_PREFIX/bin/activate"
|