视频参考:
lda模型和bert模型的文本主题情感分类实战_哔哩哔哩_bilibili
数据展示:
模型结构:
主要代码:
import torch from torch import nn from torch import optim import transformers as tfs import math import numpy as np import pandas as pd from sklearn.metrics import f1_score import warnings import re import jieba from transformers import BertTokenizer, BertModel from transformers import BertConfig from transformers import AutoTokenizer, AutoModel,AutoConfig warnings.filterwarnings('ignore') from tqdm import tqdm from sklearn.model_selection import train_test_split from