label-studio-ml-backend icon indicating copy to clipboard operation
label-studio-ml-backend copied to clipboard

Error: [mobx-state-tree] No matching type for union

Open FredHaa opened this issue 2 years ago • 3 comments

Hi

I am trying to get pre-annotations up and running for the Automatic Speech Recognition using Segments recipe.

This is my labeling interface is defined like this:

<View>
  <Labels name="labels" toName="audio">
    <Label value="Background" background="#99c1f1"/>
    <Label value="Music" background="#8ff0a4"/>
    <Label value="Silence" background="#f9f06b"/>
    <Label value="Speech" background="#f66151"/>
  </Labels>

  <AudioPlus name="audio" value="$audio"/>

  <TextArea name="transcription" toName="audio" rows="2" editable="true" perRegion="true" required="true"/>
</View>

My model is only able to predict the labels, the text area will have to be filled by annotators. My model does predict an output, as I can see it in the task source:

{
  "id": 56,
  "data": {
    "audio": "/data/upload/2/9f0ec1c0-RADIO_YYY_1642722540.wav"
  },
  "annotations": [],
  "predictions": [
    {
      "id": 6,
      "model_version": "1655800486",
      "created_ago": "34 minutes",
      "result": [
        {
          "type": "labels",
          "value": {
            "end": 41,
            "start": 0,
            "labels": [
              "Speech"
            ]
          },
          "to_name": [
            "audio"
          ],
          "from_name": "labels",
          "original_length": 59
        },
        {
          "type": "labels",
          "value": {
            "end": 42,
            "start": 41,
            "labels": [
              "Music"
            ]
          },
          "to_name": [
            "audio"
          ],
          "from_name": "labels",
          "original_length": 59
        },
        {
          "type": "labels",
          "value": {
            "end": 59,
            "start": 42,
            "labels": [
              "Speech"
            ]
          },
          "to_name": [
            "audio"
          ],
          "from_name": "labels",
          "original_length": 59
        }
      ],
      "score": 1,
      "cluster": null,
      "neighbors": null,
      "mislabeling": 0,
      "created_at": "2022-06-21T08:34:54.745103Z",
      "updated_at": "2022-06-21T08:34:54.745110Z",
      "task": 56
    }
  ]
}

However, nothing is shown in the AudioPlus interface, and when I exit and reenter a task I get the following error:

Error: [mobx-state-tree] No matching type for union ({ pid: string?; score: (number | null?); readonly: boolean?; hidden: boolean?; parentID: (string | null?); fromSuggestion: boolean?; dynamic: boolean?; locked: boolean?; origin: ("prediction" | "prediction-changed" | "manual")?; id: identifier?; ouid: number?; results: { id: identifier?; score: (number | null?); from_name: reference((AudioModel | AudioModel | PolygonRegionModel | BrushRegionModel | KeyPointRegionModel | RectRegionModel | EllipseRegionModel | ImageModel | LabelModel | LabelsModel | ParagraphLabelsModel | TextAreaRegionModel | TextAreaModel | ChoiceModel | ChoicesModel | RatingModel | ParagraphsModel | RichTextModel | RichTextModel | TableModel | ChannelModel | TimeSeriesModel | VideoModel | BrushModel | BrushLabelsModel | HyperTextLabelsModel | KeyPointModel | KeyPointLabelsModel | ListModel | NumberModel | PairwiseModel | PolygonModel | PolygonLabelsModel | RankerModel | RectangleModel | RectangleLabelsModel | Shortc

What am I doing wrong? Any help would be greatly appreciated.

FredHaa avatar Jun 21 '22 09:06 FredHaa

@FredHaa Hi! Try to add random ids to each result, e.g.:

{
          "id": "abc123",
          "type": "labels",
          "value": {
            "end": 41,
            "start": 0,
            "labels": [
              "Speech"
            ]
          },
          "to_name": [
            "audio"
          ],
          "from_name": "labels",
          "original_length": 59
        },

makseq avatar Jun 21 '22 23:06 makseq

Getting same error after adding a random UUID to the prediction:

{
  "id": 450,
  "data": {
    "audio": "/data/upload/38/62bd9e8f-RADIO_YYY_1642203600.wav"
  },
  "annotations": [],
  "predictions": [
    {
      "id": 168,
      "model_version": "1655812104",
      "created_ago": "0 minutes",
      "result": [
        {
          "id": "de37ff44-c8cc-4f1a-a372-a35137332ad4",
          "type": "labels",
          "value": {
            "end": 59,
            "start": 0,
            "labels": [
              "Danish Speech"
            ]
          },
          "to_name": [
            "audio"
          ],
          "from_name": "labels",
          "original_length": 59
        }
      ],
      "score": 1,
      "cluster": null,
      "neighbors": null,
      "mislabeling": 0,
      "created_at": "2022-06-22T06:48:18.265554Z",
      "updated_at": "2022-06-22T06:48:18.265561Z",
      "task": 450
    }
  ]
}

FredHaa avatar Jun 22 '22 06:06 FredHaa

      "to_name": [
        "audio"
      ],

=> "to_name": "audio",

makseq avatar Jun 23 '22 08:06 makseq

Closed as outdated, solved or no more actual issue.

makseq avatar Mar 09 '23 18:03 makseq