MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / tiny

Function tiny

SwissArmyTransformer/examples/yolos/models/backbone.py:403–415  ·  view source on GitHub ↗
(pretrained=None, **kwargs)

Source from the content-addressed store, hash-verified

401 return out_dict
402
403def tiny(pretrained=None, **kwargs):
404 model = VisionTransformer(
405 patch_size=16, embed_dim=192, depth=12, num_heads=3, mlp_ratio=4, qkv_bias=True,
406 norm_layer=partial(nn.LayerNorm, eps=1e-6))
407 if pretrained:
408 # checkpoint = torch.load('deit_tiny_patch16_224-a1311bcf.pth', map_location="cpu")
409 # checkpoint = torch.hub.load_state_dict_from_url(
410 # url="https://dl.fbaipublicfiles.com/deit/deit_tiny_patch16_224-a1311bcf.pth",
411 # map_location="cpu", check_hash=True
412 # )
413 checkpoint = torch.load(pretrained, map_location="cpu")
414 model.load_state_dict(checkpoint["model"], strict=True)
415 return model, 192
416
417
418def small(pretrained=None, **kwargs):

Callers 1

__init__Method · 0.85

Calls 3

VisionTransformerClass · 0.85
loadMethod · 0.45
load_state_dictMethod · 0.45

Tested by

no test coverage detected