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

ImportError: cannot import name 'add_flops_counting_methods' from 'ptflops.flops_counter' #25

Open
sangjun7997 opened this issue Apr 4, 2022 · 6 comments

Comments

@sangjun7997
Copy link

Even though I have installed ptflops using pip, I cannot train by this problem..

~/BtcDet/tools$ python3 train.py --cfg_file ./cfgs/model_configs/btcdet_kitti_car.yaml --output_dir ../output/kitti_car/ --batch_size 2 --gpu_str "0"
Traceback (most recent call last):
File "train.py", line 6, in
from test import repeat_eval_ckpt
File "/home/server10/BtcDet/tools/test.py", line 17, in
from eval_utils import eval_utils as eval_utils
File "/home/server10/BtcDet/tools/eval_utils/eval_utils.py", line 10, in
from ptflops.flops_counter import add_flops_counting_methods
ImportError: cannot import name 'add_flops_counting_methods' from 'ptflops.flops_counter' (/home/server10/.local/lib/python3.8/site-packages/ptflops/flops_counter.py)

How can I handle this error?

@JinSeoung-Oh
Copy link

JinSeoung-Oh commented Apr 22, 2022

Plz, check this repo : https://github.com/sovrasov/flops-counter.pytorch/blob/master/ptflops/flops_counter.py
In this repo, there is no 'add_flops_counting_methods' function
So, I checked train.py and realized 'ptlflops.flops_counter' is not need to run train.py

I changed
from ptflops.flops_counter import add_flops_counting_methods
to

from ptflops.flops_counter import add_flops_counting_methods (add # Maybe you know what I mean)

I solved this problem

I hope it will be work on your env

@sangjun7997
Copy link
Author

주석처리 하라는 말씀이시죠?

@JinSeoung-Oh
Copy link

JinSeoung-Oh commented Apr 22, 2022 via email

@sangjun7997
Copy link
Author

네 ㅋㅋㅋ 답변 감사합니다

@123jyw
Copy link

123jyw commented May 18, 2022

Can you explain how to change it?

@JinSeoung-Oh
Copy link

JinSeoung-Oh commented Oct 11, 2022 via email

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

3 participants