forked from asteroid-team/asteroid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hubconf.py
165 lines (134 loc) · 5.8 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
from asteroid import models
dependencies = ["torch"]
def conv_tasnet(name_url_or_file=None, **kwargs):
""" Load (pretrained) ConvTasNet model
Args:
name_url_or_file (str): Model name (we'll find the URL),
model URL to download model, path to model file.
If None (default), ConvTasNet is instantiated but no pretrained
weights are loaded.
**kwargs: Keyword arguments to pass to ConvTasNet.
Returns:
ConvTasNet instance (with ot without pretrained weights).
Examples:
>>> from torch import hub
>>> # Instantiate without pretrained weights
>>> model = hub.load('mpariente/asteroid', 'conv_tasnet', n_src=2)
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('mpariente/asteroid', 'conv_tasnet', URL)
"""
# No pretrained weights
if name_url_or_file is None:
return models.ConvTasNet(**kwargs)
return models.ConvTasNet.from_pretrained(name_url_or_file, **kwargs)
def dprnn_tasnet(name_url_or_file=None, **kwargs):
""" Load (pretrained) DPRNNTasNet model
Args:
name_url_or_file (str): Model name (we'll find the URL),
model URL to download model, path to model file.
If None (default), DPRNNTasNet is instantiated but no pretrained
weights are loaded.
**kwargs: Keyword arguments to pass to DPRNNTasNet.
Returns:
DPRNNTasNet instance (with ot without pretrained weights).
Examples:
>>> from torch import hub
>>> # Instantiate without pretrained weights
>>> model = hub.load('mpariente/asteroid', 'dprnn_tasnet')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('mpariente/asteroid', 'dprnn_tasnet', URL)
"""
# No pretrained weights
if name_url_or_file is None:
return models.DPRNNTasNet(**kwargs)
return models.DPRNNTasNet.from_pretrained(name_url_or_file, **kwargs)
def lstm_tasnet(name_url_or_file=None, **kwargs):
""" Load (pretrained) LSTM TasNet model
Args:
name_url_or_file (str): Model name (we'll find the URL),
model URL to download model, path to model file.
If None (default), LSTMTasNet is instantiated but no pretrained
weights are loaded.
**kwargs: Keyword arguments to pass to LSTMTasNet.
Returns:
LSTMTasNet instance (with ot without pretrained weights).
Examples:
>>> from torch import hub
>>> # Instantiate without pretrained weights
>>> model = hub.load('mpariente/asteroid', 'lstm_tasnet')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('mpariente/asteroid', 'lstm_tasnet', URL)
"""
# No pretrained weights
if name_url_or_file is None:
return models.LSTMTasNet(**kwargs)
return models.LSTMTasNet.from_pretrained(name_url_or_file, **kwargs)
def dpt_net(name_url_or_file=None, **kwargs):
""" Load (pretrained) DualPathTransformer (DPTNet) model
Args:
name_url_or_file (str): Model name (we'll find the URL),
model URL to download model, path to model file.
If None (default), DPTNet is instantiated but no pretrained
weights are loaded.
**kwargs: Keyword arguments to pass to DPTNet.
Returns:
DPTNet instance (with ot without pretrained weights).
Examples:
>>> from torch import hub
>>> # Instantiate without pretrained weights
>>> model = hub.load('mpariente/asteroid', 'dpt_net')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('mpariente/asteroid', 'dpt_net', URL)
"""
# No pretrained weights
if name_url_or_file is None:
return models.DPTNet(**kwargs)
return models.DPTNet.from_pretrained(name_url_or_file, **kwargs)
def sudormrf_net(name_url_or_file=None, **kwargs):
""" Load (pretrained) SuDORMRF model.
Args:
name_url_or_file (str): Model name (we'll find the URL),
model URL to download model, path to model file.
If None (default), SuDORMRFNet is instantiated but no pretrained
weights are loaded.
**kwargs: Keyword arguments to pass to SuDORMRFNet.
Returns:
SuDORMRF instance (with ot without pretrained weights).
Examples:
>>> from torch import hub
>>> # Instantiate without pretrained weights
>>> model = hub.load('mpariente/asteroid', 'sudormrf_net')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('mpariente/asteroid', 'sudormrf_net', URL)
"""
# No pretrained weights
if name_url_or_file is None:
return models.SuDORMRFNet(**kwargs)
return models.SuDORMRFNet.from_pretrained(name_url_or_file, **kwargs)
def sudormrf_improved_net(name_url_or_file=None, **kwargs):
""" Load (pretrained) SuDORMRFImprovedNet improved model
Args:
name_url_or_file (str): Model name (we'll find the URL),
model URL to download model, path to model file.
If None (default), SuDORMRFImprovedNet is instantiated but no pretrained
weights are loaded.
**kwargs: Keyword arguments to pass to SuDORMRFImprovedNet.
Returns:
SuDORMRFImprovedNet instance (with ot without pretrained weights).
Examples:
>>> from torch import hub
>>> # Instantiate without pretrained weights
>>> model = hub.load('mpariente/asteroid', 'lstm_tasnet')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('mpariente/asteroid', 'lstm_tasnet', URL)
"""
# No pretrained weights
if name_url_or_file is None:
return models.SuDORMRFImprovedNet(**kwargs)
return models.SuDORMRFImprovedNet.from_pretrained(name_url_or_file, **kwargs)