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

#161 update macs calibration library #202

Merged
merged 2 commits into from
Oct 24, 2023
Merged

Conversation

deepkyu
Copy link
Contributor

@deepkyu deepkyu commented Oct 23, 2023

Description

Please include a summary in English, of the changes in this pull request. If it closes an issue, please mention it here.

Closes: #161

You should link at least one existing issue for PR. Before your create a PR, please check to see if there is an issue for this change.
PRs from forked repository not accepted.

Change(s)

Changelog

If you PR to dev branch, please add a brief summary of the change to the Upcoming Release section of the CHANGELOG.md file and include a link to the PR (formatted in markdown) and a link to your github profile.

For example,

- Added a new feature by `@myusername` in [PR 2023](https://github.com/Nota-NetsPresso/netspresso-trainer/pull/2023)

Code Formatting

If you PR to either master or dev branch, you should follow the code linting process. Please check your code with lint_check.sh in ./scripts directory.
For more information, please read the contribution guide in CONTRIBUTING.md.

@deepkyu deepkyu linked an issue Oct 23, 2023 that may be closed by this pull request
1 task
@deepkyu deepkyu requested a review from Only-bottle October 23, 2023 07:10
@deepkyu
Copy link
Contributor Author

deepkyu commented Oct 23, 2023

Added special reviewer @Only-bottle for:

  • Validate the counter update

@deepkyu deepkyu marked this pull request as ready for review October 23, 2023 07:14
@deepkyu deepkyu requested a review from illian01 as a code owner October 23, 2023 07:14
@deepkyu
Copy link
Contributor Author

deepkyu commented Oct 23, 2023

fvcore does not separately count pooling layers and add_ operators. This issue is also mentioned in the fvcore issue.

In addition, fvcore does not provide a separate count for params, so I have changed it to the commonly used one, params = sum(p.numel() for p in model.parameters()). This is equivalent with the caliration procedure in thop.
As a result, in NP Trainer ResNet50, I have confirmed the following results. Note that the params remain the same, but there is a difference in MACs.

fvcore + vanila params count

2023-10-23_06:47:31 UTC | INFO          | save_summary:<base.py>:322 >>> [Model stats] Params: 23.51M | MACs: 5.37G

thop

2023-10-23_06:48:32 UTC | INFO          | save_summary:<base.py>:322 >>> [Model stats] Params: 23.51M | MACs: 5.40G

Copy link
Member

@Only-bottle Only-bottle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@deepkyu deepkyu assigned illian01 and unassigned Only-bottle Oct 23, 2023
Copy link
Collaborator

@illian01 illian01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@deepkyu deepkyu merged commit 26634c3 into dev Oct 24, 2023
2 checks passed
@deepkyu deepkyu deleted the 161-fvcore-mac-cabliration branch October 25, 2023 06:51
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.

[Feature Request] Sync model calibration metric with PyNetsPresso
3 participants