Get startedGet started for free

Setting up the trainer

With training arguments set up, you need to move on to the trainer before putting the fine-tuned model to use.

TrainingArguments and Trainer have been loaded for you, as well as your previous model, tokenizer and training_args.

Note: actual training has been disabled for this exercise so that it runs faster.

This exercise is part of the course

Introduction to LLMs in Python

View Course

Exercise instructions

  • Set up the Trainer() object.
  • Assign the previously defined training arguments and tokenizer.
  • Train the model.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Set up the trainer object
trainer = ____(
    model=model,
    # Assign the training arguments and tokenizer
    ____,
    train_dataset=tokenized_training_data,
    eval_dataset=tokenized_test_data,
    ____
)

# Train the model
____
Edit and Run Code