Skip to content

Generalize the model input format of the flops profiler get_model_profile() API#1768

Merged
cli99 merged 9 commits intomasterfrom
fp-model-input
Feb 18, 2022
Merged

Generalize the model input format of the flops profiler get_model_profile() API#1768
cli99 merged 9 commits intomasterfrom
fp-model-input

Conversation

@cli99
Copy link
Contributor

@cli99 cli99 commented Feb 13, 2022

This PR changes the signature of get_model_profile to take args and kwargs as model input. This is more flexible than the previous, input_shape and input_constructor implementation.
For example, if a model forward is defined as def forward(self, x, scale, intermediate_result=False, depth=1, width=0.125), the previous implementation does not work. With this PR, the user invokes the profiler by

flops,macs, params = get_model_profile(model=model, args=[torch.randn(input_shape).to(device), scale], kwargs={"depth": depth, "width": width})

@cli99 cli99 requested review from jeffra, samyam and tjruwase February 13, 2022 00:50
@cli99 cli99 changed the title generalize profiler model input format Generalize profiler model input format Feb 13, 2022
@cli99 cli99 changed the title Generalize profiler model input format Generalize the flops profiler model input format Feb 13, 2022
@cli99 cli99 changed the title Generalize the flops profiler model input format Generalize the flops profiler standalone API model input format Feb 13, 2022
@cli99 cli99 changed the title Generalize the flops profiler standalone API model input format Generalize the flops profiler get_model_profile() model input format Feb 13, 2022
@cli99 cli99 changed the title Generalize the flops profiler get_model_profile() model input format Generalize the model input format of the flops profiler get_model_profile() API Feb 13, 2022
@cli99 cli99 marked this pull request as ready for review February 13, 2022 00:53
@cli99 cli99 merged commit 2151c78 into master Feb 18, 2022
B06901052 pushed a commit to B06901052/DeepSpeed that referenced this pull request Apr 14, 2022
…file() API (deepspeedai#1768)

* generalize profiler model input format
* fix timining of module forward
Co-authored-by: Olatunji Ruwase <olruwase@microsoft.com>
Co-authored-by: Jeff Rasley <jerasley@microsoft.com>
B06901052 pushed a commit to B06901052/DeepSpeed that referenced this pull request Apr 14, 2022
…file() API (deepspeedai#1768)

* generalize profiler model input format
* fix timining of module forward
Co-authored-by: Olatunji Ruwase <olruwase@microsoft.com>
Co-authored-by: Jeff Rasley <jerasley@microsoft.com>
@mrwyattii mrwyattii deleted the fp-model-input branch July 7, 2023 02:39
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.

3 participants