-
Notifications
You must be signed in to change notification settings - Fork 53
/
hubconf.py
45 lines (34 loc) · 1.24 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
import torch
from models import caption
from configuration import Config
dependencies = ['torch', 'torchvision']
def v1(pretrained=False):
config = Config()
model, _ = caption.build_model(config)
if pretrained:
checkpoint = torch.hub.load_state_dict_from_url(
url='https://github.com/saahiluppal/catr/releases/download/0.1/weights_9348032.pth',
map_location='cpu'
)
model.load_state_dict(checkpoint['model'])
return model
def v2(pretrained=False):
config = Config()
model, _ = caption.build_model(config)
if pretrained:
checkpoint = torch.hub.load_state_dict_from_url(
url='https://github.com/saahiluppal/catr/releases/download/0.2/weight389123791.pth',
map_location='cpu'
)
model.load_state_dict(checkpoint['model'])
return model
def v3(pretrained=False):
config = Config()
model, _ = caption.build_model(config)
if pretrained:
checkpoint = torch.hub.load_state_dict_from_url(
url='https://github.com/saahiluppal/catr/releases/download/0.2/weight493084032.pth',
map_location='cpu'
)
model.load_state_dict(checkpoint['model'])
return model