← Open Source
MrYxJ

calculate-flops.pytorch

The calflops is designed to calculate FLOPs、MACs and Parameters in all various neural networks, such as Linear、 CNN、 RNN、 GCN、Transformer(Bert、LlaMA etc Large Language Model).

Model DevelopmentInterpretabilityPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
948
Stars
44
Forks
+0
This week
3
Contributors
Created 2023-08-20 · Updated 2026-09-22 · #12449 today
Top developers
MrYxJvzantedeschipingzhili

MrYxJ/calculate-flops.pytorch is ranked 12,449 with 948 stars.

Same-category comparison

MrYxJ/calculate-flops.pytorch is ranked 12,449 among these 8 peers; StanfordVL/GibsonEnv is ranked 12,450.

Same-category comparison
NameRankMetrics
fungtion/DANN12,439
Language:
Python
Stars:
950
Forks:
160
Description:
pytorch implementation of Domain-Adversarial Training of Neural Networks.
CalciferZh/SMPL12,445
Language:
Python
Stars:
949
Forks:
138
Description:
NumPy, TensorFlow and PyTorch implementation of human body SMPL model and infant body SMIL model.
OpenQuadruped/spot_mini_mini12,446
Language:
C++
Stars:
949
Forks:
195
Description:
Dynamics and Domain Randomized Gait Modulation with Bezier Curves for Sim-to-Real Legged Locomotion.
facebookresearch/StyleNeRF12,447
Language:
Python
Stars:
949
Forks:
89
Description:
This is the open source implementation of the ICLR2022 paper "StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image Synthesis".
StanfordVL/GibsonEnv12,450
Language:
C
Stars:
948
Forks:
150
Description:
Gibson Environments: Real-World Perception for Embodied Agents.
stanfordnmbl/osim-rl12,454
Language:
Python
Stars:
948
Forks:
252
Description:
Reinforcement learning environments with musculoskeletal models.
ZhendongWang6/Uformer12,456
Language:
Python
Stars:
947
Forks:
133
Description:
[CVPR 2022] Official implementation of the paper "Uformer: A General U-Shaped Transformer for Image Restoration".
f90/Wave-U-Net12,457
Language:
Python
Stars:
947
Forks:
182
Description:
Implementation of the Wave-U-Net for audio source separation.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModel Development
SubcategoryInterpretability
Stars948
Forks44
Contributors3
Created date2023-08-20
Updated date2026-09-22
Stars in 1 day0
Stars in 7 days0
Rank12,449
Previous rank12,374
Rank change-75
7-day stars rank13,428
Previous 7-day stars rank13,439
7-day stars rank change11
Total stars rank11,618
Previous total stars rank11,598
Total stars rank change-20
CountryChina
README summary

calflops: a FLOPs and Params calculate tool for neural networks Introduction This tool(calflops) is designed to compute the theoretical amount of FLOPs(floating-point operations)、MACs(multiply-add operations) and Parameters in all various neural networks, such as Linear、 CNN、 RNN、 GCN、**Transformer(Bert、LlaMA etc Large Language Model)**,even including **any custom models** via as long as based on the Pytorch implementation. Meanwhile this tool supports the printing of FLOPS, Parameter calculation value and proportion of each submodule

of the model, it is convient for users to understand the performance consumption of each part of the model. Latest news, calflops has launched a tool on Huggingface Space, which is more convenient for computing FLOPS in the model of 🤗Huggingface Platform. Welcome to use it: For LLM, this is probably the easiest tool to calculate FLOPs and it is very convenient for **huggingface** platform models. You can use by which in huggingface models to calculate model FLOPs without downloading

entire model weights locally. Notice this method requires the model to support the empty model being created for model inference in meta device. If model can't inference in meta device, you just need assign llm corresponding tokenizer to the parameter: to pass in funcional of , and it will automatically help you build the model input data whose size is input_shape. Alternatively, you also can pass in the input data of models which need multi data as input that you

have constructed. In addition, the implementation process of this package inspired by ptflops、deepspeed、hf accelerate libraries, Thanks for their great efforts, they are both very good work. Meanwhile this package also improves some aspects to calculate FLOPs based on them. How to install Install the latest version From PyPI: And you also can download latest files from How to use calflops Example CNN Model If model has only one input, you just need set the model input size by

parameter , it can automatically generate random model input to complete the calculation: If the model has multiple inputs, use the parameters or , as shown in the Transfomer Model below. Calculate Huggingface Model By Model Name(Online) No need to download the entire parameter weight of the model to the local, just by the model name can test any open source large model on the huggingface platform. You can also use this model urls of huggingface platform to calculate it FLOPs

. There are some model uses that require an application first, and you only need to pass the application in through the to calculate its FLOPs. Transformer Model (Local) Compared to the CNN Model, Transformer Model if you want to use the parameter to make calflops automatically generating the input data, you should pass its corresponding tokenizer through the parameter . If you want to use your own generated specific data to calculate FLOPs, you can use parameter or ,and parameter can

no longer be assigned to pass in this case. Here is an example that can be seen is inconvenient comparedt

Frequently asked questions

How many stars and forks are recorded?

MrYxJ/calculate-flops.pytorch has 948 stars and 44 forks.

What is the repository rank?

MrYxJ/calculate-flops.pytorch is ranked 12,449.

What language and category are recorded?

MrYxJ/calculate-flops.pytorch has 948 stars, uses Python and belongs to Model Development.

Which repository is closest in rank?

MrYxJ/calculate-flops.pytorch is compared with StanfordVL/GibsonEnv, ranked 12,450 with 948 stars.

Nearby in the ranking
Similar items