Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into user/aliberts/2025_02…
Browse files Browse the repository at this point in the history
…_10_dataset_v2.1
  • Loading branch information
aliberts committed Feb 15, 2025
2 parents 8426c64 + c4c2ce0 commit aed3eb4
Show file tree
Hide file tree
Showing 27 changed files with 134 additions and 84 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
schedule:
- cron: "0 1 * * *"

permissions: {}

env:
PYTHON_VERSION: "3.10"

Expand All @@ -25,11 +27,14 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
cache-binary: false

- name: Check out code
uses: actions/checkout@v4
with:
lfs: true
persist-credentials: false

- name: Login to DockerHub
uses: docker/login-action@v3
Expand Down Expand Up @@ -60,11 +65,14 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
cache-binary: false

- name: Check out code
uses: actions/checkout@v4
with:
lfs: true
persist-credentials: false

- name: Login to DockerHub
uses: docker/login-action@v3
Expand All @@ -89,9 +97,13 @@ jobs:
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
cache-binary: false

- name: Check out code
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Login to DockerHub
uses: docker/login-action@v3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
schedule:
- cron: "0 2 * * *"

permissions: {}

# env:
# SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
jobs:
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
branches:
- main

permissions: {}

env:
PYTHON_VERSION: "3.10"

Expand All @@ -17,7 +19,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -45,7 +49,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install poetry
run: pipx install "poetry<2.0.0"
Expand All @@ -59,7 +65,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install poetry
run: pipx install "poetry<2.0.0"
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/test-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
# Run only when DockerFile files are modified
- "docker/**"

permissions: {}

env:
PYTHON_VERSION: "3.10"

Expand All @@ -20,6 +22,8 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Get changed files
id: changed-files
Expand All @@ -34,7 +38,7 @@ jobs:
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "matrix=${{ steps.changed-files.outputs.all_changed_files}}" >> $GITHUB_OUTPUT
echo "matrix=${ALL_CHANGED_FILES}" >> $GITHUB_OUTPUT
build_modified_dockerfiles:
Expand All @@ -50,9 +54,13 @@ jobs:
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
cache-binary: false

- name: Check out code
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Build Docker image
uses: docker/build-push-action@v5
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ on:
- "Makefile"
- ".cache/**"

permissions: {}

jobs:
pytest:
name: Pytest
Expand All @@ -32,6 +34,7 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: true # Ensure LFS files are pulled
persist-credentials: false

- name: Install apt dependencies
# portaudio19-dev is needed to install pyaudio
Expand Down Expand Up @@ -72,6 +75,7 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: true # Ensure LFS files are pulled
persist-credentials: false

- name: Install apt dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg
Expand Down Expand Up @@ -108,6 +112,7 @@ jobs:
- uses: actions/checkout@v4
with:
lfs: true # Ensure LFS files are pulled
persist-credentials: false

- name: Install apt dependencies
# portaudio19-dev is needed to install pyaudio
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/trufflehog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ on:

name: Secret Leaks

permissions:
contents: read
permissions: {}

jobs:
trufflehog:
Expand All @@ -14,6 +13,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Secret Scanning
uses: trufflesecurity/trufflehog@main
with:
Expand Down
12 changes: 8 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,28 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.19.1
hooks:
- id: pyupgrade
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.9.6
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
rev: 1.8.5
hooks:
- id: poetry-check
- id: poetry-lock
args:
- "--check"
- "--no-update"
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
rev: v8.23.3
hooks:
- id: gitleaks
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.3.1
hooks:
- id: zizmor
2 changes: 1 addition & 1 deletion lerobot/common/datasets/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def make_dataset(cfg: TrainPipelineConfig) -> LeRobotDataset | MultiLeRobotDatas
)
logging.info(
"Multiple datasets were provided. Applied the following index mapping to the provided datasets: "
f"{pformat(dataset.repo_id_to_index , indent=2)}"
f"{pformat(dataset.repo_id_to_index, indent=2)}"
)

if cfg.dataset.use_imagenet_stats:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def load_from_raw(raw_dir: Path, videos_dir: Path, fps: int, video: bool, episod
# However, note that "nearest" might synchronize the reference camera with other cameras on slightly future timestamps.
# are too far appart.
direction="nearest",
tolerance=pd.Timedelta(f"{1/fps} seconds"),
tolerance=pd.Timedelta(f"{1 / fps} seconds"),
)
# Remove rows with episode_index -1 which indicates data that correspond to in-between episodes
df = df[df["episode_index"] != -1]
Expand Down
6 changes: 3 additions & 3 deletions lerobot/common/policies/act/modeling_act.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,9 @@ def forward(self, batch: dict[str, Tensor]) -> tuple[Tensor, tuple[Tensor, Tenso
latent dimension.
"""
if self.config.use_vae and self.training:
assert (
"action" in batch
), "actions must be provided when using the variational objective in training mode."
assert "action" in batch, (
"actions must be provided when using the variational objective in training mode."
)

batch_size = (
batch["observation.images"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def validate_features(self) -> None:
for key, image_ft in self.image_features.items():
if image_ft.shape != first_image_ft.shape:
raise ValueError(
f"`{key}` does not match `{first_image_key}`, but we " "expect all image shapes to match."
f"`{key}` does not match `{first_image_key}`, but we expect all image shapes to match."
)

@property
Expand Down
8 changes: 4 additions & 4 deletions lerobot/common/policies/pi0/modeling_pi0.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def select_action(self, batch: dict[str, Tensor], noise: Tensor | None = None) -
self._action_queue.extend(actions.transpose(0, 1))
return self._action_queue.popleft()

def forward(self, batch: dict[str, Tensor], noise=None, time=None) -> dict[str, Tensor]:
def forward(self, batch: dict[str, Tensor], noise=None, time=None) -> tuple[Tensor, dict[str, Tensor]]:
"""Do a full training forward pass to compute the loss"""
if self.config.adapt_to_pi_aloha:
batch[OBS_ROBOT] = self._pi_aloha_decode_state(batch[OBS_ROBOT])
Expand Down Expand Up @@ -328,12 +328,12 @@ def forward(self, batch: dict[str, Tensor], noise=None, time=None) -> dict[str,
losses = losses[:, :, : self.config.max_action_dim]
loss_dict["losses_after_rm_padding"] = losses.clone()

loss = losses.mean()
# For backward pass
loss_dict["loss"] = loss
loss = losses.mean()
# For logging
loss_dict["l2_loss"] = loss.item()
return loss_dict

return loss, loss_dict

def prepare_images(self, batch):
"""Apply Pi0 preprocessing to the images, like resizing to 224x224 and padding to keep aspect ratio, and
Expand Down
6 changes: 3 additions & 3 deletions lerobot/common/policies/tdmpc/modeling_tdmpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,9 @@ def _apply_fn(m):

self.apply(_apply_fn)
for m in [self._reward, *self._Qs]:
assert isinstance(
m[-1], nn.Linear
), "Sanity check. The last linear layer needs 0 initialization on weights."
assert isinstance(m[-1], nn.Linear), (
"Sanity check. The last linear layer needs 0 initialization on weights."
)
nn.init.zeros_(m[-1].weight)
nn.init.zeros_(m[-1].bias) # this has already been done, but keep this line here for good measure

Expand Down
2 changes: 1 addition & 1 deletion lerobot/common/policies/vqbet/configuration_vqbet.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def validate_features(self) -> None:
for key, image_ft in self.image_features.items():
if image_ft.shape != first_image_ft.shape:
raise ValueError(
f"`{key}` does not match `{first_image_key}`, but we " "expect all image shapes to match."
f"`{key}` does not match `{first_image_key}`, but we expect all image shapes to match."
)

@property
Expand Down
Loading

0 comments on commit aed3eb4

Please sign in to comment.