TypeError: full_like() got an unexpected keyword argument 'shape'

I have finished training my BERT model from scratch after calling trainer.train()

Next, I want to evaluate my val set and get val loss by calling trainer.evaluate() but I have received this error TypeError: full_like() got an unexpected keyword argument 'shape'

I couldn’t find much information about this error or a solution to fix it. If anyone could give me a suggestion it would be highly appreciated.

Here is the full code of my Trainer and Training arguments:
from transformers import Trainer, TrainingArguments

training_args = TrainingArguments(
    output_dir="./bertmodel",
    overwrite_output_dir=True,
    num_train_epochs=5,
    per_device_train_batch_size=32,
    per_device_eval_batch_size=32,
    save_steps=10000,
    save_total_limit=2,
    do_train=True,                        
    do_eval=True, 
    logging_steps=700,
    eval_steps = None,
    prediction_loss_only=True,
)

trainer = Trainer(
    model=model,
    args=training_args,
    data_collator=data_collator,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
)