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)
https://pypi.org/project/calflops/
MIT License
587 stars 21 forks source link

Library `gpt-neox` is not supported yet #18

Closed melisa-writer closed 5 months ago

melisa-writer commented 8 months ago

I am trying to run:

from calflops import calculate_flops_hf

model_name = "EleutherAI/pythia-70m"
batch_size = 1
max_seq_length = 10

flops, macs, params = calculate_flops_hf(model_name, input_shape=(batch_size, max_seq_length))

Here is the full error traceback:

Traceback (most recent call last):
  File "/home/melisarussak/based-research/count_flops.py", line 20, in <module>
    flops, macs, params = calculate_flops_hf(model_name, input_shape=(batch_size, max_seq_length))
  File "/home/melisarussak/based-research/venv/lib/python3.10/site-packages/calflops/flops_counter_hf.py", line 77, in calculate_flops_hf
    empty_model = create_empty_model(model_name=model_name,
  File "/home/melisarussak/based-research/venv/lib/python3.10/site-packages/calflops/estimate.py", line 133, in create_empty_model
    raise ValueError(
ValueError: Library `gpt-neox` is not supported yet, please open an issue on GitHub for us to add support.
MrYxJ commented 5 months ago

It is ok, you can try it EleutherAI/pythia-70m in https://huggingface.co/spaces/MrYXJ/calculate-model-flops