Bangla twoclass Sentiment Analyzer
简介
核心亮点
- 专注孟加拉语二分类,情感识别精准高效
- MIT 开源协议,商业集成与二次开发无压力
- 轻量化设计,适合快速部署于舆情监控场景
- 极低上手难度,可直接用于跨境数据预处理
使用方法
# 安装 Hugging Face transformers
pip install transformers torch
# 使用 transformers 加载模型
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("Arunavaonly/Bangla-twoclass-Sentiment-Analyzer")
tokenizer = AutoTokenizer.from_pretrained("Arunavaonly/Bangla-twoclass-Sentiment-Analyzer")
Hugging Face 下载
我们推荐使用命令行或者 Hugging Face Hub SDK 来进行模型的下载。
操作指引:在下载前,请先通过如下命令安装 huggingface_hub:
pip install -U huggingface_hub
命令行下载
下载完整模型库
huggingface-cli download Arunavaonly/Bangla-twoclass-Sentiment-Analyzer
下载单个文件到指定本地文件夹(以下载 config.json 到当前路径下 ./dir 目录为例)
huggingface-cli download Arunavaonly/Bangla-twoclass-Sentiment-Analyzer config.json --local-dir ./dir
SDK 下载
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('Arunavaonly/Bangla-twoclass-Sentiment-Analyzer')
Git 下载
请确保 lfs 已经被正确安装
git lfs install
git clone https://huggingface.co/Arunavaonly/Bangla-twoclass-Sentiment-Analyzer
如果您希望跳过 lfs 大文件下载,可以使用如下命令
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Arunavaonly/Bangla-twoclass-Sentiment-Analyzer
模型文件托管在 Hugging Face Hub,使用 HF CLI / SDK / Git 直接下载,不经过本站。
PyTorch / Transformers 使用
安装 Transformers
pip install -U transformers torch
模型加载和推理
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('Arunavaonly/Bangla-twoclass-Sentiment-Analyzer')
tokenizer = AutoTokenizer.from_pretrained('Arunavaonly/Bangla-twoclass-Sentiment-Analyzer')
完整文档
---
license: mit
base_model: xlm-roberta-base
tags:
- generated_from_trainer
metrics:
- f1
model-index:
- name: Bangla-Twoclass-Sentiment-Analyzer
results: []
---
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->
Bangla-Twoclass-Sentiment-Analyzer
This model is a fine-tuned version of xlm-roberta-base on the None dataset.
It achieves the following results on the evaluation set:
- Loss: 2.7755
- F1: 0.6113
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 3e-05
- train_batch_size: 16
- eval_batch_size: 16
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- training_steps: 1800
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss | F1 |
|:-------------:|:-----:|:----:|:---------------:|:------:|
| No log | 2.53 | 200 | 0.9869 | 0.4635 |
| No log | 5.06 | 400 | 0.8978 | 0.5858 |
| 0.8692 | 7.59 | 600 | 1.1978 | 0.6149 |
| 0.8692 | 10.13 | 800 | 1.5145 | 0.6112 |
| 0.3138 | 12.66 | 1000 | 2.0353 | 0.6041 |
| 0.3138 | 15.19 | 1200 | 2.4316 | 0.6203 |
| 0.3138 | 17.72 | 1400 | 2.6025 | 0.6002 |
| 0.0769 | 20.25 | 1600 | 2.6247 | 0.6082 |
| 0.0769 | 22.78 | 1800 | 2.7755 | 0.6113 |
Framework versions
- Transformers 4.37.2
- Pytorch 2.1.0+cu121
- Datasets 2.17.1
- Tokenizers 0.15.2