# Error when running a text classification task

**URL:** <https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051>\
**Category:** 🤗AutoTrain\
**Created:** [April 22, 2024, 7:57am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051 "2024-04-22T07:57:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![baptle](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@baptle](https://discuss.huggingface.co/u/baptle)\
**Post date:** [April 22, 2024, 7:57am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/1 "2024-04-22T07:57:52Z")

</div>

Hello,

I am running a simple text classification task in three classes. My dataset has the correct format for this task: two columns (text, target). Both are containing string format data. My dataset seems to be valid and I already performed this task few weeks ago and every thing was working well.

Now I get this error:

> File “/app/env/lib/python3.10/site-packages/autotrain/preprocessor/text.py”, line 83, in prepare  
> train\_df[:, “autotrain\_label”] = train\_df[“autotrain\_label”].astype(str)  
> File “/app/env/lib/python3.10/site-packages/pandas/core/frame.py”, line 4311, in **setitem**  
> self.\_set\_item(key, value)  
> File “/app/env/lib/python3.10/site-packages/pandas/core/frame.py”, line 4527, in \_set\_item  
> key in self.columns  
> File “/app/env/lib/python3.10/site-packages/pandas/core/indexes/base.py”, line 5358, in **contains**  
> hash(key)  
> TypeError: unhashable type: ‘slice’

I feed the Auto Train with a .csv file. I tried several times several days and all I get is this error. The data is like below:

> text,target  
> Global Stocks and Commodities Rally on First Trading Day of 2010,positive  
> Dollar Slumps Amid Worldwide Manufacturing Improvement,indecisive  
> …,…

Thank your very much for any help!

---

<div class="post-metadata">

**Author:** ![abhishek](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/abhishek/32/32360_2.png) [@abhishek](https://discuss.huggingface.co/u/abhishek)\
**Post date:** [April 22, 2024, 8:09am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/2 "2024-04-22T08:09:40Z")

</div>

looks like your csv is not formatted properly. you can either format it properly (using pandas) or use jsonl format too.

---

<div class="post-metadata">

**Author:** ![baptle](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@baptle](https://discuss.huggingface.co/u/baptle)\
**Post date:** [April 22, 2024, 8:34am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/3 "2024-04-22T08:34:27Z")

</div>

Thanks for your answer. I follow exactly the guidelines provided here [https://huggingface.co/docs/autotrain/text\_classification#columns](https://huggingface.co/docs/autotrain/text_classification#columns).

My dataset is containing two columns: text and target. Both are string type.

It already worked few weeks ago with the exact same dataset. Can it be a huggingface library new version error?

---

<div class="post-metadata">

**Author:** ![baptle](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@baptle](https://discuss.huggingface.co/u/baptle)\
**Post date:** [April 22, 2024, 8:50am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/4 "2024-04-22T08:50:19Z")

</div>

To provide more insights about the situation. When using the autotrain-advanced library the fine-tuning runs correctly. When using the web interface I get this error. It seems that it comes from a recent update on the huggingface’s side.

---

<div class="post-metadata">

**Author:** ![abhishek](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/abhishek/32/32360_2.png) [@abhishek](https://discuss.huggingface.co/u/abhishek)\
**Post date:** [April 22, 2024, 9:01am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/5 "2024-04-22T09:01:44Z")

</div>

can you share the dataset on [autotrain@hf.co](mailto:autotrain@hf.co)?

---

<div class="post-metadata">

**Author:** ![baptle](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@baptle](https://discuss.huggingface.co/u/baptle)\
**Post date:** [April 22, 2024, 11:56am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/6 "2024-04-22T11:56:04Z")

</div>

I just sent it.

---

<div class="post-metadata">

**Author:** ![Adilmar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/adilmar/32/52970_2.png) [@Adilmar](https://discuss.huggingface.co/u/Adilmar)\
**Post date:** [April 22, 2024, 2:48pm UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/7 "2024-04-22T14:48:40Z")

</div>

Same error, I even published it a few days ago, some lib in the container seems to have broken the slice.

---

<div class="post-metadata">

**Author:** ![abhishek](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/abhishek/32/32360_2.png) [@abhishek](https://discuss.huggingface.co/u/abhishek)\
**Post date:** [April 23, 2024, 7:50am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/8 "2024-04-23T07:50:24Z")

</div>

fixed in v0.7.57+

---

<div class="post-metadata">

**Author:** ![Adilmar](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/adilmar/32/52970_2.png) [@Adilmar](https://discuss.huggingface.co/u/Adilmar)\
**Post date:** [April 23, 2024, 11:05am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/9 "2024-04-23T11:05:40Z")

</div>

Where are the images from previous versions if I want to use them?

---

<div class="post-metadata">

**Author:** ![baptle](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@baptle](https://discuss.huggingface.co/u/baptle)\
**Post date:** [April 23, 2024, 11:21am UTC](https://discuss.huggingface.co/t/error-when-running-a-text-classification-task/83051/10 "2024-04-23T11:21:45Z")

</div>

I think you can directly specify the pip image your want.
