mmrotate icon indicating copy to clipboard operation
mmrotate copied to clipboard

[Bug] TypeError: FormatCode() got an unexpected keyword argument 'verify'

Open milamiqi opened this issue 10 months ago • 6 comments

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

1.x branch https://github.com/open-mmlab/mmrotate/tree/1.x

Environment

NVIDIA RTX A4000 with CUDA capability sm_86 is not compatible with the current PyTorch installation. The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_61 sm_70 sm_75 compute_37. If you want to use the NVIDIA RTX A4000 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name)) sys.platform: linux Python: 3.8.18 (default, Sep 11 2023, 13:40:15) [GCC 11.2.0] CUDA available: True numpy_random_seed: 2147483648 GPU 0,1,2,3: NVIDIA RTX A4000 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.3, V11.3.58 GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.8.0 PyTorch compiling details: PyTorch built with:

  • GCC 7.3
  • C++ Version: 201402
  • Intel(R) oneAPI Math Kernel Library Version 2023.1-Product Build 20230303 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v1.7.0 (Git Hash 7aed236906b1f7a05c0917e5257a1af05e9ff683)
  • OpenMP 201511 (a.k.a. OpenMP 4.5)
  • NNPACK is enabled
  • CPU capability usage: AVX2
  • CUDA Runtime 10.2
  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37
  • CuDNN 7.6.5
  • Magma 2.5.2
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.8.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,

TorchVision: 0.9.0 OpenCV: 4.8.0 MMEngine: 0.8.4 MMRotate: 1.0.0rc1+fd60bef

Reproduces the problem - code sample

我在运行1.x版本的RTMDET时,遇到了如下问题具体的下写在下方

Reproduces the problem - command or script

python tools/train.py /home/dell/Research/zly/mm1/mmrotate/configs/rotated_rtmdet/rotated_rtmdet_l-3x-dota.py

Reproduces the problem - error message

(zly1) zly@dell-PowerEdge-T640:/home/dell/Research/zly/mm1/mmrotate$ python tools/train.py /home/dell/Research/zly/mm1/mmrotate/configs/rotated_rtmdet/rotated_rtmdet_l-3x-dota.py /home/zly/.conda/envs/zly1/lib/python3.8/site-packages/torch/cuda/init.py:104: UserWarning: NVIDIA RTX A4000 with CUDA capability sm_86 is not compatible with the current PyTorch installation. The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_61 sm_70 sm_75 compute_37. If you want to use the NVIDIA RTX A4000 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name)) 09/25 10:35:17 - mmengine - INFO -

System environment: sys.platform: linux Python: 3.8.18 (default, Sep 11 2023, 13:40:15) [GCC 11.2.0] CUDA available: True numpy_random_seed: 756296170 GPU 0,1,2,3: NVIDIA RTX A4000 CUDA_HOME: /usr/local/cuda NVCC: Cuda compilation tools, release 11.3, V11.3.58 GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 PyTorch: 1.8.0 PyTorch compiling details: PyTorch built with:

  • GCC 7.3

  • C++ Version: 201402

  • Intel(R) oneAPI Math Kernel Library Version 2023.1-Product Build 20230303 for Intel(R) 64 architecture applications

  • Intel(R) MKL-DNN v1.7.0 (Git Hash 7aed236906b1f7a05c0917e5257a1af05e9ff683)

  • OpenMP 201511 (a.k.a. OpenMP 4.5)

  • NNPACK is enabled

  • CPU capability usage: AVX2

  • CUDA Runtime 10.2

  • NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_37,code=compute_37

  • CuDNN 7.6.5

  • Magma 2.5.2

  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=10.2, CUDNN_VERSION=7.6.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.8.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,

    TorchVision: 0.9.0 OpenCV: 4.8.0 MMEngine: 0.8.4

Runtime environment: cudnn_benchmark: False mp_cfg: {'mp_start_method': 'fork', 'opencv_num_threads': 0} dist_cfg: {'backend': 'nccl'} seed: 756296170 Distributed launcher: none Distributed training: False GPU number: 1

Traceback (most recent call last): File "/home/zly/.local/lib/python3.8/site-packages/mmengine/config/config.py", line 1475, in pretty_text text, _ = FormatCode( TypeError: FormatCode() got an unexpected keyword argument 'verify'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "tools/train.py", line 125, in main() File "tools/train.py", line 114, in main runner = Runner.from_cfg(cfg) File "/home/zly/.local/lib/python3.8/site-packages/mmengine/runner/runner.py", line 445, in from_cfg runner = cls( File "/home/zly/.local/lib/python3.8/site-packages/mmengine/runner/runner.py", line 386, in init self._log_env(env_cfg) File "/home/zly/.local/lib/python3.8/site-packages/mmengine/runner/runner.py", line 2356, in _log_env self.logger.info(f'Config:\n{self.cfg.pretty_text}') File "/home/zly/.local/lib/python3.8/site-packages/mmengine/config/config.py", line 1478, in pretty_text raise SyntaxError('Failed to format the config file, please ' SyntaxError: Failed to format the config file, please check the syntax of: angle_version='le90' backend_args=None base_lr=0.00025 checkpoint='https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext-l_8xb256-rsb-a1-600e_in1k-6a760974.pth' custom_hooks=[ dict(type='mmdet.NumClassCheckHook'), dict(ema_type='mmdet.ExpMomentumEMA', momentum=0.0002, priority=49, type='EMAHook', update_buffers=True), ] data_root='/home/dell/Research/zly/mmrotate-main/data/DOTA/' dataset_type='DOTADataset' default_hooks=dict( checkpoint=dict( interval=12, max_keep_ckpts=3, type='CheckpointHook'), logger=dict( interval=50, type='LoggerHook'), param_scheduler=dict( type='ParamSchedulerHook'), sampler_seed=dict( type='DistSamplerSeedHook'), timer=dict( type='IterTimerHook'), visualization=dict( type='mmdet.DetVisualizationHook')) default_scope='mmrotate' env_cfg=dict( cudnn_benchmark=False, dist_cfg=dict( backend='nccl'), mp_cfg=dict( mp_start_method='fork', opencv_num_threads=0)) interval=12 launcher='none' load_from=None log_level='INFO' log_processor=dict( by_epoch=True, type='LogProcessor', window_size=50) max_epochs=36 model=dict( backbone=dict( act_cfg=dict( type='SiLU'), arch='P5', channel_attention=True, deepen_factor=1, expand_ratio=0.5, init_cfg=dict( checkpoint='https://download.openmmlab.com/mmdetection/v3.0/rtmdet/cspnext_rsb_pretrain/cspnext-l_8xb256-rsb-a1-600e_in1k-6a760974.pth', prefix='backbone.', type='Pretrained'), norm_cfg=dict( type='SyncBN'), type='mmdet.CSPNeXt', widen_factor=1), bbox_head=dict( act_cfg=dict( type='SiLU'), anchor_generator=dict( offset=0, strides=[ 8, 16, 32, ], type='mmdet.MlvlPointGenerator'), angle_version='le90', bbox_coder=dict( angle_version='le90', type='DistanceAnglePointCoder'), exp_on_reg=True, feat_channels=256, in_channels=256, loss_angle=None, loss_bbox=dict( loss_weight=2.0, mode='linear', type='RotatedIoULoss'), loss_cls=dict( beta=2.0, loss_weight=1.0, type='mmdet.QualityFocalLoss', use_sigmoid=True), norm_cfg=dict( type='SyncBN'), num_classes=15, pred_kernel_size=1, scale_angle=False, share_conv=True, stacked_convs=2, type='RotatedRTMDetSepBNHead', use_hbbox_loss=False, with_objectness=False), data_preprocessor=dict( batch_augments=None, bgr_to_rgb=False, boxtype2tensor=False, mean=[ 103.53, 116.28, 123.675, ], std=[ 57.375, 57.12, 58.395, ], type='mmdet.DetDataPreprocessor'), neck=dict( act_cfg=dict( type='SiLU'), expand_ratio=0.5, in_channels=[ 256, 512, 1024, ], norm_cfg=dict( type='SyncBN'), num_csp_blocks=3, out_channels=256, type='mmdet.CSPNeXtPAFPN'), test_cfg=dict( max_per_img=2000, min_bbox_size=0, nms=dict( iou_threshold=0.1, type='nms_rotated'), nms_pre=2000, score_thr=0.05), train_cfg=dict( allowed_border=-1, assigner=dict( iou_calculator=dict( type='RBboxOverlaps2D'), topk=13, type='mmdet.DynamicSoftLabelAssigner'), debug=False, pos_weight=-1), type='mmdet.RTMDet') optim_wrapper=dict( optimizer=dict( lr=0.00025, type='AdamW', weight_decay=0.05), paramwise_cfg=dict( bias_decay_mult=0, bypass_duplicate=True, norm_decay_mult=0), type='OptimWrapper') param_scheduler=[ dict(begin=0, by_epoch=False, end=1000, start_factor=1e-05, type='LinearLR'), dict(T_max=18, begin=18, by_epoch=True, convert_to_iter_based=True, end=36, eta_min=1.25e-05, type='CosineAnnealingLR'), ] resume=False test_cfg=dict( type='TestLoop') test_dataloader=dict( batch_size=1, dataset=dict( ann_file='/home/dell/Research/zly/mmrotate-main/data/DOTA/trainval/annfiles', data_prefix=dict( img_path='/home/dell/Research/zly/mmrotate-main/data/DOTA/trainval/image'), data_root='/home/dell/Research/zly/mmrotate-main/data/DOTA/', pipeline=[ dict(backend_args=None, type='mmdet.LoadImageFromFile'), dict(keep_ratio=True, scale=( 1024, 1024, ), type='mmdet.Resize'), dict(box_type='qbox', type='mmdet.LoadAnnotations', with_bbox=True), dict(box_type_mapping=dict( gt_bboxes='rbox'), type='ConvertBoxType'), dict(pad_val=dict( img=( 114, 114, 114, )), size=( 1024, 1024, ), type='mmdet.Pad'), dict(meta_keys=( 'img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', ), type='mmdet.PackDetInputs'), ], test_mode=True, type='DOTADataset'), drop_last=False, num_workers=2, persistent_workers=True, sampler=dict( shuffle=False, type='DefaultSampler')) test_evaluator=dict( metric='mAP', type='DOTAMetric') test_pipeline=[ dict(backend_args=None, type='mmdet.LoadImageFromFile'), dict(keep_ratio=True, scale=( 1024, 1024, ), type='mmdet.Resize'), dict(pad_val=dict( img=( 114, 114, 114, )), size=( 1024, 1024, ), type='mmdet.Pad'), dict(meta_keys=( 'img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', ), type='mmdet.PackDetInputs'), ] train_cfg=dict( max_epochs=36, type='EpochBasedTrainLoop', val_interval=12) train_dataloader=dict( batch_sampler=None, batch_size=4, dataset=dict( ann_file='/home/dell/Research/zly/mmrotate-main/data/DOTA/trainval/annfiles', data_prefix=dict( img_path='/home/dell/Research/zly/mmrotate-main/data/DOTA/trainval/image'), data_root='/home/dell/Research/zly/mmrotate-main/data/DOTA/', filter_cfg=dict( filter_empty_gt=True), pipeline=[ dict(backend_args=None, type='mmdet.LoadImageFromFile'), dict(box_type='qbox', type='mmdet.LoadAnnotations', with_bbox=True), dict(box_type_mapping=dict( gt_bboxes='rbox'), type='ConvertBoxType'), dict(keep_ratio=True, scale=( 1024, 1024, ), type='mmdet.Resize'), dict(direction=[ 'horizontal', 'vertical', 'diagonal', ], prob=0.75, type='mmdet.RandomFlip'), dict(angle_range=180, prob=0.5, rect_obj_labels=[ 9, 11, ], type='RandomRotate'), dict(pad_val=dict( img=( 114, 114, 114, )), size=( 1024, 1024, ), type='mmdet.Pad'), dict(type='mmdet.PackDetInputs'), ], type='DOTADataset'), num_workers=4, persistent_workers=True, pin_memory=False, sampler=dict( shuffle=True, type='DefaultSampler')) train_pipeline=[ dict(backend_args=None, type='mmdet.LoadImageFromFile'), dict(box_type='qbox', type='mmdet.LoadAnnotations', with_bbox=True), dict(box_type_mapping=dict( gt_bboxes='rbox'), type='ConvertBoxType'), dict(keep_ratio=True, scale=( 1024, 1024, ), type='mmdet.Resize'), dict(direction=[ 'horizontal', 'vertical', 'diagonal', ], prob=0.75, type='mmdet.RandomFlip'), dict(angle_range=180, prob=0.5, rect_obj_labels=[ 9, 11, ], type='RandomRotate'), dict(pad_val=dict( img=( 114, 114, 114, )), size=( 1024, 1024, ), type='mmdet.Pad'), dict(type='mmdet.PackDetInputs'), ] val_cfg=dict( type='ValLoop') val_dataloader=dict( batch_size=1, dataset=dict( ann_file='/home/dell/Research/zly/mmrotate-main/data/DOTA/trainval/annfiles', data_prefix=dict( img_path='/home/dell/Research/zly/mmrotate-main/data/DOTA/trainval/image'), data_root='/home/dell/Research/zly/mmrotate-main/data/DOTA/', pipeline=[ dict(backend_args=None, type='mmdet.LoadImageFromFile'), dict(keep_ratio=True, scale=( 1024, 1024, ), type='mmdet.Resize'), dict(box_type='qbox', type='mmdet.LoadAnnotations', with_bbox=True), dict(box_type_mapping=dict( gt_bboxes='rbox'), type='ConvertBoxType'), dict(pad_val=dict( img=( 114, 114, 114, )), size=( 1024, 1024, ), type='mmdet.Pad'), dict(meta_keys=( 'img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', ), type='mmdet.PackDetInputs'), ], test_mode=True, type='DOTADataset'), drop_last=False, num_workers=2, persistent_workers=True, sampler=dict( shuffle=False, type='DefaultSampler')) val_evaluator=dict( metric='mAP', type='DOTAMetric') val_pipeline=[ dict(backend_args=None, type='mmdet.LoadImageFromFile'), dict(keep_ratio=True, scale=( 1024, 1024, ), type='mmdet.Resize'), dict(box_type='qbox', type='mmdet.LoadAnnotations', with_bbox=True), dict(box_type_mapping=dict( gt_bboxes='rbox'), type='ConvertBoxType'), dict(pad_val=dict( img=( 114, 114, 114, )), size=( 1024, 1024, ), type='mmdet.Pad'), dict(meta_keys=( 'img_id', 'img_path', 'ori_shape', 'img_shape', 'scale_factor', ), type='mmdet.PackDetInputs'), ] vis_backends=[ dict(type='LocalVisBackend'), ] visualizer=dict( name='visualizer', type='RotLocalVisualizer', vis_backends=[ dict(type='LocalVisBackend'), ]) work_dir='./work_dirs/rotated_rtmdet_l-3x-dota'

Additional information

No response

milamiqi avatar Sep 25 '23 02:09 milamiqi

这是我目前的环境,在使用demo下载pth文件时也会遇到类似报错

mim download mmrotate --config oriented-rcnn-le90_r50_fpn_1x_dota --dest .

Package Version Editable project location


addict 2.4.0 aliyun-python-sdk-core 2.13.36 aliyun-python-sdk-kms 2.16.2 certifi 2023.7.22 cffi 1.15.1 charset-normalizer 3.2.0 click 8.1.7 colorama 0.4.6 contourpy 1.1.1 crcmod 1.7 cryptography 41.0.4 cycler 0.11.0 fonttools 4.42.1 idna 3.4 importlib-metadata 6.8.0 importlib-resources 6.1.0 jmespath 0.10.0 kiwisolver 1.4.5 Markdown 3.4.4 markdown-it-py 3.0.0 matplotlib 3.7.3 mdurl 0.1.2 mkl-fft 1.3.8 mkl-random 1.2.4 mkl-service 2.4.0 mmcv 2.0.1 mmdet 3.1.0 /home/dell/Research/zly/mmdetection mmengine 0.8.4 mmrotate 1.0.0rc1 /home/dell/Research/zly/mm1/mmrotate model-index 0.1.11 numpy 1.24.3 opencv-python 4.8.0.76 opendatalab 0.0.10 openmim 0.3.9 openxlab 0.0.25 ordered-set 4.1.0 oss2 2.17.0 packaging 23.1 pandas 2.0.3 Pillow 9.3.0 pip 23.2.1 platformdirs 3.10.0 pycocotools 2.0.7 pycparser 2.21 pycryptodome 3.19.0 Pygments 2.16.1 pyparsing 3.1.1 python-dateutil 2.8.2 pytz 2023.3.post1 PyYAML 6.0.1 requests 2.28.2 rich 13.4.2 scipy 1.10.1 setuptools 60.2.0 shapely 2.0.1 six 1.16.0 tabulate 0.9.0 termcolor 2.3.0 terminaltables 3.1.10 tomli 2.0.1 torch 1.8.0 torchvision 0.9.0 tqdm 4.65.2 typing_extensions 4.7.1 tzdata 2023.3 urllib3 1.26.16 wheel 0.38.4 yapf 0.40.2 zipp 3.17.0

milamiqi avatar Sep 25 '23 02:09 milamiqi

how did u fix it? when i downloaded config file using mim, my file always met this error

TranDo25 avatar Oct 05 '23 04:10 TranDo25

how did u fix it? when i downloaded config file using mim, my file always met this error

I haven't solved it yet

milamiqi avatar Oct 05 '23 06:10 milamiqi

I can fix this TypeError: FormatCode() got an unexpected keyword argument 'verify' by uninstall 'yapf ' and then pip install yapf==0.40.1

sunpeng96 avatar Oct 07 '23 13:10 sunpeng96

thank you, when i try the version: Package Version Source


mmcv-full 1.5.3 https://github.com/open-mmlab/mmcv mmdet 2.25.1 https://github.com/open-mmlab/mmdetection mmengine 0.8.5 https://github.com/open-mmlab/mmengine mmrotate 0.3.4 /content/mmrotate it disappeared

TranDo25 avatar Oct 07 '23 13:10 TranDo25

I can fix this TypeError: FormatCode() got an unexpected keyword argument 'verify' by uninstall 'yapf ' and then pip install yapf==0.40.1

thank you very much

milamiqi avatar Oct 16 '23 05:10 milamiqi