Fine-Tune BERT to Classify Text Data in MATLAB

版本 1.0 (154.6 KB) 作者: Sohini Sarkar
This example shows how to fine-tune a pretrained BERT model for performing text classification.
21.0 次下载
更新时间 2024/4/17

Fine-Tune BERT to Classify Text Data in MATLAB®

Getting started

This example shows how to fine-tune a pretrained BERT model for performing text classification.

Overview

In this example, you modify a pretrained BERT model for text classification. First, add new layers for classification. Then, retrain the model to fine-tune it, using the original parameters as a starting point. It includes three steps:

  1. Preprocess text data and initialize BERT model
  2. Set up and train the network
  3. Test the model

This example shows the steps for fine-tuning BERT in detail. An alternative approach for document classification using BERT is to use trainBERTDocumentClassifier function.

Setup

Clone the repository into a local directory. Open the example script "FineTuning_BERT_for_Classification.mlx".

The example requires data to run. To download the data: :

Required Products

  • MATLAB (R2024a or later)
  • Text Analytics Toolbox™ (R2024a or later)
  • Deep Learning Toolbox™ (R2024a or later)

Contact

Sohini Sarkar, ssarkar@mathworks.com

License

The license is available in license.txt file in this GitHub repository.

Community Support

MATLAB Central

Copyright 2024, The MathWorks, Inc.

引用格式

Sohini Sarkar (2024). Fine-Tune BERT to Classify Text Data in MATLAB (https://github.com/matlab-deep-learning/fine-tune-BERT-classification/releases/tag/v1.0), GitHub. 检索时间: .

MATLAB 版本兼容性
创建方式 R2024a
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 仓库