Closed AnRanbel closed 1 year ago
@AnRanbel please show the whole error report
@AnRanbel please show the whole error report
谢谢你的回复,我有将你们的代码移植到最新版的mmsegmentation里面,所以有些路径可能不同,但我训练和测试过了,除了不设置pretrained的时候会报错,其他都是正常运行的。
Exception has occurred: AttributeError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
'ViTAE_Window_NoShift_basic' object has no attribute 'use_abs_pos_embed'
File "/root/miniconda3/envs/mmyolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
File "/root/autodl-tmp/mmsegmentation/mmseg/models/backbones/ViTAE_Window_NoShift/base_model.py", line 197, in init_weights
if self.use_abs_pos_embed:
File "/root/miniconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/model/base_module.py", line 130, in init_weights
m.init_weights()
File "/root/miniconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/runner/runner.py", line 899, in _init_model_weights
model.init_weights()
File "/root/miniconda3/envs/mmyolo/lib/python3.8/site-packages/mmengine/runner/runner.py", line 1707, in train
self._init_model_weights()
File "/root/autodl-tmp/mmsegmentation/tools/train.py", line 134, in main
runner.train()
File "/root/autodl-tmp/mmsegmentation/tools/train.py", line 138, in
@AnRanbel ViTAEv2中没有绝对位置编码,这段加载权重的代码可能是从什么地方直接复制过来的,当时没考虑不加载权重的情况,所以pretrained=None的时候,你把它注释掉
# if self.use_abs_pos_embed:
# trunc_normal_(self.absolute_pos_embed, std=0.02)
@AnRanbel ViTAEv2中没有绝对位置编码,这段加载权重的代码可能是从什么地方直接复制过来的,当时没考虑不加载权重的情况,所以pretrained=None的时候,你把它注释掉
# if self.use_abs_pos_embed: # trunc_normal_(self.absolute_pos_embed, std=0.02)
好的,谢谢。
when model's pretrained is none, as follows: model = dict( type='EncoderDecoder', data_preprocessor=data_preprocessor, pretrained=None,)
get AttributeError: 'ViTAE_Window_NoShift_basic' object has no attribute 'use_abs_pos_embed' in https://github.com/ViTAE-Transformer/RSP/blob/main/Semantic%20Segmentation/mmseg/models/backbones/ViTAE_Window_NoShift/base_model.py#L185