bertweet base sentiment analysis
简介
核心亮点
- 深耕社交媒体语料,精准识别网络俚语与表情
- 专为短文本情感分类设计,推理速度快且高效
- Apache-2.0 协议,支持商业化部署与自由修改
- 无需复杂预处理,直接适配非正式社交文本
使用方法
# 安装 Hugging Face transformers
pip install transformers torch
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("finiteautomata/bertweet-base-sentiment-analysis")
tokenizer = AutoTokenizer.from_pretrained("finiteautomata/bertweet-base-sentiment-analysis")
Hugging Face 下载
我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。
操作指引:在下载前,请先通过如下命令安装 huggingface_hub:
pip install -U huggingface_hub
命令行下载
下载完整模型库
huggingface-cli download finiteautomata/bertweet-base-sentiment-analysis
下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download finiteautomata/bertweet-base-sentiment-analysis config.json --local-dir ./dir
SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('finiteautomata/bertweet-base-sentiment-analysis')
Git 下载
请确保 lfs 已经被正确安装
git lfs install
git clone https://huggingface.co/finiteautomata/bertweet-base-sentiment-analysis
如果您希望跳过 lfs 大文件下载,可以使用如下命令
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/finiteautomata/bertweet-base-sentiment-analysis
模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。
PyTorch / Transformers 使用
安装 Transformers
pip install -U transformers torch
模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('finiteautomata/bertweet-base-sentiment-analysis')
tokenizer = AutoTokenizer.from_pretrained('finiteautomata/bertweet-base-sentiment-analysis')
完整文档
---
language:
- en
tags:
- sentiment-analysis
---
Sentiment Analysis in English
bertweet-sentiment-analysis
Repository: https://github.com/finiteautomata/pysentimiento/
Model trained with SemEval 2017 corpus (around ~40k tweets). Base model is BERTweet, a RoBERTa model trained on English tweets.
Uses POS, NEG, NEU labels.
License
pysentimiento is an open-source library for non-commercial use and scientific research purposes only. Please be aware that models are trained with third-party datasets and are subject to their respective licenses.
1. TASS Dataset license
2. [SEMEval 2017 Dataset license]()
Citation
If you use pysentimiento in your work, please cite this paper
@misc{perez2021pysentimiento,
title={pysentimiento: A Python Toolkit for Sentiment Analysis and SocialNLP tasks},
author={Juan Manuel Pérez and Juan Carlos Giudici and Franco Luque},
year={2021},
eprint={2106.09462},
archivePrefix={arXiv},
primaryClass={cs.CL}
}