Fix MLFlowLogger.save_dir Windows file URI handling (Fixes #20972) #20988
+52
−1
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/