# Training a relation extraction component

**URL:** <https://support.prodi.gy/t/training-a-relation-extraction-component/6376>\
**Category:** Uncategorized\
**Tags:** solved, relations, training\
**Created:** [February 20, 2023, 10:19am UTC](https://support.prodi.gy/t/training-a-relation-extraction-component/6376 "2023-02-20T10:19:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [February 20, 2023, 11:55pm UTC](https://support.prodi.gy/t/training-a-relation-extraction-component/6376/2 "2023-02-20T23:55:22Z")

</div>

hi @stella!

Thanks for your question and welcome to the Prodigy community 👋

Have you watched @SofieVL's Relations Extraction video and tutorial:

> <https://github.com/explosion/projects/tree/v3/tutorials/rel_component>
>
> //github.com/explosion/projects/tree/v3/tutorials/rel\_component

[![](https://img.youtube.com/vi/8HL-Ap5_Axo/hqdefault.jpg "SPACY v3: Custom trainable relation extraction component") ](https://www.youtube.com/watch?v=8HL-Ap5_Axo)

You may also find this post to be helpful:

> [@Rel training](https://support.prodi.gy/t/rel-training/5331/2):
>
> Hi Pantelis, In general your workflow is exactly how we'd recommend it. The REL component was developed as a tutorial and is not really robust and generic enough to cover any use-case, but I hope the provided example code can help you hit the ground running. First, the extracted annotations from my rel.manual also have the Named Entities, but i think i have seen mentioned elsewhere that it still better to separately train the two tasks. So i should keep my already trained NER model and train …

This post helps explains why there isn't a simple approach as spaCy doesn't have a built-in relation prediction component:

> [@Training command for Dependencies and Relations](https://support.prodi.gy/t/training-command-for-dependencies-and-relations/5371/2):
>
> Hi! The problem here is that you're trying to train a syntactic dependency parser on data collected on entity relationships. These are fundamentally two very different tasks so it's not surprising you're seeing a 0 accuracy score here. The dependency parser just isn't the right fit for this task. spaCy doesn't currently have a generic built-in relation prediction component because the type of model you want for this can often differ significantly between use cases. But this tutorial of implemen…

You may also find using spaCy's GitHub Discussions forum to be more helpful as training relations is more of a spaCy problem than a Prodigy. The spaCy core team supports that forum and they can help answer. There are already related posts like:

> **[Train a relation extraction model with spaCy · explosion/spaCy · Discussion...](https://github.com/explosion/spaCy/discussions/10930)**
>
> Hi! :) I'm working on Relation Extraction, specifically the extraction of drug-drug interactions from text documents. I saw this tutorial, https://www.youtube.com/watch?v=8HL-Ap5\_Axo, and I'm tryin...

> **[How to train NER and Relation Extraction model together · explosion/spaCy ·...](https://github.com/explosion/spaCy/discussions/9139)**
>
> Hi, I want to train NER and Relation Extraction model together instead of training separately. Please help me to understand the flow from scratch. Following are my queries : How to prepare dataset ...

---

_[View the full topic](https://support.prodi.gy/t/training-a-relation-extraction-component/6376)._
