# Nested named entity recognition

**URL:** <https://discuss.huggingface.co/t/nested-named-entity-recognition/75376>\
**Category:** Intermediate\
**Created:** [February 29, 2024, 6:52pm UTC](https://discuss.huggingface.co/t/nested-named-entity-recognition/75376 "2024-02-29T18:52:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stulcrad](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@stulcrad](https://discuss.huggingface.co/u/stulcrad)\
**Post date:** [February 29, 2024, 6:52pm UTC](https://discuss.huggingface.co/t/nested-named-entity-recognition/75376/1 "2024-02-29T18:52:25Z")

</div>

Hello,

I would love to train a model on a nested NER dataset, and I would like to ask if someone has any experience with how huggingface libraries interact with it and if it will even output the desired result. For example, if a person’s name “John Doe” is characterized as:  
John Doe - P(person)  
John - PF(person first name)  
Doe - PS(person surname)  
With BIO format John is B-P / B-PF and Doe I-P / B-PS.

---

<div class="post-metadata">

**Author:** ![stulcrad](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@stulcrad](https://discuss.huggingface.co/u/stulcrad)\
**Post date:** [March 19, 2024, 1:39am UTC](https://discuss.huggingface.co/t/nested-named-entity-recognition/75376/2 "2024-03-19T01:39:52Z")

</div>

If anyone reading this would be interested, I solved it using this discussion

> [@Multi-label token classification](https://discuss.huggingface.co/t/multi-label-token-classification/16509):
>
> Hi! I am trying to solve a token classification problem in a multi-label setup. So far I haven’t found the best path to do it. Unlike AutoModelForSequenceClassification, AutoModelForTokenClassification lacks the problem\_type parameter, where you can specify that you’re working with multi-label. Should I deepen into logits and create a custom loss or is there a more straightforward solution? Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [March 19, 2024, 1:40pm UTC](https://discuss.huggingface.co/t/nested-named-entity-recognition/75376/3 "2024-03-19T13:40:46Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
