-
Notifications
You must be signed in to change notification settings - Fork 422
/
hubconf.py
192 lines (156 loc) · 6.86 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
from asteroid import models
dependencies = ["torch", "numpy", "scipy", "asteroid_filterbanks", "requests", "filelock"]
def demask(name_url_or_file=None, **kwargs):
"""Load (pretrained) DeMask 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), DeMask is instantiated but no pretrained
weights are loaded.
**kwargs: Keyword arguments to pass to DeMask.
Returns:
DeMask instance (with ot without pretrained weights).
Examples:
>>> from torch import hub
>>> # Instantiate without pretrained weights
>>> model = hub.load('asteroid-team/asteroid', 'demask')
>>> # Use pretrained weights
>>> URL = "popcornell/DeMask_Surgical_mask_speech_enhancement_v1"
>>> model = hub.load('asteroid-team/asteroid', 'demask', URL)
"""
# No pretrained weights
if name_url_or_file is None:
return models.DeMask(**kwargs)
return models.DeMask.from_pretrained(name_url_or_file, **kwargs)
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('asteroid-team/asteroid', 'conv_tasnet', n_src=2)
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('asteroid-team/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('asteroid-team/asteroid', 'dprnn_tasnet')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('asteroid-team/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('asteroid-team/asteroid', 'lstm_tasnet')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('asteroid-team/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('asteroid-team/asteroid', 'dpt_net')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('asteroid-team/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('asteroid-team/asteroid', 'sudormrf_net')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('asteroid-team/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('asteroid-team/asteroid', 'lstm_tasnet')
>>> # Use pretrained weights
>>> URL = "TOCOME"
>>> model = hub.load('asteroid-team/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)