Giter Site home page Giter Site logo

sodner's Introduction

A Span-Based Model for Joint Overlapped and Discontinuous Named Entity Recognition

The repo includes the code for the following paper:

@inproceedings{li2021sodner,
 title={A Span-Based Model for Joint Overlapped and Discontinuous Named Entity Recognition},
 author={Li, Fei and Lin, Zhichao and Zhang, Meishan and Ji, Donghong},
 booktitle={Proceedings of the ACL},
 year={2021}
}

Setup

  1. Use "conda" or "virtualenv" to create a virtual python3 environment. Take "conda" as example, run:
conda create -n sodner python=3.6
  1. Activate the environment.
conda activate sodner
  1. Run the following command to install necessary packages.
pip install -r requirements.txt
  1. Download the PyTorch AllenNLP version of SciBERT from here. Put it into the current directory.

  2. Put the preprocessed data into "data" directory. There is a sample directory for your reference to preprocess original datasets.

Training & Evaluation

  1. Below is the command to run experiments on the sample dataset. If use GPU, change -1 to 0 or other number that is larger than 0.
nohup ./train_sample.sh -1 > sample_0001.log 2>&1 &

Inference

  1. Run the following command.
cuda_device=-1 allennlp predict models/sample_0001/model.tar.gz data/sample/sample.json --include-package sodner --predictor my_predictor --output-file prediction.txt

Debug

  1. Change the settings in "sample_working_example.jsonnet" as below.
  • debug: true,
  • shuffle: false,
  1. Add the following environment into your IDE such as PyCharm.
  • ie_test_data_path=./data/sample/sample.json;
  • ie_dev_data_path=./data/sample/sample.json;
  • ie_train_data_path=./data/sample/sample.json;
  • cuda_device=-1;
  1. Run "debug_sample.py" with debug mode.

Data Preprocessing

  1. We show an example to preprocess the CADEC data. First, download the code of Dai et al. 2020. Use their instructions to preprocess the CADEC data and get 3 output files, namely "train.txt", "dev.txt" and "test.txt".

  2. Download Stanford CoreNLP. We use "stanford-corenlp-full-2018-10-05".

  3. Modify the directory paths at the beginning of "preprocess_cadec.py" based on your environment. Create a "1.sh" file like

#!/bin/bash
sudo /xxx/envs/python37/bin/python "$@"

and run "1.sh preprocess_cadec.py".

Acknowledgement

We thank all the people that provide their code to help us complete this project. This project is built mainly based on the code published by Wadden et al. 2019.

sodner's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sodner's Issues

关于debug和cadec数据集运行的一些问题

老师,你好,我想在我的ner模型上试一下加句法信息这个模块,想跑一下cadec数据集debug一下看看。但,我在sample数据集可以跑(图1),但我换cadec数据集它会报错说不存在这个数据集的.sh 文件,可明明就在同一个目录下啊,然后没办法我只能把cadec数据集的.sh 里面的内容复制到sample.sh文件里试试,结果报错(图2)。debug我按你给的readme没成功。期待老师的解答
sample运行log
image
cadec运行log
图片
sample上debug
图片
图片
图片

关于评价指标?

请问在算分的时候会考虑不连续实体中每个跨度间的顺序问题么?还是仅预测出跨度即可?

ace数据集跑的结果与论文相差很大

李老师,你好,我按照8:1:1的比例处理了ace05数据集,然后根据cadec的处理方法将数据集处理成模型能够运行的格式,最后出来的结果跟您论文中的结果差距很大。我想问一下,跑嵌套数据集,最后的结果是看real还是看ner的数值。

找不到模型中所描述的MLP

你好,我想请问一下,只在gat.py中看到了MLP然后这个结果又传递到了span_embedding中,不知道模型中Span Representation之后连接的MLP1和MLP2在代码中具体的哪个位置。

句法依赖信息

李老师您好,我想问下,GCN模块输入的句法依赖信息是用什么得到的啊

模型性能

你好,我想问一下模型最好性能的参数是您现在公布的参数吗?

安装requirements错误

你好!
执行pip install -r requirements.txt之后遇到了以下错误:
Screenshot 2023-02-03 at 2 55 27 PM
请问该如何解决?(同时试了colab和本地都不行)

模型性能

您好,我按照您的设置,在CADEC上的结果达到了75以上,比论文中的高很多,请问您知道我可能有什么地方操作失误吗

Ner or Rel in jssonet

Hi, can you please explain what is the target: "rel" in the config files? I mean what is the difference if the target is set to "ner" and "rel"?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.