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

Function vit_aligned_base_patch16

PATH/core/models/backbones/vit.py:537–558  ·  view source on GitHub ↗
(pretrained=False, load_pos_embed=True, **kwargs)

Source from the content-addressed store, hash-verified

535
536
537def vit_aligned_base_patch16(pretrained=False, load_pos_embed=True, **kwargs):
538 default = dict(
539 # vitpose defauat drop_path_rate=0.3
540 drop_path_rate=0.1, use_abs_pos_emb=True, # as in table 11
541 ####
542 patch_size=16, embed_dim=768, depth=12, num_heads=12, mlp_ratio=4, qkv_bias=True,
543 norm_layer=partial(nn.LayerNorm, eps=1e-6)
544 )
545 recursive_update(default, kwargs)
546 model = ViT(**default)
547 # del model.head
548
549 if pretrained:
550 script_dir = os.path.dirname(__file__)
551 rel_path = "pretrain_weights/mae_pretrain_vit_base.pth"
552
553 checkpoint = torch.load(os.path.join(script_dir, rel_path))['model']
554
555 # load while interpolates position embedding
556 load_checkpoint(model, checkpoint, load_pos_embed, strict=False, logger=dummy_logger)
557
558 return model
559
560
561class dummy_logger:

Callers

nothing calls this directly

Calls 3

ViTClass · 0.70
load_checkpointFunction · 0.70
loadMethod · 0.45

Tested by

no test coverage detected