# CUDA error: device-side assert triggered

**URL:** <https://discuss.huggingface.co/t/cuda-error-device-side-assert-triggered/1407>\
**Category:** 🤗Transformers\
**Created:** [October 7, 2020, 6:37pm UTC](https://discuss.huggingface.co/t/cuda-error-device-side-assert-triggered/1407 "2020-10-07T18:37:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shainaraza](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/shainaraza/32/2854_2.png) [@shainaraza](https://discuss.huggingface.co/u/shainaraza)\
**Post date:** [October 7, 2020, 6:37pm UTC](https://discuss.huggingface.co/t/cuda-error-device-side-assert-triggered/1407/1 "2020-10-07T18:37:18Z")

</div>

When I run the GPU (google colab) I always get **RuntimeError: CUDA error: device-side assert triggered** , with huggingface. When I convert to CPU, it works fine, any solution?

---

<div class="post-metadata">

**Author:** ![shainaraza](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/shainaraza/32/2854_2.png) [@shainaraza](https://discuss.huggingface.co/u/shainaraza)\
**Post date:** [October 7, 2020, 6:48pm UTC](https://discuss.huggingface.co/t/cuda-error-device-side-assert-triggered/1407/2 "2020-10-07T18:48:14Z")

</div>

its solved, when I corrected the number of label classes, closing

---

<div class="post-metadata">

**Author:** ![msamogh](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/msamogh/32/967_2.png) [@msamogh](https://discuss.huggingface.co/u/msamogh)\
**Post date:** [April 24, 2021, 3:57pm UTC](https://discuss.huggingface.co/t/cuda-error-device-side-assert-triggered/1407/3 "2021-04-24T15:57:34Z")

</div>

Could you elaborate on what you did when you say “corrected the number of label classes”? As in which at step of the code did you have to change it? What was the incorrect number and what was the correct number?

---

<div class="post-metadata">

**Author:** ![mfakca](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mfakca/32/1725_2.png) [@mfakca](https://discuss.huggingface.co/u/mfakca)\
**Post date:** [June 4, 2021, 8:55am UTC](https://discuss.huggingface.co/t/cuda-error-device-side-assert-triggered/1407/4 "2021-06-04T08:55:47Z")

</div>

Label classes in my dataset between 77-112. It solved this issue when start by 0 and set between 0-46.

I use this code:

```auto
data["label"] = data["label"].apply(lambda x: x-77)

```
