deepke/example/re/few-shot
Xin Xu 22fc17a41e
Update README.md
2022-01-11 17:04:35 +08:00
..
conf Update train.yaml 2021-10-10 20:46:10 +08:00
README.md Update README.md 2022-01-11 17:04:35 +08:00
README_CN.md Update README 2022-01-11 17:01:47 +08:00
predict.py fix bug 2021-12-29 13:11:59 +08:00
requirements.txt Add files via upload 2021-10-10 19:18:44 +08:00
run.py fix bug 2021-12-14 16:20:31 +08:00

README.md

Easy Start

English | 简体中文

Requirements

python == 3.8

  • torch == 1.5
  • transformers == 3.4.0
  • hydra-core == 1.0.6
  • deepke

Download Code

git clone https://github.com/zjunlp/DeepKE.git
cd DeepKE/example/re/few-shot

Install with Pip

  • Create and enter the python virtual environment.
  • Install dependencies: pip install -r requirements.txt.

Train and Predict

  • Dataset

    • Download the dataset to this directory.

      wget 120.27.214.45/Data/re/few-shot/data.tar.gz
      tar -xzvf data.tar.gz
      
    • The dataset SEMEVAL is stored in data:

      • rel2id.jsonRelation Label - ID

      • temp.txtResults of handled relation labels

      • test.txt Test set

      • train.txt: Training set

      • val.txtValidation set

  • Training

    • Parameters, model paths and configuration for training are in the conf folder and users can modify them before training.

    • Few-shot training on SEMEVAL

      python run.py
      
    • The trained model is stored in the current directory by default.

    • Start to train from last-trained model

      modify train_from_saved_model in .yaml as the path of the last-trained model

    • Logs for training are stored in the current directory by default and the path can be configured by modifying log_dir in .yaml

  • Prediction

    python predict.py
    

Model

KnowPrompt