Code Monkey home page Code Monkey logo

lingual-smoe's Introduction

Sparse MoE with Language-Guided Routing for Multilingual Machine Translation

License: MIT

Code for "Sparse MoE with Language-Guided Routing for Multilingual Machine Translation". Our implementation is based on fairseq-moe.

Setup

conda create -n fairseq python=3.8 -y && conda activate fairseq

git clone https://github.com/pytorch/fairseq && cd fairseq
pip install --editable ./

pip install fairscale==0.4.0 hydra-core==1.0.7 omegaconf==2.0.6
pip install boto3 zmq iopath tensorboard nltk
pip install sacrebleu[ja] sacrebleu[ko] wandb

wandb login 

Data Preprocessing

  1. Raw data download: [OPUS-100](https://object.pouta.csc.fi/OPUS-100/v1.0/opus-100-corpus-v1.0.tar.gz && tar -xzf opus-100-corpus-v1.0.tar.gz)
  2. Preprocessing pipeline: num-multi

Training

  1. For the training script, see the example in train_scripts/train.sh
  2. To load language embedding, please first replace the lang_dict.txt in the processed data folder with assets/lang_dict.txt with a consistent index.

Inference

  1. First, generate translation data: bash eval_scripts/generate.sh -d opus16 -s save_dir -n 8 -c 1.0 (8 gpus. 1.0 capacity factor)
  2. Then compute BLEU: bash eval_scripts/eval.sh -d opus16 -s save_dir

Citation

@inproceedings{
zhao2024sparse,
title={Sparse MoE with Language Guided Routing for Multilingual Machine Translation},
author={Xinyu Zhao and Xuxi Chen and Yu Cheng and Tianlong Chen},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=ySS7hH1smL}
}

lingual-smoe's People

Contributors

zhaocinyu avatar

Stargazers

 avatar Shuo Feng avatar Guanjie Chen avatar Kornel Howil avatar Sukwon Yun avatar Huaizhi Qu avatar Pingzhi Li avatar

Watchers

 avatar Ajay Jaiswal avatar Tianlong Chen 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.