PyTorch Implementation of "Non-Autoregressive Neural Machine Translation"

Overview

Non-Autoregressive Transformer

Code release for Non-Autoregressive Neural Machine Translation by Jiatao Gu, James Bradbury, Caiming Xiong, Victor O.K. Li, and Richard Socher.

Requires PyTorch 0.3, torchtext 0.2.1, and SpaCy.

The pipeline for training a NAT model for a given language pair includes:

  1. run_alignment_wmt_LANG.sh (runs fast_align for alignment supervision)
  2. run_LANG.sh (trains an autoregressive model)
  3. run_LANG_decode.sh (produces the distillation corpus for training the NAT)
  4. run_LANG_fast.sh (trains the NAT model)
  5. run_LANG_fine.sh (fine-tunes the NAT model)
You might also like...
Implementation of ProteinBERT in Pytorch

ProteinBERT - Pytorch (wip) Implementation of ProteinBERT in Pytorch. Original Repository Install $ pip install protein-bert-pytorch Usage import torc

A PyTorch implementation of paper
A PyTorch implementation of paper "Learning Shared Semantic Space for Speech-to-Text Translation", ACL (Findings) 2021

Chimera: Learning Shared Semantic Space for Speech-to-Text Translation This is a Pytorch implementation for the "Chimera" paper Learning Shared Semant

PyTorch Implementation of Meta-StyleSpeech : Multi-Speaker Adaptive Text-to-Speech Generation
PyTorch Implementation of Meta-StyleSpeech : Multi-Speaker Adaptive Text-to-Speech Generation

StyleSpeech - PyTorch Implementation PyTorch Implementation of Meta-StyleSpeech : Multi-Speaker Adaptive Text-to-Speech Generation. Status (2021.06.09

PyTorch implementation and pretrained models for XCiT models. See XCiT: Cross-Covariance Image Transformer
PyTorch implementation and pretrained models for XCiT models. See XCiT: Cross-Covariance Image Transformer

Cross-Covariance Image Transformer (XCiT) PyTorch implementation and pretrained models for XCiT models. See XCiT: Cross-Covariance Image Transformer L

A pytorch implementation of the ACL2019 paper
A pytorch implementation of the ACL2019 paper "Simple and Effective Text Matching with Richer Alignment Features".

RE2 This is a pytorch implementation of the ACL 2019 paper "Simple and Effective Text Matching with Richer Alignment Features". The original Tensorflo

PyTorch Implementation of VAENAR-TTS: Variational Auto-Encoder based Non-AutoRegressive Text-to-Speech Synthesis.
PyTorch Implementation of VAENAR-TTS: Variational Auto-Encoder based Non-AutoRegressive Text-to-Speech Synthesis.

VAENAR-TTS - PyTorch Implementation PyTorch Implementation of VAENAR-TTS: Variational Auto-Encoder based Non-AutoRegressive Text-to-Speech Synthesis.

A Pytorch implementation of
A Pytorch implementation of "Splitter: Learning Node Representations that Capture Multiple Social Contexts" (WWW 2019).

Splitter ⠀⠀ A PyTorch implementation of Splitter: Learning Node Representations that Capture Multiple Social Contexts (WWW 2019). Abstract Recent inte

Simple Text-Generator with OpenAI gpt-2 Pytorch Implementation

GPT2-Pytorch with Text-Generator Better Language Models and Their Implications Our model, called GPT-2 (a successor to GPT), was trained simply to pre

PyTorch original implementation of Cross-lingual Language Model Pretraining.
PyTorch original implementation of Cross-lingual Language Model Pretraining.

XLM NEW: Added XLM-R model. PyTorch original implementation of Cross-lingual Language Model Pretraining. Includes: Monolingual language model pretrain

Comments
  • import copy in train.py for line 36

    import copy in train.py for line 36

    flake8 testing of https://github.com/salesforce/nonauto-nmt on Python 3.6.3

    $ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

    ./model.py:92:75: F821 undefined name 'the_mask'
            return targets[input_mask], out[out_mask].view(-1, out.size(-1)), the_mask
                                                                              ^
    ./self_learn.py:626:48: F821 undefined name 'align_index'
                    decoding1 = unsorted(decoding, align_index)
                                                   ^
    ./self_learn.py:905:45: F821 undefined name 'loss_alter'
                loss_alter, loss_worse = export(loss_alter), export(loss_worse)
                                                ^
    ./self_learn.py:905:65: F821 undefined name 'loss_worse'
                loss_alter, loss_worse = export(loss_alter), export(loss_worse)
                                                                    ^
    ./self_learn.py:1342:78: F821 undefined name 'fertility_mode'
        names = ['dev.src.b{}={}.{}'.format(args.beam_size, args.load_from, args,fertility_mode),
                                                                                 ^
    ./self_learn.py:1343:77: F821 undefined name 'fertility_mode'
                'dev.trg.b{}={}.{}'.format(args.beam_size, args.load_from, args,fertility_mode),
                                                                                ^
    ./self_learn.py:1344:77: F821 undefined name 'fertility_mode'
                'dev.dec.b{}={}.{}'.format(args.beam_size, args.load_from, args,fertility_mode)]
                                                                                ^
    ./train.py:35:17: F821 undefined name 'copy'
        new_batch = copy.copy(batch)
                    ^
    8     F821 undefined name 'the_mask'
    8
    
    cla:missing 
    opened by cclauss 2
  • enumerate function in for loop

    enumerate function in for loop

    Thank you for sharing your code. I have a problem with running the code, when I run the code there is no error, but in debug mode, there is an issue in line 142 of "train.py" file. There is a "for" loop that its condition doesn't satisfy because of the "enumerate" function. how can I fix this? It seems that's because of "train" variable and enumerate function can not convert it to numbers or something like this.

    Screenshot from 2020-04-15 20-47-32

    I would be appreciated for any help.

    opened by VahidChahkandi 0
  • Transformer Architecture and other issues

    Transformer Architecture and other issues

    In this implementation transformer decoder layer i is attending to encoder layer i output, which seems to be different from Google's original transformer implementation which always attends to the last layer output.

    https://github.com/salesforce/nonauto-nmt/blob/efcbe4f2329b140ac3ce06abb6409457cebc8e49/model.py#L601

    Plus, the provided scripts seem to contain options not supported by run.py, and many train_fast.sh relies on -load_from old_fast_model, which further makes the paper's results hard to reproduce.

    opened by da03 1
  • Dataset

    Dataset

    Thank you for sharing your codes. I have a question about how to preprocess the data. For example, for the iwslt en-de dataset, you use a file named train.tags.en-de.bpe.dev.en2 in the script run_alignment_iwslt.sh. It seems to not belong to the original dataset. Where does it come from?

    opened by Maggione 4
Owner
Salesforce
A variety of vendor agnostic projects which power Salesforce
Salesforce
Mirco Ravanelli 2.3k Dec 27, 2022
Pytorch-version BERT-flow: One can apply BERT-flow to any PLM within Pytorch framework.

Pytorch-version BERT-flow: One can apply BERT-flow to any PLM within Pytorch framework.

Ubiquitous Knowledge Processing Lab 59 Dec 1, 2022
SAINT PyTorch implementation

SAINT-pytorch A Simple pyTorch implementation of "Towards an Appropriate Query, Key, and Value Computation for Knowledge Tracing" based on https://arx

Arshad Shaikh 63 Dec 25, 2022
Implementation of COCO-LM, Correcting and Contrasting Text Sequences for Language Model Pretraining, in Pytorch

COCO LM Pretraining (wip) Implementation of COCO-LM, Correcting and Contrasting Text Sequences for Language Model Pretraining, in Pytorch. They were a

Phil Wang 44 Jul 28, 2022
Implementation / replication of DALL-E, OpenAI's Text to Image Transformer, in Pytorch

Implementation / replication of DALL-E, OpenAI's Text to Image Transformer, in Pytorch

Phil Wang 5k Jan 2, 2023
A fast and easy implementation of Transformer with PyTorch.

FasySeq FasySeq is a shorthand as a Fast and easy sequential modeling toolkit. It aims to provide a seq2seq model to researchers and developers, which

宁羽 7 Jul 18, 2022
A PyTorch Implementation of End-to-End Models for Speech-to-Text

speech Speech is an open-source package to build end-to-end models for automatic speech recognition. Sequence-to-sequence models with attention, Conne

Awni Hannun 647 Dec 25, 2022
Pytorch implementation of Tacotron

Tacotron-pytorch A pytorch implementation of Tacotron: A Fully End-to-End Text-To-Speech Synthesis Model. Requirements Install python 3 Install pytorc

soobin seo 203 Dec 2, 2022
Google AI 2018 BERT pytorch implementation

BERT-pytorch Pytorch implementation of Google AI's 2018 BERT, with simple annotation BERT 2018 BERT: Pre-training of Deep Bidirectional Transformers f

Junseong Kim 5.3k Jan 7, 2023
Unofficial PyTorch implementation of Google AI's VoiceFilter system

VoiceFilter Note from Seung-won (2020.10.25) Hi everyone! It's Seung-won from MINDs Lab, Inc. It's been a long time since I've released this open-sour

MINDs Lab 881 Jan 3, 2023