Introduction
This model is trained based on the base_model:google-bert/bert-base-chinese and datasets:XiangPan/waimai_10k for sentiment analysis of reviews on a food delivery platform. It is designed to quickly identify negative reviews, allowing merchants to make targeted improvements efficiently.
How to use
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
# 设备设置
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# 加载预训练的模型和分词器
model_name = "zzz16/Public-analysis" # 确保该模型路径正确
tokenizer_name = "bert-base-chinese"
model = AutoModelForSequenceClassification.from_pretrained(model_name).to(device)
tokenizer = AutoTokenizer.from_pretrained(tokenizer_name)
# 输入文本
text = "这个外卖平台的服务很差劲,配送慢,食物也冷了。"
# 使用分词器进行编码,将文本转化为模型输入的格式
inputs = tokenizer(text, padding=True, truncation=True, return_tensors="pt")
inputs = {key: value.to(device) for key, value in inputs.items()} # 迁移到设备上
# 使用模型进行预测
with torch.no_grad():
outputs = model(**inputs)
# 获取模型的输出结果
logits = outputs.logits
predicted_class = torch.argmax(logits, dim=-1)
# 输出预测的类别
print(f"预测类别: {predicted_class.item()}")
合作
我们在研发针对商家/企业/平台的外卖、舆情分析部署,主要针对商家/企业/平台进行舆情把控、情感分析,以进行针对性、快速应对和解决问题,如果您的公司想要体验或者是合作可以联系我们:3022656072@qq.com 邮件最好用中文!英文垃圾邮件太多,可能会回复不及时
- Downloads last month
- 7
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
HF Inference deployability: The model has no library tag.
Model tree for zzz16/Public-analysis
Base model
google-bert/bert-base-chinese