forked from facebookresearch/ClassyVision
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhubconf.py
32 lines (23 loc) · 862 Bytes
/
hubconf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import functools
import torch
from classy_vision.hub import ClassyHubInterface
dependencies = ["torch", "torchvision"]
# export the wsl models (https://github.com/facebookresearch/WSL-Images)
resnext_wsl_models = [
"resnext101_32x8d_wsl",
"resnext101_32x16d_wsl",
"resnext101_32x32d_wsl",
"resnext101_32x48d_wsl",
]
def _create_interface_from_torchhub(github, *args, **kwargs):
model = torch.hub.load(github, *args, **kwargs)
return ClassyHubInterface.from_model(model)
for model in resnext_wsl_models:
globals()[model] = functools.partial(
_create_interface_from_torchhub, "facebookresearch/WSL-Images", model
)