Conversation
begumcig
requested changes
Jun 6, 2025
Member
begumcig
left a comment
There was a problem hiding this comment.
Thank you so much for fixing this super fast!! Suggested a change to possibly make the device casting more agnostic for all torchmetrics, looks really good overall! Love the Task test!
begumcig
requested changes
Jun 6, 2025
Member
begumcig
left a comment
There was a problem hiding this comment.
One tiny change on filtering :) Almost there!
johannaSommer
approved these changes
Jun 10, 2025
begumcig
requested changes
Jun 11, 2025
src/pruna/engine/load.py
Outdated
Member
There was a problem hiding this comment.
Should we also add a check for if the function has *args with VAR_POSITIONAL for when we need to pass positional arguments?
5ea8388 to
276dbf0
Compare
begumcig
approved these changes
Jun 11, 2025
- Removed unnecessary device parameter popping in TorchMetricWrapper for clip_score. - Enhanced device assignment logic in TorchMetricWrapper for perplexity metric. - Updated MetricRegistry to handle TorchMetricWrapper correctly, ensuring proper metric instantiation with device compatibility.
- Introduced a new test file `test_task.py` to validate the initialization of metrics in the Task class. - Implemented a fixture to mock TorchMetrics for accuracy, precision, and recall during testing. - Utilized parameterized tests to ensure comprehensive coverage of metric names from the MetricRegistry.
- Improved device assignment logic in TorchMetricWrapper by ensuring that the metric is moved to the specified device only if it supports the operation, preventing potential errors. - Streamlined the initialization process for metrics, enhancing compatibility across different metric types.
- Updated the filter_load_kwargs function to only filter keyword arguments if the target function does not accept arbitrary keyword arguments, improving its efficiency and clarity. - Added comprehensive unit tests for filter_load_kwargs to validate its behavior with various function signatures and keyword argument scenarios, ensuring robust functionality.
276dbf0 to
adad05c
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
There was a tiny error with pro-active device assignment in case of
TorchMetricclasses.Related Issue
Fixes #168
Type of Change
How Has This Been Tested?
Checklist
Additional Notes