coat_lite_small-fea1d5a1.pth
PyTorch CNN
在线加载模型地址

确定自己使用的框架并导入对应的库。导入库实现样例代码可参考 文档中心-预训练模型使用教程

在代码中实现加载预训练模型地址

调用模型的实现方法

def coat_lite_small(pretrained=False, num_classes=9):    model_cfg = dict(        patch_size=4, embed_dims=[64, 128, 320, 512], serial_depths=[3, 4, 6, 3], parallel_depth=0,        num_heads=8, mlp_ratios=[8, 8, 4, 4])    model =CoaT(**model_cfg)    if pretrained:        from flyai.utils import remote_helper        path = remote_helper.get_remote_data(upload_url)                model.load_state_dict(torch.load(path) )        model.head = nn.Linear(in_features=512, out_features=num_classes, bias=True)    model.head = nn.Linear(in_features=512, out_features=num_classes, bias=True)    return model