Last active
January 6, 2021 07:47
-
-
Save sadimanna/344b1ae56da9105ce4c861fae5a7946b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def new_resnet( | |
| arch: str, | |
| outlayer: str, | |
| block: Type[Union[BasicBlock, Bottleneck]], | |
| layers: List[int], | |
| pretrained: bool, | |
| progress: bool, | |
| **kwargs: Any | |
| ) -> IntResNet: | |
| '''model_urls = { | |
| 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', | |
| 'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth', | |
| 'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth', | |
| 'resnet101': 'https://download.pytorch.org/models/resnet101-5d3b4d8f.pth', | |
| 'resnet152': 'https://download.pytorch.org/models/resnet152-b121ed2d.pth', | |
| 'resnext50_32x4d': 'https://download.pytorch.org/models/resnext50_32x4d-7cdf4587.pth', | |
| 'resnext101_32x8d': 'https://download.pytorch.org/models/resnext101_32x8d-8ba56ff5.pth', | |
| 'wide_resnet50_2': 'https://download.pytorch.org/models/wide_resnet50_2-95faca4d.pth', | |
| 'wide_resnet101_2': 'https://download.pytorch.org/models/wide_resnet101_2-32ee1156.pth', | |
| }''' | |
| model = IntResNet(outlayer, block, layers, **kwargs) | |
| if pretrained: | |
| state_dict = load_state_dict_from_url(model_urls[arch], | |
| progress=progress) | |
| model.load_state_dict(state_dict) | |
| return model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment