-
Notifications
You must be signed in to change notification settings - Fork 65
feat: Add support for path in map fn #582
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
feat: Add support for path in map fn #582
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for using Path objects in the map function, along with a new test for resolving time templates. The key changes include:
- Updating _resolve_dir and map function signatures to accept Path types.
- Adding tests to verify the time template resolution and map functionality.
- Enhancing error messages and type checks for directory inputs.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/streaming/test_resolver.py | Added _resolve_time_template tests |
tests/processing/test_functions.py | Added new test for map function using Path as output_dir |
src/litdata/streaming/resolver.py | Updated _resolve_dir and _resolve_time_template signatures |
src/litdata/processing/functions.py | Updated map function parameter types to support Path |
Comments suppressed due to low confidence (1)
tests/streaming/test_resolver.py:402
- Ensure that the 'resolver' variable is properly defined or imported in the test; otherwise, this line may lead to a NameError at runtime.
assert resolver._resolve_time_template(path_1) == f"/logs/log_{curr_year}-{curr_month:02d}"
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for resolving a datetime template in directory paths and extends the map function to handle Path objects.
- Added tests for time-based template resolution in file paths.
- Updated type hints and error messages across resolver and processing functions to support Path objects.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tests/streaming/test_resolver.py | Added new test (test_resolve_time_template) for datetime resolution. |
tests/processing/test_functions.py | Introduced tests for the map function with file path updates. |
src/litdata/streaming/resolver.py | Updated _resolve_dir to accept Path objects and improved error messaging. |
src/litdata/processing/functions.py | Updated map function signature to support Path types in parameters. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Hi @SkafteNicki feel free to review the PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #582 +/- ##
===================================
Coverage 79% 79%
===================================
Files 40 40
Lines 6111 6112 +1
===================================
+ Hits 4809 4815 +6
+ Misses 1302 1297 -5 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Let's get one more approval before merging.
Before submitting
What does this PR do?
Fixes #581
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in GitHub issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃