English | 简体中文
python == 3.8
- torch == 1.5.0
- transformers == 3.4.0
- opt-einsum == 3.3.0
- ujson
- deepke
git clone https://github.com/zjunlp/DeepKE.git
cd DeepKE/example/re/document- Create and enter the python virtual environment.
- Install dependencies:
pip install -r requirements.txt.
-
Dataset
-
Download the dataset to this directory.
wget 121.41.117.246:8080/Data/re/document/data.tar.gz tar -xzvf data.tar.gz
-
The dataset DocRED is stored in
data:-
dev.json:Validation set -
rel_info.json:Relation set -
rel2id.json:Relation labels - ID -
test.json:Test set -
train_annotated.json:Training set annotated manually -
train_distant.json: Training set generated by distant supervision
-
-
-
Training
-
Parameters, model paths and configuration for training are in the
conffolder and users can modify them before training. -
Training on DocRED
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_modelin.yamlas 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_dirin.yaml
-
-
Prediction
python predict.py
- After prediction, generated
result.jsonis stored in the current directory
- After prediction, generated