#!/usr/bin/env bash set -euo pipefail cd /home/wxn/cgvm_pilot_20261030 export CUDA_VISIBLE_DEVICES=0,1,2,3 export UV_CACHE_DIR=/home/wxn/cgvm_pilot_20261030/.uv-cache export SAM2_BUILD_CUDA=0 # 所有依赖写入项目独立环境,共享环境仅作只读核查。 rm -f .venv/lib/python3.10/site-packages/readonly_base.pth uv pip install --python .venv/bin/python 'torch==2.10.0' 'torchvision==0.25.0' --index-url https://download.pytorch.org/whl/cu128 --extra-index-url https://pypi.org/simple --index-strategy unsafe-best-match uv pip install --python .venv/bin/python -r configs/requirements-core.txt SAM2_BUILD_CUDA=0 GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=http.version GIT_CONFIG_VALUE_0=HTTP/1.1 GIT_CONFIG_KEY_1=http.proxy GIT_CONFIG_VALUE_1=http://127.0.0.1:8118 uv pip install --python .venv/bin/python --no-build-isolation 'SAM-2 @ git+https://github.com/facebookresearch/sam2.git@2b90b9f5ceec907a1c18123530e92e794ad901a4' uv pip freeze --python .venv/bin/python > provenance/environment.freeze.txt .venv/bin/python - <<'PY' import importlib.metadata as m, json, platform, torch from pathlib import Path names=['torch','torchvision','transformers','peft','accelerate','swanlab','decord','av','SAM-2'] value={'python':platform.python_version(),'versions':{n:m.version(n) for n in names},'cuda':torch.version.cuda} Path('provenance/environment.json').write_text(json.dumps(value,indent=2)+'\n') print(json.dumps(value,indent=2)) PY