Skip to content

up700/Code3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Requirements

Overview

├── root
│   └── Entity-Detection
│       └── dataset
│           ├── conll2003_train.json
│           ├── conll2003_tag_to_id.json
│           ├── politics_train.json
│           ├── politics_dev.json
│           ├── politics_test.json
│           ├── politics_tag_to_id.json
│           └── ...
│       └── models
│           ├── __init__.py
│           └── modeling_span.py
│       └── utils
│           ├── __init__.py
│           ├── config.py
│           ├── data_utils.py
│           ├── eval.py
│           └── ...
│       └── ptms
│           └── ... (trained results, e.g., saved models, log file)
│       └── cached_models
│           └── ... (BERT-Base, which will be downloaded automatically)
│       └── run_script.py
│       └── run_script.sh
│   └── Type-Prediction
│       └── dataset
│           ├── conll2003_train.json
│           ├── conll2003_tag_to_id.json
│           ├── politics_train.json
│           ├── politics_dev.json
│           ├── politics_test.json
│           ├── politics_tag_to_id.json
│           └── ...
│       └── models
│           ├── __init__.py
│           └── modeling_type.py
│       └── utils
│           ├── __init__.py
│           ├── config.py
│           ├── data_utils.py
│           └── eval.py
│       └── ptms
│           └── ... (trained results, e.g., saved models, log file)
│       └── cached_models
│           └── ... (BERT-Base, which will be downloaded automatically)
│       └── run_script.py
│       └── run_script.sh

How to run

I. Entity Detection

cd Entity-Detection/

1. Training

sh run_script.sh <GPU ID> <Target> True False <Source> Train

e.g., CoNLL2003 (Source) ---> politics (Target)

sh run_script.sh 0 politics True False conll2003 Train

2. Inference (Generate candidate entity spans)

sh run_script.sh <GPU ID> <Target> False True <Source> <EVAL>

e.g., CoNLL2003 (Source) ---> politics (Target)

sh run_script.sh 0 politics False True conll2003 dev
sh run_script.sh 0 politics False True conll2003 test

3. Copy the candidate entity spans into Type Prediction folder

cp ptms/politics/dev_pred_spans.json ../Type-Prediction/dataset/
cp ptms/politics/test_pred_spans.json ../Type-Prediction/dataset/

II. Type Prediction

cd ../Type-Prediction/

1. Construct the inputs based on the candidate spans

python dataset/combine.py --target politics --eval dev
python dataset/combine.py --target politics --eval test

2. Training

sh run_script.sh <GPU ID> <Target> True False <Source> Train 1.0

e.g., CoNLL2003 (Source) ---> politics (Target)

sh run_script.sh 0 politics True False conll2003 Train 1.0

3. Inference

sh run_script.sh 0 politics False True conll2003 test 0.6

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published