Megvii-BaseDetection / BEVDepth

Official code for BEVDepth.
MIT License
688 stars 96 forks source link

profiler with "PyTorchProfiler" param of pytorch-lightning,will be TypeError #150

Open qipengh opened 1 year ago

qipengh commented 1 year ago

I want to analyis proformance of this network,by "PyTorchProfiler" param of pytorch-lightning. but i'm having trouble...

refer to: https://pytorch-lightning.readthedocs.io/en/1.6.4/advanced/profiler.html#pytorch-profiler

modify code(bevdepth/exps/base_cli.py):

parser.set_defaults(profiler='simple',
==> 
parser.set_defaults(profiler='pytorch',

shell :

python bevdepth/exps/nuscenes/mv/bev_depth_lss_r50_256x704_128x128_20e_cbgs_2key_da_ema.py --amp_backend native -b 8 --gpus 1

error info:

  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 812, in _fit_impl
    results = self._run(model, ckpt_path=self.ckpt_path)
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1222, in _run
    self._call_callback_hooks("on_fit_start")
  File "/opt/conda/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1637, in _call_callback_hooks
    fn(self, self.lightning_module, *args, **kwargs)
  File "/workspace/volume/hqp-nas/pytorch_models/Training/Detection/BEVDepth/bevdepth/callbacks/ema.py", line 88, in on_fit_start
    trainer.ema_model = ModelEMA(trainer.model.module.module.model.adaptor_cuda(),
  File "/workspace/volume/hqp-nas/pytorch_models/Training/Detection/BEVDepth/bevdepth/callbacks/ema.py", line 46, in __init__
    self.ema = deepcopy(                                                                        
             model.module if is_parallel(model) else model).eval()
..... 
File "/opt/conda/lib/python3.8/copy.py", line 161, in deepcopy
    rv = reductor(4)
TypeError: cannot pickle 'dict_keys' object

how can i fix it...