megvii-research / AnchorDETR

An official implementation of the Anchor DETR.
Other
338 stars 36 forks source link

Question about calculating GFLOPs #47

Closed yao-zheng-yi closed 1 year ago

yao-zheng-yi commented 1 year ago

Hi! I ran the compute_flops.py file to calculate the GFLOPs of the model but got the following error:

`Traceback (most recent call last): File "/data/cwy/AnchorDETR/compute_flops.py", line 41, in do_flop() File "/data/cwy/AnchorDETR/compute_flops.py", line 32, in do_flop counts += flops.by_operator() File "/data/cwy/envs/detr/lib/python3.9/site-packages/fvcore/nn/jit_analysis.py", line 265, in by_operator stats = self._analyze() File "/data/cwy/envs/detr/lib/python3.9/site-packages/fvcore/nn/jit_analysis.py", line 551, in _analyze graph = _get_scoped_trace_graph(self._model, self._inputs, self._aliases) File "/data/cwy/envs/detr/lib/python3.9/site-packages/fvcore/nn/jit_analysis.py", line 176, in _get_scoped_tracegraph graph, = _get_trace_graph(module, inputs) File "/data/cwy/envs/detr/lib/python3.9/site-packages/torch/jit/_trace.py", line 1166, in _get_trace_graph outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, *kwargs) File "/data/cwy/envs/detr/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl return forward_call(input, **kwargs) File "/data/cwy/envs/detr/lib/python3.9/site-packages/torch/jit/_trace.py", line 127, in forward graph, out = torch._C._create_graph_by_tracing( RuntimeError: 0INTERNAL ASSERT FAILED at "../torch/csrc/jit/ir/aliasanalysis.cpp":607, please report a bug to PyTorch. We don't have an op for aten::fill but it isn't a special case. Argument types: Tensor, bool,

Candidates: aten::fill.Scalar(Tensor(a!) self, Scalar value) -> (Tensor(a!)) aten::fill.Tensor(Tensor(a!) self, Tensor value) -> (Tensor(a!))`

I tried many ways, but still can't solve it, how can I modify the code?

tangjiuqi097 commented 1 year ago

Sorry, I do not know why this issue happen. It can run smoothly in our system. The versions of libraries in our system are: pytorch 1.8.1, fvcore 0.1.5. post20220305, and detectron2 0.6+cu102.

yao-zheng-yi commented 1 year ago

Thank you so much! According to the environment configuration you provided, I have successfully run it.