-
-
Notifications
You must be signed in to change notification settings - Fork 50
Investigate argmax TypeError in facetorch issue 84 #87
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
base: main
Are you sure you want to change the base?
Investigate argmax TypeError in facetorch issue 84 #87
Conversation
Co-authored-by: gajarsky.tomas <[email protected]>
- 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
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 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.run
to 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
if isinstance(preds, tuple): | |
if isinstance(preds, tuple): | |
if len(preds) == 0: | |
# Handle empty tuple gracefully, e.g., return empty list | |
return [] |
Copilot uses AI. Check for mistakes.
Update
PostArgMax.run
to accept and process tuple inputs, resolving aTypeError
.The
TypeError
occurred becausePostArgMax.run
expected atorch.Tensor
but 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