chen700564 / sdnet

Other
38 stars 6 forks source link

SDNet

Implementation

Quick links

Environment

conda create -n sdnet python=3.8.5
conda activate sdnet
bash env.sh

Pretrained Data

Part of pretrianed data is in the pretrain_data folder, the file includes 200k instances.

Dataset

Dataset is in the data folder:

data/DATASET/
├── test.json
├── kshot.json/full.json
└── mapping.json

Instance format: Each instance is a Dict, containing tokens and entity fields, in which tokens is the list of tokens, and entity is the list of entity mentions.

{
    "tokens": [token1,token2,...],
    "entity": [
        [
            {"text":mention1, "type": type1, "offset":[startindex1,endindex1]},
            {"text":mention2, "type": type2, "offset":[startindex2,endindex2]},
            ...
        ]
},

Pretrained SDNet

The pretrained SDNet (sdnet.th) should be putted in folder sdnetpretrain

You can download the pretrained SDNet in this link or line.

Fewshot Fine-tuning

run:

python main.py -dataset DATASET -K 5 -sdnet -cuda DEVICE

The predicted result is saved in tmp/dataset/...

Model Evaluation

just add -evalue:

python main.py -dataset DATASET -K 5 -sdnet -cuda DEVICE -evalue

License

The code is released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License for Noncommercial use only. Any commercial use should get formal permission first.

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0