-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix MLFlowLogger.save_dir Windows file URI handling #20988
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
base: master
Are you sure you want to change the base?
Fix MLFlowLogger.save_dir Windows file URI handling #20988
Conversation
@lantiga @williamFalcon , @Borda @ethanwharris @tchaton @justusschock Let me know your comments. Any changes I need to get this PR approved? It has been 2 weeks. |
41d41c0
to
c370a89
Compare
@littlebullGit this requires @williamFalcon only as he is the single code-owner for loggers |
196e27e
to
d248b61
Compare
d0ef6b4
to
2025782
Compare
The failed check has nothing to do with the code fix. We can rerun the test once @williamFalcon reviewed the code. |
2025782
to
952e2ed
Compare
just rebased the PR |
- Replace simple string slicing with urllib.parse.urlparse and url2pathname - Properly handle Windows absolute file URIs (e.g., file:///C:/path) - Add comprehensive tests for various file URI formats - Fix malformed paths like ///C:/path becoming C:/path on Windows Fixes Lightning-AI#20972
- Handle both proper file URIs (file:///path) and legacy format (file:/path) - Proper URIs use urlparse/url2pathname for Windows compatibility - Legacy format used by constructor returns path as-is - Update tests to cover both formats and Windows behavior
6c52a05
to
de52cd6
Compare
build error did not seems related to my changes. |
Fix MLFlowLogger.save_dir Windows file URI handling
What does this PR do?
Fixes #20972
This PR fixes a bug in
MLFlowLogger.save_dir
where Windows absolute file URIs were being incorrectly parsed, resulting in malformed local paths that causedFileNotFoundError
on Windows systems.Problem:
When using [MLFlowLogger] with Windows absolute file URIs (e.g.,
file:///C:/Dev/example/mlruns
), the [save_dir] property would return malformed paths like///C:/Dev/example/mlruns
instead of the expectedC:/Dev/example/mlruns
, causing file system operations to fail.Solution:
urllib.parse.urlparse
andurllib.request.url2pathname
file:///C:/path
)///C:/path
becomingC:/path
on WindowsChanges:
MLFlowLogger.save_dir
property to use standard library URI parsing methods📚 Documentation preview 📚: https://pytorch-lightning--20988.org.readthedocs.build/en/20988/