Investigate argmax TypeError in facetorch issue 84#87
Open
tomas-gajarsky wants to merge 5 commits intomainfrom
Open
Investigate argmax TypeError in facetorch issue 84#87tomas-gajarsky wants to merge 5 commits intomainfrom
tomas-gajarsky wants to merge 5 commits intomainfrom
Conversation
Co-authored-by: gajarsky.tomas <gajarsky.tomas@gmail.com>
- Remove non-working paperswithcode badges from all model sections - Clean up README formatting for better readability - Badges were causing display issues and not functioning properly
- Remove trailing whitespace from blank line in PostArgMax.run() - Resolves W293 blank line contains whitespace error
- Increment patch version from 0.6.0 to 0.6.1 - Add CHANGELOG entry for PostArgMax tuple handling fix - Document README badge removal and linting fixes
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a TypeError in the PostArgMax.run method that occurred when the method received tuple inputs instead of tensor inputs. The fix adds tuple handling to maintain consistency with other post-processors and the abstract method signature.
- Updated
PostArgMax.runto acceptUnion[torch.Tensor, Tuple[torch.Tensor]]and unpack tuples - Bumped version from 0.6.0 to 0.6.1
- Cleaned up README by removing non-working paperswithcode badges
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| facetorch/analyzer/predictor/post.py | Added tuple input handling to PostArgMax.run method |
| version | Version bump to 0.6.1 |
| CHANGELOG.md | Added changelog entry for v0.6.1 with bug fix details |
| README.md | Removed non-working paperswithcode badges for cleaner documentation |
| Returns: | ||
| List[Prediction]: List of prediction data structures containing the predicted labels and confidence scores for each face in the batch. | ||
| """ | ||
| if isinstance(preds, tuple): |
There was a problem hiding this comment.
Consider adding a check for empty tuples to prevent potential IndexError when accessing preds[0]. An empty tuple would cause the next line to fail.
Suggested change
| if isinstance(preds, tuple): | |
| if isinstance(preds, tuple): | |
| if len(preds) == 0: | |
| # Handle empty tuple gracefully, e.g., return empty list | |
| return [] |
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.
Update
PostArgMax.runto accept and process tuple inputs, resolving aTypeError.The
TypeErroroccurred becausePostArgMax.runexpected atorch.Tensorbut could receive aTuple[torch.Tensor]from some models, while its abstract method and other post-processors already handled tuples. This change adds the necessary tuple unpacking to ensure consistency and prevent the error.Learn more about Cursor Agents