Separate the ctcdecoders

pull/1087/head
huangyuxin 3 years ago
parent 797e08343c
commit ed12db61a6

@ -11,4 +11,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# 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 @@
from .deepspeech2 import DeepSpeech2InferModel
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']

@ -14,4 +14,20 @@
from .deepspeech2 import DeepSpeech2InferModelOnline
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']

@ -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_greedy_decoder # noqa: F401
from paddlespeech.s2t.decoders.ctcdecoder.swig_wrapper import Scorer # noqa: F401
except Exception as e:
logger.info("ctcdecoder not installed!")
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!")
#try:
#except Exception as e:
# logger.info("ctcdecoder not installed!")
__all__ = ['CTCDecoder']
@ -51,7 +64,7 @@ class CTCDecoderBase(nn.Layer):
dropout_rate (float): dropout rate (0.0 ~ 1.0)
reduction (bool): reduce the CTC loss into a scalar, True for 'sum' or 'none'
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()
super().__init__()

@ -44,7 +44,6 @@ requirements = {
"nltk",
"pandas",
"paddleaudio",
"paddlespeech_ctcdecoders",
"paddlespeech_feat",
"praatio~=4.1",
"pypi-kenlm",
@ -70,6 +69,7 @@ requirements = {
"ConfigArgParse",
"coverage",
"gpustat",
"paddlespeech_ctcdecoders",
"phkit",
"Pillow",
"pybind11",

Loading…
Cancel
Save