mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-26 19:26:16 +00:00
fix(vlabench): re-install lerobot editably + coerce agent_pos shape
- The nightly base image has stale lerobot code (pre-dates VLABenchEnv addition), so COPY . . doesn't propagate into .venv. Run `uv pip install --no-deps -e .` after COPY, same fix as robocasa365. - Coerce ee_state to exactly shape (7,) so SyncVectorEnv.concatenate doesn't raise "Output array is the wrong shape" when VLABench's actual ee_state length differs from our declared observation_space. Made-with: Cursor
This commit is contained in:
@@ -50,4 +50,8 @@ RUN python ~/VLABench/scripts/download_assets.py --choice all
|
|||||||
# Overlay the PR's source code on top of the nightly image.
|
# Overlay the PR's source code on top of the nightly image.
|
||||||
COPY --chown=user_lerobot:user_lerobot . .
|
COPY --chown=user_lerobot:user_lerobot . .
|
||||||
|
|
||||||
|
# Re-install lerobot editably so the new source (with VLABenchEnv registration
|
||||||
|
# and updated obs handling) replaces the stale package baked into the nightly image.
|
||||||
|
RUN uv pip install --no-cache --no-deps -e .
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
|||||||
@@ -248,8 +248,14 @@ class VLABenchEnv(gym.Env):
|
|||||||
|
|
||||||
images[key] = cv2.resize(images[key], (w, h), interpolation=cv2.INTER_AREA).astype(np.uint8)
|
images[key] = cv2.resize(images[key], (w, h), interpolation=cv2.INTER_AREA).astype(np.uint8)
|
||||||
|
|
||||||
# Extract end-effector state
|
# Extract end-effector state — coerce to exactly (7,) so vector env concat
|
||||||
|
# doesn't fail with shape-mismatch on buffer np.stack.
|
||||||
ee_state = obs.get("ee_state", np.zeros(7, dtype=np.float64))
|
ee_state = obs.get("ee_state", np.zeros(7, dtype=np.float64))
|
||||||
|
ee_state = np.asarray(ee_state, dtype=np.float64).ravel()
|
||||||
|
if ee_state.shape[0] != 7:
|
||||||
|
fixed = np.zeros(7, dtype=np.float64)
|
||||||
|
fixed[: min(7, ee_state.shape[0])] = ee_state[:7]
|
||||||
|
ee_state = fixed
|
||||||
|
|
||||||
if self.obs_type == "pixels":
|
if self.obs_type == "pixels":
|
||||||
return {"pixels": images}
|
return {"pixels": images}
|
||||||
|
|||||||
Reference in New Issue
Block a user