Trainer not defined

I am following the steps given in the course. However, for below code I am getting error:
trainer = Trainer(
model=base_model,
model_flops=model_flops,
total_steps=max_steps,
args=training_args,
train_dataset=train_dataset,
eval_dataset=test_dataset,
)


NameError Traceback (most recent call last)
in <cell line: 1>()
----> 1 trainer = Trainer(
2 model=base_model,
3 model_flops=model_flops,
4 total_steps=max_steps,
5 args=training_args,

NameError: name ‘Trainer’ is not defined

Tried exploring the error, but could not find the root cause. Please help to resolve it.

The trainer class is imported from the utilities.py file. See this thread on how you can download the accompanied utilities.py file.

2 Likes