huggingface / huggingface/course

Issue with NER model with adjacent entities of the same type.

Open
#764 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
MDX
Stars
4.2k
Forks
1.4k
Avg merge
13m
Merged PRs (30d)
1

Description

It's a double issue :

1/ In the section "Fast tokenizer special powers" of the chapter on Tokenizer, it is mentionned that the model that is loaded (dbmdz/bert-large-cased-finetuned-conll03-english) has been finetuned on a dataset following IOB1 format, that is, for two adjacent entities of the same type, the second one start with B- rather than I-.

It seems to me that this model does not work that way.

I've tried many times, with several entities, the entities always get tagged I-.

E.g : Screenshot below with locations.
![image](https://github.com/user-attachments/assets/66c0870d-b22b-40ea-9ad9-03863774537d)

Same with Persons :
![image](https://github.com/user-attachments/assets/92c0b3ee-10a3-4a51-ad2c-4e47774564c4)

Thus the example mentionned in the course does not work that way. Cf: (should be like in blue below)
![image](https://github.com/user-attachments/assets/d319c4d4-60a8-4fdf-8d19-254547e3fb4e)

2/ The piece of code meant to group entities at the end of that section (screenshot below) has an issue too.
Following the supposed behaviour (second entity starts with B-) an entity starting with B- would be instantly ejected from the while loop, thus losing all the rest of the following tokens starting with I-. There's most probably an issue in the iteration of the idx in the while loop.

![image](https://github.com/user-attachments/assets/16a432b1-3eba-4c68-9f05-91d429e5bc43)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.