0 Star 0 Fork 0

科大讯飞/TextPruner

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Pruning the Classification model

These scripts perform vocabulary pruning on the classification model (XLMRobertaForSequenceClassification) and evaluate the performance.

We use a subset of XNLI English training set as the vocabulary file.

Download the fine-tuned model or train your own model on PAWS-X dataset, and save the files to ../models/xlmr_pawsx.

Download link: * Google Drive * Hugging Face Models

  • Pruning with the textpruner-CLI tool:
bash vocabulary_pruning.sh
  • Pruning with the python script:
VOCABULARY_FILE=../datasets/xnli/en.tsv
MODEL_PATH=../models/xlmr_pawsx
python vocabulary_pruning.py $MODEL_PATH $VOCABULARY_FILE
  • Evaluate the model:

Set $PRUNED_MODEL_PATH to the directory where the pruned model is stored.

python measure_performance.py $PRUNED_MODEL_PATH

Pruning the Pre-Trained models for MLM

This script prunes the pre-trained models for MLM with a vocabulary limited to the SST-2 training set.

Set $MODEL_PATH to the directory where the pre-trained model (BERT, RoBERTa, etc.) is stored.

python MaskedLM_vocabulary_pruning.py $MODEL_PATH
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/iflytek/TextPruner.git
git@gitee.com:iflytek/TextPruner.git
iflytek
TextPruner
TextPruner
main

搜索帮助