Spaces:
Running
Running
MrYxJ
commited on
Commit
·
7cbf317
1
Parent(s):
234fa16
create
Browse files- app.py +2 -2
- requirements.txt +2 -1
app.py
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
Mail : yxj2017@gmail.com
|
9 |
Github : https://github.com/MrYxJ
|
10 |
Date : 2023-09-05 23:25:28
|
11 |
-
LastEditTime : 2023-09-09 19:
|
12 |
Copyright (C) 2023 mryxj. All rights reserved.
|
13 |
'''
|
14 |
import gradio as gr
|
@@ -62,7 +62,7 @@ with gr.Blocks() as demo:
|
|
62 |
"""<img src="https://raw.githubusercontent.com/MrYxJ/calculate-flops.pytorch/main/screenshot/calflops_hf3.png?raw=true" style="float: left;" width="250" height="250"><h1> ⛽️Model(Transformers) FLOPs and Parameter Calculator</h1>
|
63 |
This tool is based on the python package [calflops](https://pypi.org/project/calflops/) developed in 🤗Huggingface Space specifically for mainly transformers model to compute FLOPs and Parameters num more convenient.
|
64 |
And calflops is designed to compute the theoretical amount of FLOPs(floating-point operations)、MACs(multiply-add operations) and Parameters in all various neural networks, also including **Transformers(Bert、LlaMA etc Large Language Model) Models** as long as based on the Pytorch implementation,
|
65 |
-
, which also open source on github, welcome to [star🌟 and use🌟](https://
|
66 |
|
67 |
This tool can support the calculation of FLOPs without downloading the parameters of the whole model to the local which is very friendly for large models, but at the same time, this method can only support forward propagation of the model in the `meta` device (Some model implemented operators are not supported on meta device).
|
68 |
Therefore, it is possible that the model operator cannot calculate FLOPs in this way because it does not support calculation on `meta` device, which is that you can also calculate FLOPs by ```pip install calflops``` and download the parameters of the full model to the local.
|
|
|
8 |
Mail : yxj2017@gmail.com
|
9 |
Github : https://github.com/MrYxJ
|
10 |
Date : 2023-09-05 23:25:28
|
11 |
+
LastEditTime : 2023-09-09 19:56:42
|
12 |
Copyright (C) 2023 mryxj. All rights reserved.
|
13 |
'''
|
14 |
import gradio as gr
|
|
|
62 |
"""<img src="https://raw.githubusercontent.com/MrYxJ/calculate-flops.pytorch/main/screenshot/calflops_hf3.png?raw=true" style="float: left;" width="250" height="250"><h1> ⛽️Model(Transformers) FLOPs and Parameter Calculator</h1>
|
63 |
This tool is based on the python package [calflops](https://pypi.org/project/calflops/) developed in 🤗Huggingface Space specifically for mainly transformers model to compute FLOPs and Parameters num more convenient.
|
64 |
And calflops is designed to compute the theoretical amount of FLOPs(floating-point operations)、MACs(multiply-add operations) and Parameters in all various neural networks, also including **Transformers(Bert、LlaMA etc Large Language Model) Models** as long as based on the Pytorch implementation,
|
65 |
+
, which also open source on github, welcome to [star🌟 and use🌟](https://github.com/MrYxJ/calculate-flops.pytorch).
|
66 |
|
67 |
This tool can support the calculation of FLOPs without downloading the parameters of the whole model to the local which is very friendly for large models, but at the same time, this method can only support forward propagation of the model in the `meta` device (Some model implemented operators are not supported on meta device).
|
68 |
Therefore, it is possible that the model operator cannot calculate FLOPs in this way because it does not support calculation on `meta` device, which is that you can also calculate FLOPs by ```pip install calflops``` and download the parameters of the full model to the local.
|
requirements.txt
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
calflops
|
|
|
2 |
accelerate @ git+https://github.com/huggingface/accelerate
|
3 |
transformers
|
4 |
timm
|
5 |
huggingface_hub
|
6 |
tabulate
|
7 |
-
pandas
|
|
|
1 |
calflops
|
2 |
+
bitsandbytes
|
3 |
accelerate @ git+https://github.com/huggingface/accelerate
|
4 |
transformers
|
5 |
timm
|
6 |
huggingface_hub
|
7 |
tabulate
|
8 |
+
pandas
|