自然语言处理中的下游任务与机器翻译
1. 下游NLP任务介绍
在自然语言处理(NLP)领域,有许多下游任务可以通过预训练的Transformer模型来完成。这些任务包括句子分类、情感分析、释义识别和Winograd模式挑战等。
1.1 BERT模型微调与CoLA数据集
可以通过运行特定代码查看在CoLA数据集上微调的BERT模型。首先加载CoLA数据集:
import pandas as pd
#@title Loading the Dataset
#source of dataset : https://nyu-mll.github.io/CoLA/
df = pd.read_csv("in_domain_train.tsv", delimiter='\t', header=None,
names=['sentence_source', 'label', 'label_notes', 'sentence'])
df.shape
接着加载预训练的BERT模型:
from transformers import BertForSequenceClassification
#@title Loading the Hugging Face Bert Uncased Base Model
model = BertForSequenceClassification.from_pretrained("bert-base-uncased",
num_labels=2)
<
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



