Giter Site home page Giter Site logo

bergamot-translator-old's Introduction

Bergamot Translator

CircleCI badge

Bergamot translator provides a unified API for (Marian NMT framework based) neural machine translation functionality in accordance with the Bergamot project that focuses on improving client-side machine translation in a web browser.

Build Instructions

Build Natively

  1. Clone the repository using these instructions:

    git clone https://github.com/browsermt/bergamot-translator
    cd bergamot-translator
  2. Compile

    Create a folder where you want to build all the artifacts (build-native in this case) and compile in that folder

    mkdir build-native
    cd build-native
    cmake ../
    make -j

Build WASM

Compiling for the first time

  1. Download and Install Emscripten using following instructions

    • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
    • Enter the cloned directory: cd emsdk
    • Install the lastest sdk tools: ./emsdk install latest
    • Activate the latest sdk tools: ./emsdk activate latest
    • Activate path variables: source ./emsdk_env.sh
  2. Clone the repository using these instructions:

    git clone https://github.com/browsermt/bergamot-translator
    cd bergamot-translator
  3. Download files (only required if you want to package files in wasm binary)

    This step is only required if you want to package files (e.g. models, vocabularies etc.) into wasm binary. If you don't then just skip this step.

    The build preloads the files in Emscripten’s virtual file system.

    If you want to package bergamot project specific models, please follow these instructions:

    mkdir models
    git clone https://github.com/mozilla-applied-ml/bergamot-models
    cp -rf bergamot-models/* models
    gunzip models/*/*
  4. Compile

    1. Create a folder where you want to build all the artefacts (build-wasm in this case)

      mkdir build-wasm
      cd build-wasm
    2. Compile the artefacts

      • If you want to package files into wasm binary then execute following commands (Replace FILES_TO_PACKAGE with the path of the directory containing the files to be packaged in wasm binary)

        emcmake cmake -DCOMPILE_WASM=on -DPACKAGE_DIR=FILES_TO_PACKAGE ../
        emmake make -j

        e.g. If you want to package bergamot project specific models (downloaded using step 3 above) then replace FILES_TO_PACKAGE with ../models

      • If you don't want to package any file into wasm binary then execute following commands:

        emcmake cmake -DCOMPILE_WASM=on ../
        emmake make -j

    The artefacts (.js and .wasm files) will be available in wasm folder of build directory ("build-wasm" in this case).

Recompiling

As long as you don't update any submodule, just follow steps in 4.ii to recompile.
If you update a submodule, execute following command before executing steps in 4.ii to recompile.

git submodule update --init --recursive

How to use

Using Native version

The builds generate library that can be integrated to any project. All the public header files are specified in src folder.
A short example of how to use the APIs is provided in app/main.cpp file.

Using WASM version

Please follow the README inside the wasm folder of this repository that demonstrates how to use the translator in JavaScript.

bergamot-translator-old's People

Contributors

abhi-agg avatar andrenatal avatar kpu avatar motin avatar ugermann avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

andrenatal

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.