Add FLOPS estimation functionality to ModelBase #191
+106
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add FLOPS estimation functionality
✨ Context
This PR adds FLOPS (Floating Point Operations) estimation capability to the ModelBase class, addressing issue #180 for model complexity/resource utilization comparison.
🧠 Rationale behind the change
FLOPS estimation is needed to compare model resource requirements beyond just parameter count, as parameter count doesn't linearly correlate with computational complexity.
Type of changes
🛠 What does this PR implement
estimate_flops()method toModelBaseusingtorch.utils.flop_counter.FlopCounterMode_resolve_method()helper to resolve method paths for FLOPS counting (supports nested methods likeconch.forward)MODEL_INPUT_ARGSdictionary with test inputs for all models in the registrytest_models_general.pythat verify FLOPS can be computed for each model🙈 Missing
🧪 How should this be tested?
uv run pytest tests/models/test_models_general.py::test_model_init- verifies FLOPS estimation works for all modelsAddresses #180