deepke/example/ner/few-shot
lilei f6f375d7cf
ner-few-shot
2021-09-27 09:06:04 -05:00
..
conf ner-few-shot 2021-09-27 09:06:04 -05:00
data ner-few-shot 2021-09-27 09:06:04 -05:00
README.md ner-few-shot 2021-09-27 09:06:04 -05:00
predict.py ner-few-shot 2021-09-27 09:06:04 -05:00
requirements.txt ner-few-shot 2021-09-27 09:06:04 -05:00
run.py ner-few-shot 2021-09-27 09:06:04 -05:00

README.md

快速上手

环境依赖

python == 3.8

  • torch == 1.7
  • tensorboardX ==2.4
  • transformers == 3.4.0
  • deepke

克隆代码

git clone git@github.com:zjunlp/DeepKE.git

使用pip安装

首先创建python虚拟环境再进入虚拟环境

  • 安装依赖: pip install -r requirements.txt

使用数据进行训练预测

  • 存放数据:在 data 文件夹下存放训练数据。包含conll2003mit-moviemit-restaurant和atis等数据集。

  • conll2003包含以下数据

    • train.txt:存放训练数据集

    • dev.txt:存放验证数据集

    • test.txt:存放测试数据集

    • indomain-train.txt存放indomain数据集

  • mit-movie, mit-restaurant和atis包含以下数据

    • k-shot-train.txtk=[10, 20, 50, 100, 200, 500],存放训练数据集

    • test.txt:存放测试数据集

  • 开始训练模型加载和保存位置以及配置可以在shell脚本中修改

    • 训练conll2003python run.py (训练所用到参数都在conf文件夹中修改即可)

    • 进行few-shot训练python run.py +train=few_shot (若要加载模型修改few_shot.yaml中的load_path)

  • 每次训练的日志保存在 logs 文件夹内,模型结果保存目录可以自定义。

  • 进行预测: python predict.py

模型内容

LightNER