Skip to content

Conversation

@whats2000
Copy link

Fix: Fix the path resolve issue in Windows

What this does

This PR fixes a path-resolution issue on Windows by ensuring that pretrained_path is kept as a string rather than converted to a Path object.
Using Path() caused backslash/forward-slash inconsistencies, especially when handling HuggingFace repo IDs.
The fix ensures consistent forward-slash formatting across platforms.

How it was tested

  • Updated eval.py and train.py to avoid using Path() for pretrained_path where forward-slash preservation is required.
  • Verified that Windows paths resolve correctly when loading configs.
  • Ran local training/eval runs on Windows to ensure no regressions during config loading.

How to checkout & try? (for the reviewer)

To test the behavior locally run a training command that loads a pretrained policy:

lerobot-train --config-path=path/to/config.yaml

Copilot AI review requested due to automatic review settings November 19, 2025 18:00
@whats2000 whats2000 changed the title Fix: Fix the path resolve issue in windows [Fix] Fix the path resolve issue in windows Nov 19, 2025
Copy link
Contributor

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 fixes a path resolution issue on Windows by preventing the conversion of pretrained_path to a Path object, keeping it as a string instead. This ensures consistent forward-slash formatting, which is essential for HuggingFace repository IDs and cross-platform compatibility.

Key changes:

  • Modified path handling in train.py and eval.py to preserve pretrained_path as a string
  • Used as_posix() method when converting Path objects to strings to maintain forward slashes

Reviewed Changes

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

File Description
src/lerobot/configs/train.py Updated to keep pretrained_path as string and use as_posix() for path consistency
src/lerobot/configs/eval.py Updated to keep pretrained_path as string instead of converting to Path object

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@whats2000
Copy link
Author

whats2000 commented Nov 19, 2025

This kinda because the path in the window will use the \\ for path; if we use the path object, this will always make the HuggingFace repo invalid to resolve. So a better way is that we keep them in posix style string to ensure all the paths create by train and resolve by train in posix style!

@DanielBryars
Copy link

Ahhh I ran into this too. #2552

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.

2 participants