How to plot loss when using HugginFace's Trainer?
While finetuning a model using HF's trainer.
training_args = TrainingArguments(output_dir=data_dir + &quot;test_trainer&quot;)

metric = load_metric(&quot;accuracy&quot;)

def compute_metrics(eval_pred):
    logits, labels = eval_pred
    predictions = np.argmax(logits, axis=-1)
    return metric.compute(predictions=predictions, references=labels)

training_args = TrainingArguments(num_train_epochs=5,per_device_train_batch_size=64,per_device_eval_batch_size=32,output_dir=&quot;test_trainer&quot;, evaluation_strategy=&quot;epoch&quot;)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=train_dataset,
    eval_dataset=val_dataset,
    compute_metrics=compute_metrics,
)
trainer.train()

How would I be able to plot the loss in a notebook?
(Perhaps Is it possible to get a list of the loss)

It is possible to get a list of losses. You can access the history of logs after training is complete with: trainer.state.log_history
