Coder Social home page Coder Social logo

pkuliuliu / tensorflow-with-kenlm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from louiskirsch/tensorflow-with-kenlm

0.0 2.0 0.0 92.03 MB

Tensorflow with KenLM integrated for beam search scoring

Home Page: http://tensorflow.org

License: Apache License 2.0

Python 41.95% C++ 47.21% C 0.38% LLVM 0.01% CMake 0.30% Java 0.62% Makefile 0.08% Objective-C 0.02% Objective-C++ 0.14% Shell 0.71% Jupyter Notebook 3.94% Go 1.68% JavaScript 0.03% HTML 1.25% TypeScript 1.67% CSS 0.01% Batchfile 0.02%

tensorflow-with-kenlm's Introduction



-----------------

Tensorflow with KenLM integration

This fork of tensorflow adds KenLM (a language model) to the ctc_beam_search_decoder operation.

tf.nn.ctc_beam_search_decoder(logits,
                              output_sequence_lengths,
                              kenlm_directory_path='your/directory/path')

Your specified kenlm_directory_path must contain three files

kenlm-model.binary
vocabulary
trie

See http://kheafield.com/code/kenlm/ to find out how to generate your kenlm-model.binary.

The vocabulary file contains the mapping from your logit labels to characters, the file should contain all allowed characteres in a single line, the indexing specifying the respective label id, e.g.

abcdefghijklmnopqrstuvwxyz '

The trie is generated from a text corpus of all words on a character level. Given a file corpus.txt which must satisfy the following conditions,

  • only contains words with characters specified in vocabulary
  • seperated by whitespace or new lines

we can generate trie using:

cd tensorflow-with-kenlm
bazel build -c opt --config=cuda //tensorflow/core/util/ctc:ctc_generate_trie
bazel-bin/tensorflow/core/util/ctc/ctc_generate_trie kenlm-model.binary vocabulary < corpus.txt > trie

How to compile tensorflow

See Download and Setup for more detailed instructions.

./configure
bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow-*.whl --upgrade

Linux CPU Linux GPU Mac OS CPU Windows CPU Android
Build Status Build Status Build Status Build Status Build Status

TensorFlow is an open source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) that flow between them. This flexible architecture lets you deploy computation to one or more CPUs or GPUs in a desktop, server, or mobile device without rewriting code. TensorFlow also includes TensorBoard, a data visualization toolkit.

TensorFlow was originally developed by researchers and engineers working on the Google Brain team within Google's Machine Intelligence research organization for the purposes of conducting machine learning and deep neural networks research. The system is general enough to be applicable in a wide variety of other domains, as well.

If you'd like to contribute to TensorFlow, be sure to review the contribution guidelines.

We use GitHub issues for tracking requests and bugs, but please see Community for general questions and discussion.

Installation

See Installing TensorFlow for instructions on how to install our release binaries or how to build from source.

People who are a little more adventurous can also try our nightly binaries:

Try your first TensorFlow program

$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> sess.run(hello)
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> sess.run(a+b)
42
>>>

For more information

The TensorFlow community has created amazing things with TensorFlow, please see the resources section of tensorflow.org for an incomplete list.

tensorflow-with-kenlm's People

Contributors

tensorflower-gardener avatar benoitsteiner avatar caisq avatar martinwicke avatar gunan avatar ilblackdragon avatar mrry avatar ebrevdo avatar terrytangyuan avatar andrewharp avatar yifeif avatar teamdandelion avatar asimshankar avatar girving avatar petewarden avatar ispirmustafa avatar josh11b avatar keveman avatar hawkinsp avatar yuanbyu avatar rohan100jain avatar aselle avatar sukritiramesh avatar vincentvanhoucke avatar zheng-xq avatar jart avatar langmore avatar jendap avatar davidsoergel avatar jvdillon avatar

Watchers

James Cloos avatar  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.