Skip to content

[feat] Adding configuration to the torch.utils.data.DataLoader #1409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

YushunXiang
Copy link
Contributor

This pull request introduces enhancements to the training pipeline configuration and data loader setup to improve performance and flexibility. The most important changes include adding new configuration options to the TrainPipelineConfig class and utilizing these options in the data loader initialization.

Enhancements to training pipeline configuration:

  • lerobot/configs/train.py: Added two new configuration options, persistent_workers (defaulting to False) and prefetch_factor (defaulting to None), to the TrainPipelineConfig class. These options provide finer control over data loading behavior.

Updates to data loader setup:

  • lerobot/scripts/train.py: Updated the data loader initialization in the train function to use the new persistent_workers and prefetch_factor options from the TrainPipelineConfig. The prefetch_factor is conditionally applied only when num_workers > 0.

@Copilot Copilot AI review requested due to automatic review settings June 30, 2025 12:35
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the training pipeline by adding configuration options to fine-tune the DataLoader behavior, improving both performance and flexibility.

  • Added two new configuration options—persistent_workers and prefetch_factor—to TrainPipelineConfig.
  • Updated the DataLoader initialization in the training script (train.py) to conditionally apply prefetch_factor when num_workers > 0.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lerobot/scripts/train.py Updated DataLoader setup to include persistent_workers and prefetch_factor.
lerobot/configs/train.py Added new configuration options persistent_workers and prefetch_factor to TrainPipelineConfig.
Comments suppressed due to low confidence (2)

lerobot/scripts/train.py:186

  • Consider adding an inline comment explaining that prefetch_factor is applied only when num_workers > 0, which can help clarify the conditional usage for future maintainers.
        prefetch_factor=cfg.prefetch_factor if cfg.num_workers > 0 else None,

lerobot/configs/train.py:66

  • Consider enhancing the class-level documentation or adding inline comments that explain the purpose and expected behavior of the persistent_workers and prefetch_factor configuration options.
    persistent_workers: bool = False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant