SPACY v3: Custom trainable relation extraction component

Explosion · 40K views · 2021 · 38:11

Open on YouTube

Computer vision, speech & NLPMachine learning & deep learningtutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering or asking about relation extraction, custom Thinc models, and trainable components in spaCy 3.

Recommended by 2 people across 2 different months, 2021 to 2022.

What it is

A 38-minute tutorial from Explosion, the makers of spaCy, showing how to build a custom trainable relation extraction component in spaCy v3. It covers designing the ML model in Thinc, the config file, the TrainablePipe API, and running everything as a spaCy project, with an optional transformer model.

What people said

Recommends Sofie VL · 2021-05 · Stack Overflow · on “Custom model for spacy 3.0 implemented using tensorflow”

Just to clarify: the repository you linked does not showcase a Pytorch model for relation extraction in spaCy - in fact it uses the ML library Thinc [LINK] to implement the model. You can find more details on that in the corresponding video tutorial [this video] . The key point to remember is that spaCy works with Thinc models under the hood, but Thinc provides wrappers [LINK] for Pytorch and Tensorflow. To use those in spaCy, you can follow the documentation here [LINK] . In a nutshell, you should be able to do something like this: from thinc.api import TensorFlowWrapper wrapped_model = TensorFlowWrapper(your_tf_model) The wrapped_model will now be a Thinc model that you can use to power your (c

Recommends yco · 2022-02 · Stack Overflow · on “is there a method to detect person and associate a text?”

You might be interested also in relation extraction rather than just position-based unselective context retrieval. [this video]

Cites lucerna_juris · 2022-12 · Stack Overflow · on “Spacy ValueError: [E002] Can't find factory for 'relation_extractor' for language English (en)”

I want to train a "relation extractor" component as in this tutorial [this video] . I have 3 .spacy files (train.spacy, dev.spacy, test.spacy. I run: python3 -m spacy init fill-config config.cfg config.cfg followed by python3 -m spacy train --output ./model config.cfg --paths.train train.spacy --paths.dev dev.spacy Output: ValueError: [E002] Can't find factory for 'relation_extractor' for language English (en). This usually happens when spaCy calls `nlp.create_pipe` with a custom component name that's not registered on the current language class. If you're using a Transformer, make sure to install 'spacy-transformers'. If you're using a custom component, make sure you've added the decorator `@Lan