-
Notifications
You must be signed in to change notification settings - Fork 286
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
Adding the model input iterators. #806
Conversation
4fc4658
to
76fe5b9
Compare
@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
The interface I feel more convenient is:
When I test the model for n iterations, I'll call get_inputs(self, n) to get n batches and feed each batch to each run. But I think the interface you provided is also fine, since I can wrap around it. |
Do we know what are the list of models that this interface can be implemented? |
I believe they can be implemented for all models in https://github.com/pytorch/benchmark/tree/main/torchbenchmark/models, but some of them reads data from a mini-dataset, so the length of inputs is limited (for example, |
Got it. What's the plan to implement this method for other models in torchbench? |
It will need some time to implement, I expect to reach 100% coverage by the end of April |
7e43cc3
to
bc6478f
Compare
@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
d97182f
to
d0a3a40
Compare
@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: This PR adds a new interface, `gen_inputs(self) -> Tuple[Generator, Optional[int]]`. The first element is an iterator of the input data, and the second element is the size of the iterator. If the iterator is infinite, the second value is set to None. Currently, only implement this on `timm` and `torchvision` models. Both of them use randomly generated inputs, therefore the second value is set to None in both cases. Pull Request resolved: pytorch/benchmark#806 Reviewed By: shunting314 Differential Revision: D35155417 Pulled By: xuzhao9 fbshipit-source-id: 5e60223279b09ed4336996f7292741be96070bdd
This PR adds a new interface,
gen_inputs(self) -> Tuple[Generator, Optional[int]]
. The first element is an iterator of the input data, and the second element is the size of the iterator. If the iterator is infinite, the second value is set to None.Currently, only implement this on
timm
andtorchvision
models. Both of them use randomly generated inputs, therefore the second value is set to None in both cases.