zefancainlp's picture
download
raw
3.29 kB
#!/usr/bin/env bash
# 中文源码导读(2026-09-15)|阅读顺序 069|本地工程
# 来源:官方同路径无此文件。
# 作用:创建锁定依赖的训练/采样环境,安装包并应用需要的兼容补丁。
# 对照基准:test-time-training/discover@6c40e82;完整路线见 docs/CODE_READING_ORDER_ZH.md。
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
ROOT="$PWD"
export PYTHONNOUSERSITE=1
unset PYTHONPATH VIRTUAL_ENV
command -v uv >/dev/null || { echo 'Install uv first: python3 -m pip install --user uv==0.11.19; add ~/.local/bin to PATH'; exit 1; }
command -v git >/dev/null || { echo 'git is required'; exit 1; }
test "$(uname -s)" = Linux || { echo 'GPU installation requires Linux'; exit 1; }
mkdir -p .cache/vendor
for spec in train-math:3.11.15 train-denoising:3.11.15 serve:3.12.13; do
profile="${spec%:*}"; version="${spec#*:}"
venv="$ROOT/.venv-$profile"
if [ ! -x "$venv/bin/python" ]; then
uv venv --python "$version" --seed "$venv"
fi
actual_version="$("$venv/bin/python" -c 'import platform; print(platform.python_version())')"
test "$actual_version" = "$version" || { echo "$venv uses Python $actual_version; expected $version. Use a fresh repository environment."; exit 1; }
# The lock contains the full installed closure. Do not resolve new versions.
uv pip install --python "$venv/bin/python" --no-deps -r "requirements/local_gpu/$profile.lock.txt"
if [ "$profile" != serve ]; then
uv pip install --python "$venv/bin/python" --no-deps -e .
uv pip install --python "$venv/bin/python" --no-deps \
'simscity @ git+https://github.com/czbiohub/simscity.git@3fce7384f3f75de567d5f3104cd14514e0dc749f' \
'molecular-cross-validation @ git+https://github.com/czbiohub/molecular-cross-validation.git@04d9df0e59a247200153b3ce38952a086169769f'
fi
done
OP="$ROOT/.cache/vendor/openproblems"
if [ ! -d "$OP/.git" ]; then
git clone https://github.com/openproblems-bio/openproblems.git "$OP"
git -C "$OP" checkout --detach f54e8e985e1391807c60741dbee99c85762fbd45
fi
test "$(git -C "$OP" rev-parse HEAD)" = f54e8e985e1391807c60741dbee99c85762fbd45
if git -C "$OP" apply --reverse --check "$ROOT/requirements/denoising/openproblems_api_fix.patch" 2>/dev/null; then
echo 'OpenProblems compatibility patch already applied'
elif git -C "$OP" apply --check "$ROOT/requirements/denoising/openproblems_api_fix.patch"; then
git -C "$OP" apply "$ROOT/requirements/denoising/openproblems_api_fix.patch"
else
echo 'OpenProblems source has an unexpected patch state'; exit 1
fi
# This upstream revision pins an obsolete complete environment. Install only its code;
# the explicit modern scientific stack and compatibility patch are above.
for profile in train-math train-denoising; do
uv pip install --python "$ROOT/.venv-$profile/bin/python" --no-deps -e "$OP"
done
"$ROOT/.venv-serve/bin/python" scripts/patch_vllm.py
"$ROOT/.venv-serve/bin/vllm" serve --help=all > .cache/vllm-help.txt
for flag in enable-mixed-moe-lora-format enable-moe-shared-loras fully-sharded-loras enable-sleep-mode; do
grep -q -- "$flag" .cache/vllm-help.txt || { echo "Missing vLLM flag: $flag"; exit 1; }
done
echo 'Environment installation complete. Next: bash scripts/prepare.sh --model-path /absolute/model/path'

Xet Storage Details

Size:
3.29 kB
·
Xet hash:
73ca542d6c4275842e20b5d914982f7e9832d7f257382d47230d9c52f533c7ca

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.