imitation icon indicating copy to clipboard operation
imitation copied to clipboard

Fix PosixPath being passed to HuggingFace `save_to_disk` (which does not accept it)

Open iwishiwasaneagle opened this issue 1 year ago • 1 comments

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.

iwishiwasaneagle avatar Jul 13 '24 15:07 iwishiwasaneagle

Fixed in https://github.com/HumanCompatibleAI/imitation/pull/831#issuecomment-2574448401 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

tomtseng avatar Jan 07 '25 21:01 tomtseng