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
TF 2.0 Feature: Flops calculation #32809
Comments
Any updates? |
We're working on adding cost model for tf 2.0. Since this is a pretty large feature, it will take more time to enable it. |
Have you made any progress yet? What do you expect when the feature will be available (in the nightly builds)? |
I concur, this would be highly useful |
This feature would be very helpful for me too. |
I am also looking for this feature |
Please, I need it too. |
Just make sure this way can still work in tf2.0: import tensorflow as tf def get_flops(model):
then it's already perfect 😄 |
I had to tweak it to avoid errors with TF 2.0, but I am still not able to get it working.
The output was:
|
I have a related question but I don't know if this kind of questions should be posted here on Git. Could someone give an opinion on it? Wondering if that could even be a bug. |
@qiuminxu any updates on this? |
This works using TF 2.1
|
Note that the above doesn't seem to work when loading from a SavedModel; only from an h5. |
I implemented small lib to calculate FLOPs/MACs: https://github.com/evgps/flopco-keras |
Btw, do you have an idea on how to compute the inference time? |
This repo doesn't work anymore. |
We need to "migrate" this ticket to https://github.com/keras-team/keras |
Hi @pzobel! I found this library keras-flops from an external contributor as work around for now. But could you post in Keras repo as a feature request. Thank you! |
This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you. |
Is there any update on this issue? |
We need to open this in the Keras repo |
Do you mean the KerasCV repo? @bhack |
Keras repo: |
Closing as stale. Please reopen if you'd like to work on this further. |
Hi @pzobel @markub3327 @bhack ! I created a feature request in keras repo with ticket number #16699 on behalf of the users. Feel free to comment there. Thank you! |
Refer to this https://github.com/wandb/wandb/blob/latest/wandb/integration/keras/keras.py#L1025-L1073 for the future visitors
|
Thanks for sharing @albertmundu. |
@sendjasni I followed the link you provided; I used one of the working codes given by user https://stackoverflow.com/users/4619958/ch271828n to see how close the reading is between these two variants. Using StackOverflow code
And it prints the following
Using wandb code #32809 (comment)
It prints
This value is obtained using If you apply the same for the above |
The code you shared is for getting MACs? or FLOPs? Seems like it's getting MACs because it's divided by 2. |
It is MACs |
Please make sure that this is a feature request. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template
System information
Describe the feature and the current behavior/state.
I am missing the opportunity to compute the number of floating point operations of a tf.keras Model in TF 2.0.
In TF 1.x tf.profiler was available see here but I can find anything equivalent for TF 2.0 yet.
Will this change the current api? How?
Who will benefit with this feature?
Everbody interested in the computational complexity of a TensorFlow model.
Any Other info.
The text was updated successfully, but these errors were encountered: