HumanSignal / HumanSignal/label-studio-ml-backend
Error at ner_ml_backend.py, line 99
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 490
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 3
Description
After having annotated my text and followed this [tutorial ](https://github.com/HumanSignal/label-studio-ml-backend/tree/master/label_studio_ml/examples/flair) to add a ML model in order to continue automatically the work of annotation, I have this problem :
Error at ner_ml_backend.py, line 99
in fit
completions = self._get_annotated_dataset(data['project_id'])
TypeError: string indices must be integers
The function fit() in ner_ml_backend.py :
```
def fit(self, event, data, **kwargs):
#completions contain ALL the annotated samples.
#train a model from scratch here.
flair_sents = []
completions = self._get_annotated_dataset(data['project_id'])
for compl in completions:
sent = Sentence(compl['data'][self.to_name]) #get raw sentence and convert to flair
annotations = compl['annotations']
sent = self.convert_to_flair_annotation(sent, annotations)
#only add sentences that contain entities to dataset
if len(sent.get_spans('ner')) != 0:
flair_sents.append(sent)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with fit() in label_studio_ml/examples/flair/ner_ml_backend.py at the reported line, then inspect _get_annotated_dataset and the data shape produced by the linked tutorial. Reproduce the annotation flow and trace why completions is treated as a string; done means the example proceeds past fit() without the reported TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100