yuzhimanhua / Multi-BioNER

Cross-type Biomedical Named Entity Recognition with Deep Multi-task Learning (Bioinformatics'19)
https://arxiv.org/abs/1801.09851
Apache License 2.0
132 stars 28 forks source link

How do I share only at the char-level or word-level? #16

Closed hantingge closed 4 years ago

hantingge commented 4 years ago

Hi,

In your paper, you experimented with 3 architectures MTM-C, MTM-W, and MTM-CW.

How do I implement MTM-C or MTM-W at char-level or word-level using your code?

yuzhimanhua commented 4 years ago

Please modify __init__() and forward() functions in model/lm_lstm_crf.py.

For example, if you want Char-LSTM to be separate, create an nn.ModuleList() for self.forw_char_lstm and self.back_char_lstm in __init__().

Then, in forward(), change Lines 225 and 227 to be forw_lstm_out, _ = self.forw_char_lstm[file_no](d_f_emb) and back_lstm_out, _ = self.back_char_lstm[file_no](d_b_emb).

You can always refer to how we write self.crflist because CRFs are separate.