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

Can this project support count MACs of a onnx model ? #1

Open
hyuan-kamuda opened this issue Feb 26, 2021 · 2 comments
Open

Can this project support count MACs of a onnx model ? #1

hyuan-kamuda opened this issue Feb 26, 2021 · 2 comments

Comments

@hyuan-kamuda
Copy link

Searching "onnx MACs" to reach this project , I am finding a onnx model profiler tool like "https://github.com/Lyken17/pytorch-OpCounter" , need to use the tool to count onnx models' MACs

Thanks lot

@gmalivenko
Copy link
Owner

Hello @hyuan-kamuda.

The project is in progress now. It supports basic layers such as Conv, Linear, some activations. You can try to calculate number of MACs using CLI (see more in readme).

@hyuan-kamuda
Copy link
Author

Hello @hyuan-kamuda.

The project is in progress now. It supports basic layers such as Conv, Linear, some activations. You can try to calculate number of MACs using CLI (see more in readme).

I tried below

My enviorment: CentOS8
Anaconda3 with Python3.7
numpy 1.19.2
onnx 1.8.1
onnxruntime 1.6.0

(py37) [hyuan@localhost ~]$conda list
packages in environment at /home/hyuan/anaconda3/envs/py37:

Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 1_gnu conda-forge
blas 1.0 mkl defaults
ca-certificates 2021.1.19 h06a4308_0 defaults
certifi 2020.12.5 py37h89c1867_1 conda-forge
cpuonly 1.0 0 pytorch
freetype 2.10.4 h5ab3b9f_0 defaults
intel-openmp 2020.2 254 defaults
jpeg 9b h024ee3a_2 defaults
lcms2 2.11 h396b838_0 defaults
ld_impl_linux-64 2.33.1 h53a641e_7 defaults
libedit 3.1.20191231 h14c3975_1 defaults
libffi 3.3 he6710b0_2 defaults
libgcc-ng 9.3.0 h2828fa1_18 conda-forge
libgomp 9.3.0 h2828fa1_18 conda-forge
libpng 1.6.37 hbc83047_0 defaults
libprotobuf 3.15.2 h780b84a_0 conda-forge
libstdcxx-ng 9.3.0 h6de172a_18 conda-forge
libtiff 4.1.0 h2733197_1 defaults
libuv 1.40.0 h7b6447c_0 defaults
lz4-c 1.9.3 h2531618_0 defaults
mkl 2020.2 256 defaults
mkl-service 2.3.0 py37he8ac12f_0 defaults
mkl_fft 1.3.0 py37h54f3939_0 defaults
mkl_random 1.1.1 py37h0573a6f_0 defaults
ncurses 6.2 he6710b0_1 defaults
ninja 1.10.2 py37hff7bd54_0 defaults
numpy 1.19.2 py37h54aff64_0 defaults
numpy-base 1.19.2 py37hfa32c7d_0 defaults
olefile 0.46 py37_0 defaults
onnx 1.8.1 py37h7d3e3ad_1 conda-forge
onnxruntime 1.6.0 pypi_0 pypi
openssl 1.1.1j h27cfd23_0 defaults
pillow 8.1.0 py37he98fc37_0 defaults
pip 21.0.1 py37h06a4308_0 defaults
protobuf 3.15.2 py37hcd2ae1e_0 conda-forge
python 3.7.10 hdb3f193_0 defaults
python_abi 3.7 1_cp37m conda-forge
pytorch 1.7.1 py3.7_cpu_0 [cpuonly] pytorch
readline 8.1 h27cfd23_0 defaults
setuptools 52.0.0 py37h06a4308_0 defaults
six 1.15.0 py37h06a4308_0 defaults
sqlite 3.33.0 h62c20be_0 defaults
tk 8.6.10 hbc83047_0 defaults
torchaudio 0.7.2 py37 pytorch
torchvision 0.8.2 py37_cpu [cpuonly] pytorch
typing-extensions 3.7.4.3 0 conda-forge
typing_extensions 3.7.4.3 py_0 conda-forge
wheel 0.36.2 pyhd3eb1b0_0 defaults
xz 5.2.5 h7b6447c_0 defaults
zlib 1.2.11 h7b6447c_3 defaults
zstd 1.4.5 h9ceee32_0 defaults

Following your project readme install but met below errors, could you pls help?

$ pip install onnx_opcounter
Collecting onnx_opcounter
Using cached onnx_opcounter-0.0.2.tar.gz (3.3 kB)
ERROR: Command errored out with exit status 1:
command: /home/hyuan/anaconda3/envs/py37/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mv0no8x3/onnx-opcounter_610c3423f4e54dbbab28f1241d9522c3/setup.py'"'"'; file='"'"'/tmp/pip-install-mv0no8x3/onnx-opcounter_610c3423f4e54dbbab28f1241d9522c3/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-zop4ylid
cwd: /tmp/pip-install-mv0no8x3/onnx-opcounter_610c3423f4e54dbbab28f1241d9522c3/
Complete output (7 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-mv0no8x3/onnx-opcounter_610c3423f4e54dbbab28f1241d9522c3/setup.py", line 9, in
reqs = parse_requirements('requirements.txt')
File "/tmp/pip-install-mv0no8x3/onnx-opcounter_610c3423f4e54dbbab28f1241d9522c3/setup.py", line 5, in parse_requirements
lineiter = (line.strip() for line in open(filename))
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/aa/19/f202a25f37822819ad12cf04e9be3447ad781b50f45e17e32be4221a165f/onnx_opcounter-0.0.2.tar.gz#sha256=66318aa30ce5f529f15cc80e33b541bc275f7df4043caa47679650589ee58978 (from https://pypi.org/simple/onnx-opcounter/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Downloading onnx_opcounter-0.0.1.tar.gz (2.6 kB)
ERROR: Command errored out with exit status 1:
command: /home/hyuan/anaconda3/envs/py37/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mv0no8x3/onnx-opcounter_3b2f90e65da64ac98910c4fccedd63df/setup.py'"'"'; file='"'"'/tmp/pip-install-mv0no8x3/onnx-opcounter_3b2f90e65da64ac98910c4fccedd63df/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-azu54_5y
cwd: /tmp/pip-install-mv0no8x3/onnx-opcounter_3b2f90e65da64ac98910c4fccedd63df/
Complete output (7 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-mv0no8x3/onnx-opcounter_3b2f90e65da64ac98910c4fccedd63df/setup.py", line 9, in
reqs = parse_requirements('requirements.txt')
File "/tmp/pip-install-mv0no8x3/onnx-opcounter_3b2f90e65da64ac98910c4fccedd63df/setup.py", line 5, in parse_requirements
lineiter = (line.strip() for line in open(filename))
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/41/9c/ed84291bfbc19f791462677395f2466654d58c26497146db7446dc6577d3/onnx_opcounter-0.0.1.tar.gz#sha256=903b54b7f7c1892173f6db5017a2d2fa87da8d3f2546599ce9e15e029e02c1d3 (from https://pypi.org/simple/onnx-opcounter/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement onnx_opcounter
ERROR: No matching distribution found for onnx_opcounter

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

No branches or pull requests

2 participants