mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-18 18:20:08 +00:00
perf(ci): split Dockerfile dep-install from source-copy for faster rebuilds
The dep-install layer (uv sync) now only depends on pyproject.toml, uv.lock, and a minimal package stub — not the full src/ tree. Source code changes only rebuild the final COPY layer (seconds, not minutes). Also switch from type=local cache (lost on ephemeral runners) to type=gha (persisted in GitHub Actions cache, shared across all runs). Before: every src/ change → full uv sync rebuild (~8-10 min) After: src/-only change → cached dep layer, ~30s source copy Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -83,8 +83,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
cache-binary: false
|
cache-binary: false
|
||||||
|
|
||||||
# Build the benchmark-specific image; layer cache lives in the runner's
|
# Build the benchmark-specific image. Layer cache uses GHA cache (persists
|
||||||
# local Docker daemon — reused across re-runs on the same machine.
|
# across runners). The Dockerfile separates dep-install from source-copy,
|
||||||
|
# so code-only changes skip the slow uv-sync layer entirely.
|
||||||
- name: Build Libero benchmark image
|
- name: Build Libero benchmark image
|
||||||
uses: docker/build-push-action@v6 # zizmor: ignore[unpinned-uses]
|
uses: docker/build-push-action@v6 # zizmor: ignore[unpinned-uses]
|
||||||
with:
|
with:
|
||||||
@@ -93,8 +94,8 @@ jobs:
|
|||||||
push: false
|
push: false
|
||||||
load: true
|
load: true
|
||||||
tags: lerobot-benchmark-libero:ci
|
tags: lerobot-benchmark-libero:ci
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache-libero
|
cache-from: type=gha,scope=benchmark-libero
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-libero,mode=max
|
cache-to: type=gha,scope=benchmark-libero,mode=max
|
||||||
|
|
||||||
- name: Login to Hugging Face
|
- name: Login to Hugging Face
|
||||||
if: env.HF_USER_TOKEN != ''
|
if: env.HF_USER_TOKEN != ''
|
||||||
@@ -247,8 +248,8 @@ jobs:
|
|||||||
push: false
|
push: false
|
||||||
load: true
|
load: true
|
||||||
tags: lerobot-benchmark-metaworld:ci
|
tags: lerobot-benchmark-metaworld:ci
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache-metaworld
|
cache-from: type=gha,scope=benchmark-metaworld
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-metaworld,mode=max
|
cache-to: type=gha,scope=benchmark-metaworld,mode=max
|
||||||
|
|
||||||
- name: Run MetaWorld smoke eval (1 episode)
|
- name: Run MetaWorld smoke eval (1 episode)
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -61,9 +61,11 @@ ENV HOME=/home/user_lerobot \
|
|||||||
|
|
||||||
RUN uv venv --python python${PYTHON_VERSION}
|
RUN uv venv --python python${PYTHON_VERSION}
|
||||||
|
|
||||||
# Install only lerobot[libero] — completely isolated from metaworld's dep tree
|
# ── Dependency layer (cached unless pyproject.toml / uv.lock change) ────────
|
||||||
|
# Copy only the files uv needs to resolve deps, plus a minimal package stub
|
||||||
|
# so the editable install can succeed without the full source tree.
|
||||||
COPY --chown=user_lerobot:user_lerobot setup.py pyproject.toml uv.lock README.md MANIFEST.in ./
|
COPY --chown=user_lerobot:user_lerobot setup.py pyproject.toml uv.lock README.md MANIFEST.in ./
|
||||||
COPY --chown=user_lerobot:user_lerobot src/ src/
|
RUN mkdir -p src/lerobot && touch src/lerobot/__init__.py src/lerobot/py.typed
|
||||||
|
|
||||||
RUN uv sync --locked --extra libero --extra smolvla --no-cache
|
RUN uv sync --locked --extra libero --extra smolvla --no-cache
|
||||||
|
|
||||||
@@ -84,6 +86,7 @@ snapshot_download(repo_id='lerobot/libero-assets', repo_type='dataset', \
|
|||||||
|
|
||||||
RUN chmod +x /lerobot/.venv/lib/python${PYTHON_VERSION}/site-packages/triton/backends/nvidia/bin/ptxas
|
RUN chmod +x /lerobot/.venv/lib/python${PYTHON_VERSION}/site-packages/triton/backends/nvidia/bin/ptxas
|
||||||
|
|
||||||
|
# ── Source layer (rebuilds in seconds on code-only changes) ─────────────────
|
||||||
COPY --chown=user_lerobot:user_lerobot . .
|
COPY --chown=user_lerobot:user_lerobot . .
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
|||||||
@@ -61,14 +61,17 @@ ENV HOME=/home/user_lerobot \
|
|||||||
|
|
||||||
RUN uv venv --python python${PYTHON_VERSION}
|
RUN uv venv --python python${PYTHON_VERSION}
|
||||||
|
|
||||||
# Install only lerobot[metaworld] — completely isolated from libero's dep tree
|
# ── Dependency layer (cached unless pyproject.toml / uv.lock change) ────────
|
||||||
|
# Copy only the files uv needs to resolve deps, plus a minimal package stub
|
||||||
|
# so the editable install can succeed without the full source tree.
|
||||||
COPY --chown=user_lerobot:user_lerobot setup.py pyproject.toml uv.lock README.md MANIFEST.in ./
|
COPY --chown=user_lerobot:user_lerobot setup.py pyproject.toml uv.lock README.md MANIFEST.in ./
|
||||||
COPY --chown=user_lerobot:user_lerobot src/ src/
|
RUN mkdir -p src/lerobot && touch src/lerobot/__init__.py src/lerobot/py.typed
|
||||||
|
|
||||||
RUN uv sync --locked --extra metaworld --extra smolvla --no-cache
|
RUN uv sync --locked --extra metaworld --extra smolvla --no-cache
|
||||||
|
|
||||||
RUN chmod +x /lerobot/.venv/lib/python${PYTHON_VERSION}/site-packages/triton/backends/nvidia/bin/ptxas
|
RUN chmod +x /lerobot/.venv/lib/python${PYTHON_VERSION}/site-packages/triton/backends/nvidia/bin/ptxas
|
||||||
|
|
||||||
|
# ── Source layer (rebuilds in seconds on code-only changes) ─────────────────
|
||||||
COPY --chown=user_lerobot:user_lerobot . .
|
COPY --chown=user_lerobot:user_lerobot . .
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
|||||||
Reference in New Issue
Block a user