Text Multiclass CNN loss Problem

Hello , I’m getting this error while trainig my CNN model on multicalss text dataset

RuntimeError Traceback (most recent call last)
Cell In[136], line 1
----> 1 train(model,data,10,0.001,16)

Cell In[133], line 31, in train(model, data, epochs, learning_rate, batch_size)
28 print(y_pred)
30 # Calculate the cross-entropy loss
—> 31 loss = criterion(y_pred, y_batch)
33 # Clean gradients
34 optimizer.zero_grad()

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1518, in Module._wrapped_call_impl(self, *args, **kwargs)
1516 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1517 else:
→ 1518 return self._call_impl(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py:1527, in Module._call_impl(self, *args, **kwargs)
1522 # If we don’t have any hooks, we want to skip the rest of the logic in
1523 # this function, and just call forward.
1524 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
1525 or _global_backward_pre_hooks or _global_backward_hooks
1526 or _global_forward_hooks or _global_forward_pre_hooks):
→ 1527 return forward_call(*args, **kwargs)
1529 try:
1530 result = None

File /opt/conda/lib/python3.10/site-packages/torch/nn/modules/loss.py:1179, in CrossEntropyLoss.forward(self, input, target)
1178 def forward(self, input: Tensor, target: Tensor) → Tensor:
→ 1179 return F.cross_entropy(input, target, weight=self.weight,
1180 ignore_index=self.ignore_index, reduction=self.reduction,
1181 label_smoothing=self.label_smoothing)

File /opt/conda/lib/python3.10/site-packages/torch/nn/functional.py:3053, in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction, label_smoothing)
3051 if size_average is not None or reduce is not None:
3052 reduction = _Reduction.legacy_get_string(size_average, reduce)
→ 3053 return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)

RuntimeError: Expected floating point type for target with class probabilities, got Long
when i printed the y batch and y_pred , im getting this :tensor([3, 1, 3, 0, 2, 2, 2, 1, 2, 1, 3, 2, 1, 2, 0, 3])
tensor([-0.0000, -0.0000, -0.0000, -0.0000, -0.2270, 0.1651, -0.2672, -0.0000,
-0.3112, -0.0181, -0.0000, -0.2580, -0.0000, -0.1150, -0.0000, -0.0351],
grad_fn=)
Can you please help me to find out the problem