-
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
Open
littlebullGit
wants to merge
2
commits into
Lightning-AI:master
Choose a base branch
from
littlebullGit:fix/20972-mlflow-logger-windows-uri-from-master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix MLFlowLogger.save_dir Windows file URI handling #20988
littlebullGit
wants to merge
2
commits into
Lightning-AI:master
from
littlebullGit:fix/20972-mlflow-logger-windows-uri-from-master
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rittik9
approved these changes
Jul 20, 2025
@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. |
SkafteNicki
approved these changes
Aug 9, 2025
41d41c0
to
c370a89
Compare
@littlebullGit this requires @williamFalcon only as he is the single code-owner for loggers |
196e27e
to
d248b61
Compare
- 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
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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/