-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy path__init__.py
More file actions
71 lines (54 loc) · 2.2 KB
/
__init__.py
File metadata and controls
71 lines (54 loc) · 2.2 KB
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
"""Comprehensive speech processing toolkit"""
import os
# For redirect of HF transformers
import speechbrain.lobes.models # noqa: F401
from .core import Brain, Stage, create_experiment_directory
from .utils.importutils import deprecated_redirect, lazy_export_all
from .utils.run_opts import RunOptions
with open(
os.path.join(os.path.dirname(__file__), "version.txt"), encoding="utf-8"
) as f:
version = f.read().strip()
# Create an alias to the refactored function
parse_arguments = RunOptions.from_command_line_args
__all__ = [
"Stage",
"Brain",
"create_experiment_directory",
"parse_arguments",
]
__version__ = version
deprecations = {
"speechbrain.k2_integration": "speechbrain.integrations.k2_fsa",
"speechbrain.wordemb": "speechbrain.integrations.huggingface.wordemb",
"speechbrain.lobes.models.huggingface_transformers": "speechbrain.integrations.huggingface",
"speechbrain.lobes.models.spacy": "speechbrain.integrations.nlp",
"speechbrain.lobes.models.flair": "speechbrain.integrations.nlp",
}
def make_deprecated_redirections():
sb1_0_redirect_str = (
"This is a change from SpeechBrain 1.0. "
"See: https://github.com/speechbrain/speechbrain/releases/tag/v1.0.0"
)
deprecated_redirect(
"speechbrain.pretrained",
"speechbrain.inference",
extra_reason=sb1_0_redirect_str,
also_lazy_export=True,
)
for old_path, new_path in deprecations.items():
deprecated_redirect(old_path, new_path, also_lazy_export=True)
# speechbrain.nnet.loss is not yet loaded at this point, so we cannot use
# also_lazy_export (it would try to access sys.modules['speechbrain.nnet.loss']).
# The sys.modules redirect alone is sufficient for import compatibility.
deprecated_redirect(
"speechbrain.nnet.loss.transducer_loss",
"speechbrain.integrations.numba.transducer_loss",
extra_reason=(
"This module depends on the optional 'numba' package. "
"If you encounter an ImportError here, please install numba, "
"for example with: pip install numba"
),
)
make_deprecated_redirections()
lazy_export_all(__file__, __name__, export_subpackages=True)