Skip to content
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: Added length-0 fallback method for pytorch #1265

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

yimuchen
Copy link
Contributor

@yimuchen yimuchen commented Feb 1, 2025

Certain pytorch methods fail with length-0 inputs. Length-0 inputs are potentially common for low efficiency event selection, so here we provide a way for the user to specify what to return for length-0 inputs.

@ikrommyd
Copy link
Collaborator

ikrommyd commented Feb 1, 2025

Apart from the test failure which I'm sure you'll fix, I suggest that it's explicit in the docstring that None in the shape refers to the batch dimension.

I have one question though, why only do this for pytorch? How can we be sure that tensorflow, xgboost and triton are all fine with length-zero batches?

@yimuchen
Copy link
Contributor Author

yimuchen commented Feb 1, 2025

For the other wrappers, there are alternate methods for obtaining the output dimensions rather than having the user specifying those, I'm looking into how to use those.

Ideally, the various libraries should handle the length-0 situations themselves, so we probably just want a flag the enables fall back behavior is something fails.

@yimuchen
Copy link
Contributor Author

yimuchen commented Feb 1, 2025

Very close to being done, the only caveat is that the tensorflow model testing currently requires explicit unfolding to test (so it is an issue with data mangling for length-0 chunks). Still need to think a bit how best to add a proper test case for this. I am otherwise done with the code changes to the main package.

@ikrommyd
Copy link
Collaborator

ikrommyd commented Feb 7, 2025

xgboost is fine with lengh-zero input?

@yimuchen
Copy link
Contributor Author

yimuchen commented Feb 7, 2025

xgboost is fine with lengh-zero input?

Yes, I've added a test case for xgboost, and pytest runs fine with the xgboost test case.

@ikrommyd
Copy link
Collaborator

ikrommyd commented Feb 7, 2025

xgboost is fine with lengh-zero input?

Yes, I've added a test case for xgboost, and pytest runs fine with the xgboost test case.

I guess that's good enough because I wouldn't think the structure of an xgboost model to matter in this.

@yimuchen
Copy link
Contributor Author

yimuchen commented Feb 7, 2025

Test for tensorflow length-0 added, if the CI test cases pass (I did on my machine), I don't have any code to add from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants