[to #43115513] requirements refine and preparation for v0.3 release

*  remove tensorflow numpy from audio requirements
*  add audio requirements to all
* auto set model to eval model for pipeline
*  add audio requirement check hint for easyasr and kwsbp
*  fix docs build error

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/9561021
This commit is contained in:
wenmeng.zwm
2022-07-28 22:04:18 +08:00
parent ae55e5bd73
commit 590d531484
8 changed files with 18 additions and 14 deletions

View File

@@ -13,7 +13,7 @@
import os
import sys
import sphinx_rtd_theme
import sphinx_book_theme
sys.path.insert(0, os.path.abspath('../../'))
# -- Project information -----------------------------------------------------
@@ -77,7 +77,7 @@ exclude_patterns = ['build', 'Thumbs.db', '.DS_Store']
# a list of builtin themes.
#
html_theme = 'sphinx_book_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme_path = [sphinx_book_theme.get_html_theme_path()]
html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,

View File

@@ -105,9 +105,11 @@ class Pipeline(ABC):
def _prepare_single(model):
if isinstance(model, torch.nn.Module):
model.to(self.device)
model.eval()
elif hasattr(model, 'model') and isinstance(
model.model, torch.nn.Module):
model.model.to(self.device)
model.model.eval()
if not self._model_prepare:
# prepare model for pytorch

View File

@@ -256,10 +256,14 @@ def is_pillow_available():
return importlib.util.find_spec('PIL.Image') is not None
def is_package_available(pkg_name):
def _is_package_available_fn(pkg_name):
return importlib.util.find_spec(pkg_name) is not None
def is_package_available(pkg_name):
return functools.partial(_is_package_available_fn, pkg_name)
def is_espnet_available(pkg_name):
return importlib.util.find_spec('espnet2') is not None \
and importlib.util.find_spec('espnet')
@@ -282,6 +286,8 @@ REQUIREMENTS_MAAPING = OrderedDict([
GENERAL_IMPORT_ERROR.replace('REQ', 'espnet'))),
('espnet', (is_espnet_available,
GENERAL_IMPORT_ERROR.replace('REQ', 'espnet'))),
('easyasr', (is_package_available('easyasr'), AUDIO_IMPORT_ERROR)),
('kwsbp', (is_package_available('kwsbp'), AUDIO_IMPORT_ERROR))
])
SYSTEM_PACKAGE = set(['os', 'sys', 'typing'])

View File

@@ -10,7 +10,8 @@ lxml
matplotlib
nara_wpe
nltk
numpy<=1.18
# numpy requirements should be declared with tensorflow 1.15 but not here
# numpy<=1.18
# protobuf version beyond 3.20.0 is not compatible with TensorFlow 1.x, therefore is discouraged.
protobuf>3,<3.21.0
ptflops
@@ -19,11 +20,7 @@ PyWavelets>=1.0.0
scikit-learn
SoundFile>0.10
sox
tensorboard
tensorflow==1.15.*
torch
torchaudio
torchvision
tqdm
ttsfrd>=0.0.3
unidecode

View File

@@ -1,3 +1,4 @@
decord>=0.6.0
easydict
tf_slim
torchvision

View File

@@ -1,4 +1,5 @@
docutils>=0.16.0
myst_parser
recommonmark
sphinx>=4.0.2
sphinx-book-theme

View File

@@ -3,7 +3,7 @@ datasets
easydict
einops
filelock>=3.3.0
gast>=0.5.3
gast>=0.2.2
numpy
opencv-python
Pillow>=6.2.0
@@ -11,8 +11,8 @@ pyyaml
requests
scipy
setuptools
tensorboard
tokenizers
torch
tqdm>=4.64.0
transformers>=4.10.3
yapf

View File

@@ -178,11 +178,8 @@ if __name__ == '__main__':
continue
extra_requires[field], _ = parse_requirements(
f'requirements/{field}.txt')
all_requires.extend(extra_requires[field])
# skip audio requirements due to its hard dependency which
# result in mac/windows compatibility problems
if field != Fields.audio:
all_requires.append(extra_requires[field])
extra_requires['all'] = all_requires
setup(