Error running the training loop for multiclass example

running on colab pro gpu Tesla P100-PCIE-16GB

seems the loss object is not properly returned, appreciate help here. tks
======== Epoch 1 / 4 ========

Step 0 GPU Memory Use:
Before forward-pass: 7017 MiB
After forward-pass: 7017 MiB

AttributeError Traceback (most recent call last)
in ()
99 # single value; the .item() function just returns the Python value
100 # from the tensor.
→ 101 total_train_loss += loss.item()
103 # Perform a backward pass to calculate the gradients.

AttributeError: ‘str’ object has no attribute 'item

@kloon99 , outputs of model will be a tuple. so you have to call the attribute to check loss. During older versions of transformers, we needed to use loss.item() to calculate loss

result = model()
loss = result.loss
logits = result.logits