Skip to content
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

Find module name in an OS-agnostic fashion #24526

Merged
merged 2 commits into from
Jun 27, 2023
Merged

Find module name in an OS-agnostic fashion #24526

merged 2 commits into from
Jun 27, 2023

Conversation

sgugger
Copy link
Collaborator

@sgugger sgugger commented Jun 27, 2023

What does this PR do?

Splitting on os.path.sep to get the filename is not fully-compatible on Windows as the OS recognizes a local path written as folder/file.ext, but os.path.sep is \\. Hopefully this way is better.

Fixes #24517

@sgugger sgugger requested review from ydshieh and LysandreJik June 27, 2023 15:38
Copy link
Collaborator

@ydshieh ydshieh left a comment

Choose a reason for hiding this comment

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

Yeah, thanks!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 27, 2023

The documentation is not available anymore as the PR was closed or merged.

@Tpinion
Copy link

Tpinion commented Jun 27, 2023

if submodule == pretrained_model_name_or_path.split(os.path.sep)[-1]:

This line should be change also~

@sgugger
Copy link
Collaborator Author

sgugger commented Jun 27, 2023

Good point, it's added.

@sgugger sgugger merged commit 38db04e into main Jun 27, 2023
@sgugger sgugger deleted the os_agnostic_dynamic branch June 27, 2023 17:21
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.

[Bug]Non-robust directory splitting and detection at get_cached_module_file
4 participants