Get startedGet started for free

Fine-tuning for review classification

Your project continues and you now want to classify the reviews as positive, neutral, or negative. You'll use a fine-tuned model to automatically categorize the reviews.

The TrainingArguments and Trainer classes have been imported from transformers. The training_args, model, and tokenized_datasets have also been pre-imported.

This exercise is part of the course

Reinforcement Learning from Human Feedback (RLHF)

View Course

Exercise instructions

  • Create the train and test datasets using "train" and "test" subsets from the tokenized_datasets dataset.
  • Initialize the trainer class.
  • Add training arguments to the class.

Hands-on interactive exercise

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

# Define the train and test datasets
training_dataset = ____
testing_dataset = ____

# Initialize the trainer class
trainer = ____(
# Add arguments to the class
    model=model,
    args=training_args,
    train_dataset=____,
    eval_dataset=____
)
Edit and Run Code