提交 ed12db61 编写于 作者: H huangyuxin

Separate the ctcdecoders

上级 797e0834
...@@ -11,4 +11,21 @@ ...@@ -11,4 +11,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .ctcdecoder import swig_wrapper
from paddlespeech.s2t.utils.log import Log
logger = Log(__name__).getlog()
try:
from .ctcdecoder import swig_wrapper
except:
try:
import pip
if int(pip.__version__.split('.')[0])>9:
from pip._internal import main
else:
from pip import main
package_name = 'paddlespeech_ctcdecoders'
main(['install', package_name])
except Exception as e:
logger.info("paddlespeech_ctcdecoders not installed!")
...@@ -14,4 +14,19 @@ ...@@ -14,4 +14,19 @@
from .deepspeech2 import DeepSpeech2InferModel from .deepspeech2 import DeepSpeech2InferModel
from .deepspeech2 import DeepSpeech2Model from .deepspeech2 import DeepSpeech2Model
try:
import swig_decoders
except:
try:
import pip
if int(pip.__version__.split('.')[0])>9:
from pip._internal import main
else:
from pip import main
package_name = 'paddlespeech_ctcdecoders'
main(['install', package_name])
except:
raise RuntimeError("Can not install package paddlespeech_ctcdecoders on your system. \
The DeepSpeech2 model is not supported for your system")
__all__ = ['DeepSpeech2Model', 'DeepSpeech2InferModel'] __all__ = ['DeepSpeech2Model', 'DeepSpeech2InferModel']
...@@ -14,4 +14,20 @@ ...@@ -14,4 +14,20 @@
from .deepspeech2 import DeepSpeech2InferModelOnline from .deepspeech2 import DeepSpeech2InferModelOnline
from .deepspeech2 import DeepSpeech2ModelOnline from .deepspeech2 import DeepSpeech2ModelOnline
try:
import swig_decoders
except:
try:
import pip
if int(pip.__version__.split('.')[0])>9:
from pip._internal import main
else:
from pip import main
package_name = 'paddlespeech_ctcdecoders'
main(['install', package_name])
except:
raise RuntimeError("Can not install package paddlespeech_ctcdecoders on your system. \
The DeepSpeech2 model is not supported for your system")
__all__ = ['DeepSpeech2ModelOnline', 'DeepSpeech2InferModelOnline'] __all__ = ['DeepSpeech2ModelOnline', 'DeepSpeech2InferModelOnline']
...@@ -28,8 +28,21 @@ try: ...@@ -28,8 +28,21 @@ try:
from paddlespeech.s2t.decoders.ctcdecoder.swig_wrapper import ctc_beam_search_decoder_batch # noqa: F401 from paddlespeech.s2t.decoders.ctcdecoder.swig_wrapper import ctc_beam_search_decoder_batch # noqa: F401
from paddlespeech.s2t.decoders.ctcdecoder.swig_wrapper import ctc_greedy_decoder # noqa: F401 from paddlespeech.s2t.decoders.ctcdecoder.swig_wrapper import ctc_greedy_decoder # noqa: F401
from paddlespeech.s2t.decoders.ctcdecoder.swig_wrapper import Scorer # noqa: F401 from paddlespeech.s2t.decoders.ctcdecoder.swig_wrapper import Scorer # noqa: F401
except Exception as e: except:
logger.info("ctcdecoder not installed!") try:
import pip
if int(pip.__version__.split('.')[0])>9:
from pip._internal import main
else:
from pip import main
package_name = 'paddlespeech_ctcdecoders'
main(['install', package_name])
except Exception as e:
logger.info("paddlespeech_ctcdecoders not installed!")
#try:
#except Exception as e:
# logger.info("ctcdecoder not installed!")
__all__ = ['CTCDecoder'] __all__ = ['CTCDecoder']
...@@ -51,7 +64,7 @@ class CTCDecoderBase(nn.Layer): ...@@ -51,7 +64,7 @@ class CTCDecoderBase(nn.Layer):
dropout_rate (float): dropout rate (0.0 ~ 1.0) dropout_rate (float): dropout rate (0.0 ~ 1.0)
reduction (bool): reduce the CTC loss into a scalar, True for 'sum' or 'none' reduction (bool): reduce the CTC loss into a scalar, True for 'sum' or 'none'
batch_average (bool): do batch dim wise average. batch_average (bool): do batch dim wise average.
grad_norm_type (str): Default, None. one of 'instance', 'batch', 'frame', None. grad_norm_type (str): Default, None. one of 'instance', 'batch', 'frame', None.
""" """
assert check_argument_types() assert check_argument_types()
super().__init__() super().__init__()
......
...@@ -44,7 +44,6 @@ requirements = { ...@@ -44,7 +44,6 @@ requirements = {
"nltk", "nltk",
"pandas", "pandas",
"paddleaudio", "paddleaudio",
"paddlespeech_ctcdecoders",
"paddlespeech_feat", "paddlespeech_feat",
"praatio~=4.1", "praatio~=4.1",
"pypi-kenlm", "pypi-kenlm",
...@@ -70,6 +69,7 @@ requirements = { ...@@ -70,6 +69,7 @@ requirements = {
"ConfigArgParse", "ConfigArgParse",
"coverage", "coverage",
"gpustat", "gpustat",
"paddlespeech_ctcdecoders",
"phkit", "phkit",
"Pillow", "Pillow",
"pybind11", "pybind11",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册