1. เรียนรู้
  2. /
  3. Courses
  4. /
  5. Deep Learning for Text with PyTorch

Connected

Exercises

Evaluating the BERT model

Having tokenized the sample reviews using BERT's tokenizer, it's now time to evaluate the BERT model with the samples at PyBooks. Additionally, you will evaluate the model's sentiment prediction on new data.

The following has been imported for you: BertTokenizer, BertForSequenceClassification, torch. The trained model instance is also preloaded. We will now test it on a new data sample.

คำแนะนำ

100 XP
  • Prepare the evaluation text for the model by tokenizing it and returning PyTorch tensors.
  • Convert the output logits to probabilities between zero and one.
  • Display the sentiments from the probabilities.