OpenPi_POC_Dev/scripts/fetch_openpi.sh
2026-10-09 16:41:13 +08:00

30 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# 重建 openpi/ 上游源码: 克隆 Physical-Intelligence/openpi @ 基线 commit 并应用本地补丁。
# 补丁来源: openpi 仓库本地提交 da7ce8b (DataPipeline 定制: 1:1-only revert +
# 多数据集 concat), 导出为 patches/openpi_da7ce8b.patch 随本仓库维护。
# 注意: 重建后工作树内容与原 da7ce8b 提交一致, 但 commit hash 不同 (无 .git 历史)。
set -euo pipefail
cd "$(dirname "$0")/.."
BASE="15a9616a00943ada6c20a0f158e3adb39df2ccac"
PATCH="patches/openpi_da7ce8b.patch"
# 幂等: 已存在且 HEAD 为完整仓库则退出
if git -C openpi rev-parse HEAD >/dev/null 2>&1; then
echo "[fetch_openpi] openpi/ 已存在: $(git -C openpi rev-parse --short HEAD)"
exit 0
fi
[ -f "$PATCH" ] || { echo "[fetch_openpi] 缺少补丁文件: $PATCH"; exit 1; }
# GitHub 需走代理
export http_proxy="${http_proxy:-http://192.168.16.68:18000}"
export https_proxy="${https_proxy:-http://192.168.16.68:18000}"
rm -rf openpi
git clone https://github.com/Physical-Intelligence/openpi.git openpi
git -C openpi checkout "$BASE"
git -C openpi apply --check "../$PATCH"
git -C openpi apply "../$PATCH"
echo "[fetch_openpi] done: upstream@$BASE + $PATCH"