Spancat single label validation error-extra fields not permitted #12858
-
Using the first example in the documentation for the span categorizer import spacy
from spacy.pipeline.spancat import DEFAULT_SPANCAT_SINGLELABEL_MODEL
config = {
"threshold": 0.5,
"spans_key": "labeled_spans",
"model": DEFAULT_SPANCAT_SINGLELABEL_MODEL,
"suggester": {"@misc": "spacy.ngram_suggester.v1", "sizes": [1, 2, 3]},
# Additional spancat_singlelabel parameters
"negative_weight": 0.8,
"allow_overlap": True,
}
nlp = spacy.blank("en")
nlp.add_pipe("spancat_singlelabel", config=config) gives the following error If I remove the threshold in the config, the spancat won't initialize. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi, thanks for bringing this to our attention! The example code is incorrect - the single label SpanCategorizer doesn't take a That being said, the example code is just a snippet that constructs and adds the SpanCat component to the pipeline. If you wish to train a pipeline with it, the setup is a bit more involved - the demo project should provide a comprehensive overview of how this is done. |
Beta Was this translation helpful? Give feedback.
Hi, thanks for bringing this to our attention! The example code is incorrect - the single label SpanCategorizer doesn't take a
threshold
argument. We'll fix that in the next release.That being said, the example code is just a snippet that constructs and adds the SpanCat component to the pipeline. If you wish to train a pipeline with it, the setup is a bit more involved - the demo project should provide a comprehensive overview of how this is done.