MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / get_num_layer_for_vit

Function get_num_layer_for_vit

PATH/core/utils.py:799–811  ·  view source on GitHub ↗
(var_name, config)

Source from the content-addressed store, hash-verified

797
798
799def get_num_layer_for_vit(var_name, config):
800 if (var_name == "module.backbone_module" or var_name.endswith("prompt_embed_kv")) and config.get('lpe_lr', False):
801 return config.num_layers - 1
802 if var_name in ("module.backbone_module", "module.backbone_module.cls_token", "module.backbone_module.mask_token"):
803 return 0
804 elif var_name.startswith("module.backbone_module.patch_embed"):
805 return 0
806 elif var_name.startswith("module.backbone_module") and not (var_name.startswith("module.backbone_module.norm") or
807 var_name.startswith("module.backbone_module.ln_pre")):
808 layer_id = int(var_name.split('.')[3])
809 return layer_id + 1
810 else:
811 return config.num_layers - 1
812
813
814class SegmentationRunningMetrics(object):

Callers 1

create_optimizerMethod · 0.90

Calls 1

getMethod · 0.80

Tested by

no test coverage detected