Git Product home page Git Product logo

wenet-binding's Introduction

wenet-python

wenet python wrapper for runtime

note: Because wenet support binding runtime,so archive this repo

if you‘re interesting in ctc decoder and mwer loss etc please see https://github.com/Mddct/ctcdecoder

wenet-binding's People

Contributors

mddct avatar

Stargazers

 avatar Tower avatar Nickolay V. Shmyrev avatar 丁涵宇 avatar Xingchen Song(宋星辰) avatar

Watchers

Nickolay V. Shmyrev avatar  avatar

Forkers

ishine

wenet-binding's Issues

runtime python example

pip install wenet


import wenet

model = wenet.from_pretrained("wenetspeech")

# for single infer
wav = 'example.wav'
model.recognize(wav, methods = "ctc_prefix_beam_search")  

# for batch infer
wav_list = [example.wav, example.wav]
batch_size = 10
model.recognize_batch(wav_list, batch_size=10, methods = "attention_rescoring")

# with wfst lm
options = wenet.decoder.CtcPrefixBeamSearchOptions(blank = 0, first_beam_size=10, second_beam_size=10)
params = wenet.decoder.Params(ctc_options=options)

model = wenet.from_pretrained("wenetspeech",  fst_path="TLG.fst",  params=params)
# If options is used, the default decoding method in Options is used 
model.recognize(wav)  
model.recognize_batch(wav)

# for ctc probs
ctc_probs = model.recognize(wav, methods = "ctc_prefix_beam_search", ctc_prbos=True) 

some useful ref:
https://github.com/daanzu/wenet_stt_python
https://cffi.readthedocs.io/en/latest/
http://www.swig.org/

refine interface for all language binding

There is no need to export decoder and accept waveform and ' reset etc to user

1 initial decoder in recognize and streaming_recognize

2 python : streaming recognize return type should be a
generator
Go: streaming recognize return type should be a channel

3 when we want to change the config of current model to do next decoding, model.config[...] = ... should work

Therefore, internal streaming and non streaming depend only on the chunk size

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.