Skip to content

Conversation

@ivarejao
Copy link

@ivarejao ivarejao commented Dec 8, 2025

Summary

This pull request fixes an issue in the SampleId.download_file function when saving a model checkpoint to a directory on a different partition from the root filesystem.

Problem

On my system, the root volume / is mounted on a different partition than /home, where the model checkpoint is saved. This caused the following error:

OSError: [Errno 18] Invalid cross-device link

Because the temporary file where the checkpoint is initially saved is on a different partition from its final destination.
Therefore, this error occurs when attempting to move a file across different filesystems using an operation that only works within a single filesystem.

Solution

Based on guidance from a related Stack Overflow discussion, operation that should be used is shutil.move, which correctly handles moves across different partitions/filesystems.

This change ensures that SampleId.download_file works regardless of how the underlying filesystems are mounted.

`os.rename` only works if source and destination are on the same file system. Therefore, `shutil.move` should be used instead.
Copy link

@aRI0U aRI0U left a comment

Choose a reason for hiding this comment

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

Sounds good to me, thanks for your contribution. @joansj could you please accept the PR?

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