label-studio: Prepopulating relations among entities for NER annotation doesn't work
Describe the bug
I’m using LabelStudio for a NER + Relations Among Entities task.
I want to pre-populate some relations to the annotation (using predictions). When I pre-populate entities, it shows up fine. However, when I try to pre-populate relations, I get the following error in my browser console:
Uncaught (in promise) Error: [mobx-state-tree] Can only store references to tree nodes or identifiers, got: 'undefined'
at be (mobx-state-tree.module.js:3662)
at new e (mobx-state-tree.module.js:6984)
at t.instantiate (mobx-state-tree.module.js:7243)
at mobx-state-tree.module.js:5734
at mobx-state-tree.module.js:5891
at Array.forEach (<anonymous>)
at t.forAllProps (mobx-state-tree.module.js:5890)
at t.initializeChildNodes (mobx-state-tree.module.js:5733)
at new t (mobx-state-tree.module.js:1442)
at ae (mobx-state-tree.module.js:3401)
Also, the spinner keeps spinning and nothing shows up in my browser.
This is the content of my tasks.json:
[
{
"id": 2,
"data": {
"text": "sales rep with highest sales for winkle"
},
"predictions": [
{
"result": [
{
"id": "anJaSFkP",
"from_name": "label",
"to_name": "text",
"type": "labels",
"normalization": "1P sales (Local Currency)",
"value": {
"start": 23,
"end": 28,
"text": "sales",
"labels": [
"Measure"
]
}
},
{
"id": "pBUYX3sZ",
"from_name": "label",
"to_name": "text",
"type": "labels",
"normalization": "Sales Representative",
"value": {
"start": 0,
"end": 9,
"text": "sales rep",
"labels": [
"Attribute"
]
}
},
{
"id": "L7o4xpaW",
"from_name": "label",
"to_name": "text",
"type": "labels",
"normalization": "Winkle~~Brand",
"value": {
"start": 33,
"end": 39,
"text": "winkle",
"labels": [
"Business Object"
]
}
},
{
"id": "TV7255ne",
"from_name": "label",
"to_name": "text",
"type": "labels",
"normalization": "TOP 1",
"value": {
"start": 15,
"end": 22,
"text": "highest",
"labels": [
"Rank"
]
}
},
/* THE RELATIONS BELOW IS THE PROBLEM */
{
"direction": "right",
"from_id": "TV7255ne",
"labels": [
"Rank-Attribute"
],
"to_id": "pBUYX3sZ",
"type": "relation"
},
{
"direction": "right",
"from_id": "TV7255ne",
"labels": [
"Rank-Measure"
],
"to_id": "anJaSFkP",
"type": "relation"
}
]
}
]
},
]
This is the content of my config.xml:
<View>
<Relations>
<Relation value="Period-Measure" />
<Relation value="Measure-Condition" />
<Relation value="Rank-Attribute" />
<Relation value="Rank-Periodicity" />
<Relation value="Rank-Attribute (Group)" />
<Relation value="Rank-Periodicity (Group)" />
<Relation value="Rank-Measure" />
</Relations>
<Labels name="label" toName="text">
<Label value="Measure" />
<Label value="Business Object" />
<Label value="Attribute" />
<Label value="Periodicity (Global)" />
<Label value="Periodicity (Rank)" />
<Label value="Temporal (Specific)" />
<Label value="Temporal (Range)" />
<Label value="Range (Start)" />
<Label value="Range (End)" />
<Label value="Condition Type" />
<Label value="Condition Value" />
<Label value="Rank" />
</Labels>
<Text name="text" value="$text" />
</View>
P.S. When I annotate the relation manually myself, the resulting JSON for that relation (in the completions folder is identical to what I have in the predictions list).
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 17 (7 by maintainers)
@makseq I am facing the exact same problem as @anja-wo. The entities prediction work fine. But when I add relations, I get the ‘TypeError: Cannot read property ‘traverseTree’ of null’ on labelstudio. I’m using version 0.8.2.
Hi! Sorry for long response, I’m trying to understand is this problem still exists, because we had a fix specifically for relations deserialisation, but we got another complain right after we deployed it. I’ll check it soon and come back with solution.