Skip to content
Language-Adversarial Training for Cross-Lingual Text Classification (TACL)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial release Aug 18, 2018
LICENSE Initial commit Jul 17, 2018

Language-Adversarial Training for Cross-Lingual Text Classification

This repo contains the source code for our TACL journal paper:

Adversarial Deep Averaging Networks for Cross-Lingual Sentiment Classification
Xilun Chen, Yu Sun, Ben Athiwaratkun, Claire Cardie, Kilian Weinberger
Transactions of the Association for Computational Linguistics (TACL)
paper (arXiv), bibtex (arXiv), paper (TACL), bibtex, talk@EMNLP2018


ADAN transfers the knowledge learned from labeled data on a resource-rich source language to low-resource languages where only unlabeled data exists. It achieves cross-lingual model transfer via learning language-invariant features extracted by Language-Adversarial Training.


  • Python 3.6
  • PyTorch 0.4
  • PyTorchNet (for confusion matrix)
  • scipy
  • tqdm (for progress bar)

File Structure

└── code
    ├── data_prep                       (data processing scripts)
    │   ├──        (processing the Chinese Hotel Review dataset)
    │   └──             (processing the English Yelp Review dataset)
    ├──                       (lower-level helper modules)
    ├──                       (higher-level modules)
    ├──                      (hyper-parameters aka. all the knobs you may want to turn)
    ├──                        (main file to train the model)
    ├──                        (helper functions)
    └──                        (vocabulary)


The datasets can be downloaded separately here.

To support new datasets, simply write a new script under data_prep similar to the current ones and update to correctly load it.

Run Experiments

python --model_save_file {path_to_save_the_model}

By default, the code uses CNN as the feature extractor. To use the LSTM (with dot attention) feature extractor:

python --model lstm --F_layers 2 --model_save_file {path_to_save_the_model}
You can’t perform that action at this time.