mirror of
https://github.com/open-mmlab/mmclassification.git
synced 2025-06-03 21:53:55 +08:00
[Enhance] add deleting params info in swinv2. (#1142)
This commit is contained in:
parent
1b98fc13d9
commit
992d13e772
@ -546,6 +546,13 @@ class SwinTransformerV2(BaseBackbone):
|
|||||||
|
|
||||||
def _delete_reinit_params(self, state_dict, prefix, *args, **kwargs):
|
def _delete_reinit_params(self, state_dict, prefix, *args, **kwargs):
|
||||||
# delete relative_position_index since we always re-init it
|
# delete relative_position_index since we always re-init it
|
||||||
|
from mmengine.logging import MMLogger
|
||||||
|
logger = MMLogger.get_current_instance()
|
||||||
|
logger.info(
|
||||||
|
'Delete `relative_position_index` and `relative_coords_table` '
|
||||||
|
'since we always re-init these params according to the '
|
||||||
|
'`window_size`, which might cause unwanted but unworried '
|
||||||
|
'warnings when loading checkpoint.')
|
||||||
relative_position_index_keys = [
|
relative_position_index_keys = [
|
||||||
k for k in state_dict.keys() if 'relative_position_index' in k
|
k for k in state_dict.keys() if 'relative_position_index' in k
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user