| Code of EMNLP 2022 paper COST-EFF: Collaborative Optimization of Spatial and Temporal Efficiency with Slenderized Multi-exit Language Models |
|---|
CosteffDirectory of COST-EFF Implementation.configuration_costeff.pyModel configuration (e.g., pruning dimension, number of attention heads)modeling_costeff.pyPyTorch implementation of COST-EFF model.pruning.pyPruning utility.run_glue_costeff.pyRunner of COST-EFF procedure.
modelsDirectory of models.pretrained_modelDirectory of pre-trained models (e.g., BERT, RoBERTa, ElasticBERT).finetuned_modelDirectory of fine-tuned models (i.e., the models to optimize).TA_modelDirectory of TA models. The TA model is an intermediate between the model to optimize and the COST-EFF model.costeff_modelDirectory of COST-EFF models (i.e., the result of COST-EFF procedure).
dataDirectory of datasets.glueWe use GLUE datasets in the paper.
requirements.txtAutomatically generated requirements file by Anaconda.run.shShell script of COST-EFF pipeline.test.shShell script to evaluate and profile COST-EFF.
- Run
conda create --name costeff --file requirements.txtto create a virtual environment and download the dependencies. - Download the pre-trained model (e.g. BERT) and training dataset (e.g. GLUE) into the corresponding folders. Please refer to the README under each folder for details.
- Modify and run the scripts
run.shandtest.shfor model training and evaluation.
If you find this work helpful, please cite
@inproceedings{shen2022costeff,
title={COST-EFF: Collaborative Optimization of Spatial and Temporal Efficiency with Slenderized Multi-exit Language Models},
author={Bowen Shen, Zheng Lin, Yuanxin Liu, Zhengxiao Liu, Lei Wang, Weiping Wang},
booktitle = {Proceedings of {EMNLP}},
year={2022}
}