Skip to content

Conversation

@iwishiwasaneagle
Copy link

Description

HuggingFace save_to_disk takes PathLike type which is defined as str, bytes or os.PathLike. imitation.util.parse_path always returned pathlib.Path which is not one of these types. This commit converts pathlib.Path to str before calling HuggingFace save_to_disk.

Related issue #852

Testing

Passed a path in both str and Path forms to save for Trajectory and TrajectoryWithRew. Expanded testing of serialize by adding additional save then load tests.

…as str, bytes or os.PathLike. imitation.util.parse_path always returned pathlib.Path which is not one of these types. This commit converts pathlib.Path to str before calling the HF fn.
trajectories: The trajectories to save.
"""
p = util.parse_path(path)
p = str(util.parse_path(path))
Copy link

Choose a reason for hiding this comment

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

I tested with this solution. It works.

Copy link

Choose a reason for hiding this comment

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

It works! Cheers!

@tomtseng
Copy link
Collaborator

tomtseng commented Jan 7, 2025

Fixed in #831 (comment) before I saw this PR, won't close this because the unit tests may be useful.
However this project is not actively maintained by anyone anymore so not clear if any code owner will review & merge this in the near future

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.

4 participants