iesl / dilated-cnn-ner

Dilated CNNs for NER in TensorFlow
243 stars 60 forks source link

How to run model with character embeddings? #4

Closed egrcc closed 6 years ago

egrcc commented 6 years ago

Hi, according to Table 1 of your paper, "No models use character embeddings or lexicons. " The character embeddings is very useful for sequence labeling as stated by (G Lample - ‎2016) and (X Ma - ‎2016). I also found that your code has already implemented it (bilstm_char.py and cnn_char.py), so I modified the L13~L15 of global.conf to run model with character embeddings:

export char_dim=30
export char_tok_dim=30
export char_model="cnn"

Then, I ran the following steps (for ID-CNN-CRF model):

./bin/preprocess.sh conf/conll/dilated-cnn-viterbi.conf
./bin/train-cnn.sh conf/conll/dilated-cnn-viterbi.conf
./bin/eval-cnn.sh conf/conll/dilated-cnn-viterbi.conf --load_model /home/ljzhao/dilated-cnn-ner-master/models/dilated-cnn-viterbi.tf test

Is this right?

I also found that L12 of eval-cnn.sh needs to be changed to the following line to correctly evaluate on the test set:

if [[ $4 == "test" ]]; then

G Lample - ‎2016: Neural Architectures for Named Entity Recognition X Ma - ‎2016: End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF

strubell commented 6 years ago

I think that should be right but I can't make any guarantees right now that the implementation is correct, as I was never able to get accuracy as high as in the Lample 2016 paper. I want to get this working, though, for a different project I'm working on right now, so I will use this issue to track that. Thanks!

egrcc commented 6 years ago

Thanks for your reply. Is there any easy way to run this code with other datasets (e.g. POS-Tagging or Chunking)? I found the data preprocessing is too complicated to follow.

strubell commented 6 years ago

Sure. The easiest way to use this code to train on other tagsets would be to create a data file with the same format as is expected for conll-2003, except with the pos/chunk/whatever tags in the same field as this code expects the ner tags. I think that should just work.

On Sat, Dec 16, 2017 at 7:19 PM Lujun Zhao notifications@github.com wrote:

Thanks for your reply. Is there any easy way to run this code with other datasets (e.g. POS-Tagging or Chunking)? I found the data preprocessing is too complicated to follow.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/iesl/dilated-cnn-ner/issues/4#issuecomment-352205133, or mute the thread https://github.com/notifications/unsubscribe-auth/ADHZt86qE4SVgKrMZPCAyuUG49FXIZ2Xks5tBBepgaJpZM4REV3r .

egrcc commented 6 years ago

It works. Thanks~