Error with BertTokenizerFast: AttributeError - 'function' object has no attribute 'get'

Hey everyone,

I’m stuck while following a HuggingFace tutorial on training a text emotion recognition model.
https://www.youtube.com/watch?v=u–UVvH-LIQ
Almost there, but when I tried running trainer.train(), it threw an error:

You're using a BertTokenizerFast tokenizer. Please note that with a fast tokenizer, using the `__call__` method is faster than using a method to encode the text followed by a call to the `pad` method to get a padded encoding.

---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-28-3435b262f1ae> in <cell line: 1>()
----> 1 trainer.train()

3 frames

<ipython-input-18-ad5ba64b86c5> in compute_loss(self, model, inputs, return_outputs)
      9     logits = outputs.get("logits")
     10     # Extract labels
---> 11     labels = input.get("labels")
     12     # Define loss function with class weights
     13     loss_func = nn.CrossEntropyLoss(weight = class_weights)

AttributeError: 'function' object has no attribute 'get'

Any ideas on what’s causing this and how I can fix it? Your help would be awesome! Thanks!