princeton-nlp / PURE

[NAACL 2021] A Frustratingly Easy Approach for Entity and Relation Extraction https://arxiv.org/abs/2010.12812
MIT License
790 stars 122 forks source link

how to train the entity and relation models together? #43

Closed lingzhiwisemed closed 2 years ago

lingzhiwisemed commented 2 years ago

Hi! How to train the entity and relation models together? Is there any relevant implementation code, thank you!

a3616001 commented 2 years ago

Hi! I'm not pretty sure if I understand your question correctly, but our approach doesn't train the entity and relation models together. We need to train the entity model first to provide entity information for the relation model.

If you actually want a code to train two models sequentially, it should be straightforward to include training commands for both models in a bash script.

Let me know if you have further questions!

lingzhiwisemed commented 2 years ago

Hi! I'm not pretty sure if I understand your question correctly, but our approach doesn't train the entity and relation models together. We need to train the entity model first to provide entity information for the relation model.

If you actually want a code to train two models sequentially, it should be straightforward to include training commands for both models in a bash script.

Let me know if you have further questions!

In Section 5.2, how to implement sharing of two representation encoders? thanks!

a3616001 commented 2 years ago

Hi! To share the encoders during training, you can create training set combining entity training instances and relation training instances. At each iteration, random select a training batch from either entity instances or relation instances, compute the loss and update the shared model.

I currently don't have a plan to release this code, but it should be straightforward to implement this based on the current code. Let me know if you need any further help!

lingzhiwisemed commented 2 years ago

Thank you!