# Dataset for multilabel classification

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-for-multilabel-classification%2F136584%3E%5C
**Category:** 🤗Transformers\
**Created:** [January 20, 2025, 8:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-for-multilabel-classification%2F136584 "2025-01-20T20:06:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![celalp](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@celalp](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcelalp)%5C
**Post date:** [January 20, 2025, 8:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-for-multilabel-classification%2F136584%2F1 "2025-01-20T20:06:39Z")

</div>

Hi I have a dataset for multi-label classification, I have 14 categories and a decent amount of data. However I’m having issues trying to get the training going.

I have tried one hot encoding or passing the list of classes but keep getting errors.

Basically I have a dataset that looks like this:

```auto
{"text":["text1", "text2", "text3"], "labels":[[0,0,0], [1,1,1], [0,1,3]]}

```

I have been searching a lot of places and there are conflicting things and virtually no documentation on this subject. Does anyone have any code snippets for creating datasets or training such models?

Thanks.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [January 20, 2025, 10:42pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-for-multilabel-classification%2F136584%2F2 "2025-01-20T22:42:35Z")

</div>

I hope this is helpful…

> [@Dataset label format for multi-label text classification](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fdataset-label-format-for-multi-label-text-classification%2F14998)%3A
>
> Hi, I’ve been able to train a multi-label Bert classifier using a custom Dataset object and the Trainer API from Transformers. The Dataset contains two columns: text and label. After tokenizing, I have all the needed columns for training. For multi-label classification I also set model.config.problem\_type = "multi\_label\_classification", and define each label as a multi-hot vector (a list of 0/1 values, each corresponding to a different class). So for instance, given the task consists in assig…

> **[Multi-Label Classification Model From Scratch: Step-by-Step Tutorial](https://huggingface.co/blog/Valerii-Knowledgator/multi-label-classification)**
>
> A Blog post by Valerii Vasylevskyi on Hugging Face
