Skip to main content

Simple Python library, distributed via binary wheels with few direct dependencies, for easily using wav2vec 2.0 models for speech recognition.

Project description

Wenet STT Python

Beta Software

Simple Python library, distributed via binary wheels with few direct dependencies, for easily using WeNet models for speech recognition.

Donate Donate Donate

Requirements:

  • Python 3.7+
  • Platform: Linux x64 (Windows is a work in progress; MacOS may work; PRs welcome)
  • Python package requirements: cffi, numpy
  • Wenet Model (must be "runtime" format)
    • Several are available ready-to-go on this project's releases page and below.

Models:

Model Download Size
gigaspeech_20210728_u2pp_conformer 549 MB
gigaspeech_20210811_conformer_bidecoder 540 MB

Usage

from wenet_stt import WenetSTT
decoder = WenetSTT(WenetSTT.build_config('model_dir'))

import wave
with wave.open('tests/test.wav', 'rb') as wav_file:
    wav_samples = wav_file.readframes(wav_file.getnframes())

assert decoder.decode(wav_samples).strip().lower() == 'it depends on the context'

Also contains a simple CLI interface for recognizing wav files:

$ python -m wenet_stt decode model test.wav
IT DEPENDS ON THE CONTEXT
$ python -m wenet_stt decode model test.wav test.wav
IT DEPENDS ON THE CONTEXT
IT DEPENDS ON THE CONTEXT
$ python -m wenet_stt -h
usage: python -m wenet_stt [-h] {decode} ...

positional arguments:
  {decode}    sub-command
    decode    decode one or more WAV files

optional arguments:
  -h, --help  show this help message and exit

Installation/Building

Recommended installation via wheel from pip (requires a recent version of pip):

python -m pip install wenet_stt

To build package for use locally:

python setup.py bdist_wheel

To build package for publishing:

building/dockcross-manylinux2014-x64 bash building/build-wheel-dockcross.sh manylinux2014_x86_64

Author

License

This project is licensed under the GNU Affero General Public License v3 (AGPL-3.0-or-later). See the LICENSE file for details. If this license is problematic for you, please contact me.

Acknowledgments

  • Contains and uses code from WeNet, licensed under the Apache-2.0 License, and other transitive dependencies (see source).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

wenet_stt-0.2.0-py2.py3-none-win_amd64.whl (59.8 MB view hashes)

Uploaded Python 2 Python 3 Windows x86-64

wenet_stt-0.2.0-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (92.1 MB view hashes)

Uploaded Python 2 Python 3 manylinux: glibc 2.17+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page