This is the implementation of the TextNAS algorithm proposed in the paper TextNAS: A Neural Architecture Search Space tailored for Text Representation.
Перейти к файлу
microsoft-github-policy-service[bot] db0f08e38d
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2022-11-28 19:09:08 +00:00
child_model Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
common Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
controller Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
.gitignore Add .gitignore configure. 2020-04-03 18:30:49 +08:00
LICENSE Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
NOTICE Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
README.md Minor fix for README. 2020-04-03 19:04:57 +08:00
SECURITY.md Microsoft mandatory file 2022-08-17 14:48:21 +00:00
__init__.py Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
eval_arc_sst2.sh Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
eval_arc_sst5.sh Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
main.py Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
sst_macro_search_multi.sh Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00
utils.py Add the initial version and init the repo. 2020-04-03 18:30:18 +08:00

README.md

This is the implementation of the TextNAS algorithm proposed in the paper TextNAS: A Neural Architecture Search Space tailored for Text Representation. TextNAS is a neural architecture search algorithm tailored for text representation, more specifically, TextNAS is based on a novel search space consists of operators widely adopted to solve various NLP tasks, and TextNAS also supports multi-path ensemble within a single network to balance the width and depth of the architecture.

The search space of TextNAS contains:

* 1-D convolutional operator with filter size 1, 3, 5, 7 
* recurrent operator (bi-directional GRU) 
* self-attention operator
* pooling operator (max/average)

Following the ENAS algorithm, TextNAS also utilizes parameter sharing to accelerate the search speed and adopts a reinforcement-learning controller for the architecture sampling and generation. Please refer to the paper for more details of TextNAS.

Preparation

Prepare the word vectors and SST dataset, and organize them in data directory as shown below:

textnas
├── data
│   ├── sst
│   │   ├── dev.txt
│   │   ├── test.txt
│   │   └── train.txt
│   └── glove.840B.300d.txt
├── dataloader.py
├── model.py
├── ops.py
├── README.md
├── search.py
└── utils.py

The following link might be helpful for finding and downloading the corresponding dataset:

Examples

Search Space

# If the code is cloned already, ignore this line and enter code folder.
git clone https://github.com/microsoft/TextNAS.git

# search the best architecture
cd TextNAS

# run the default search script
sh sst_macro_search_multi.sh

Evaluate the architecture

# If the code is cloned already, ignore this line and enter code folder.
git clone https://github.com/microsoft/TextNAS.git

# evaluate the architecture on sst-2
sh eval_arc_sst2.sh

# evaluate the architecture on sst-5
sh eval_arc_sst5.sh

Citations

If you happen to use our work, please consider citing our paper.

@article{wang2019textnas,
  title={TextNAS: A Neural Architecture Search Space tailored for Text Representation},
  author={Wang, Yujing and Yang, Yaming and Chen, Yiren and Bai, Jing and Zhang, Ce and Su, Guinan and Kou, Xiaoyu and Tong, Yunhai and Yang, Mao and Zhou, Lidong},
  journal={arXiv preprint arXiv:1912.10729},
  year={2019}
}