Giter Club home page Giter Club logo

wenet's Introduction

WeNet

We net together. We borrowed a lot of code from espnet, and we refered OpenTransformer for batch inference.

Install

WeNet requries pytorch 1.6.0+.

# 1. setup your own python3 virtual env, miniconda is recommended.
# 2. install pytorch: conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
# 3. install requriments: pip install -r requirements.txt
# 4. link kaldi on root directory of this repo: ln -s YOUR_KALDI_PATH kaldi

Python code principles

We want our pytorch model can be directly exported by torch.jit.script method, which is essential for deloying the model to production.

See the following resource for how to deploy PyTorch models in production in details.

To ensure that, we will try to export the model before training stage, if it fails, we should modify the training code to satisfy the export requirements.

# See in wenet/bin/train.py
script_model = torch.jit.script(model)
script_model.save(os.path.join(args.model_dir, 'init.zip'))

Two principles should be taken into consideration when we contribute our python code to WeNet, especially for the subclass of torch.nn.Module, especially for the forward function.

  1. Know what is allowed and what is disallowed.

  2. Try to use explicit typing as much as possible. You can try to do type checking forcely by typeguard, see https://typeguard.readthedocs.io/en/latest/userguide.html for details.

wenet's People

Contributors

robin1001 avatar whiteshirt0429 avatar yaguanghu avatar

Watchers

 avatar

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.