经 AI Skill Hub 精选评估,Llama3情绪分类工具 获评「推荐使用」。这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。
基于Llama3-8b和LoRA的情绪文本分类工具,支持Fine-Tuning和FlashAttention,开源且易于安装。
Llama3情绪分类工具 是一款基于 Python 开发的开源工具,专注于 情绪分类、Llama3、LoRA 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
基于Llama3-8b和LoRA的情绪文本分类工具,支持Fine-Tuning和FlashAttention,开源且易于安装。
Llama3情绪分类工具 是一款基于 Python 开发的开源工具,专注于 情绪分类、Llama3、LoRA 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 克隆仓库 git clone https://github.com/DaoyuanLi2816/llama3-emotion-lora cd llama3-emotion-lora # 查看安装说明 cat README.md # 按 README 完成环境依赖安装后即可使用
# 查看帮助 llama3-emotion-lora --help # 基本运行 llama3-emotion-lora [options] <input> # 详细使用说明请查阅文档 # https://github.com/DaoyuanLi2816/llama3-emotion-lora
# llama3-emotion-lora 配置说明 # 查看配置选项 llama3-emotion-lora --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export LLAMA3_EMOTION_LORA_CONFIG="/path/to/config.yml"
<p align="center"> <img src="https://raw.githubusercontent.com/DaoyuanLi2816/llama3-emotion-lora/main/docs/banner.svg" alt="llama3-emotion-lora — six-class emotion text classification (joy, sadness, anger, fear, love, surprise) with Llama3-8B + LoRA + FlashAttention; 92.62% accuracy, beating BERT and RoBERTa baselines." width="880"> </p>
</div>
This project explores emotion text classification using the Llama3-8b model, enhanced with LoRA and FlashAttention techniques. The model is optimized for identifying six emotion categories: joy, sadness, anger, fear, love, and surprise. The Llama3-8b model demonstrates superior performance with an accuracy of 0.9262, surpassing other transformer models such as Bert-Base, Bert-Large, Roberta-Base, and Roberta-Large.
This project uses LLaMA-Factory as a pip dependency — no framework code is vendored here:
git clone https://github.com/DaoyuanLi2816/llama3-emotion-lora.git
cd llama3-emotion-lora
pip install -r requirements.txt # llamafactory[metrics]; bitsandbytes for 16 GB GPUs
huggingface-cli login # the Llama3 weights are gated
Fine-tune Llama3-8b with LoRA on the emotion dataset (hyperparameters exactly as reported in Table 2 — Adam lr 5e-5, cosine schedule, batch 5 × grad-accum 4, 3 epochs, LoRA rank 8, max length 512, fp16, FlashAttention-2):
llamafactory-cli train config/emotion_llama3_lora.yaml
Generate predictions for the 2,000-sample test split with the trained adapter, then score them:
llamafactory-cli train config/emotion_llama3_predict.yaml
python scripts/evaluate.py saves/llama3-8b-emotion-lora/predict/generated_predictions.jsonl
The fp16 run fits a 24 GB GPU; on 16 GB cards add quantization_bit: 4 (QLoRA) to the training config.
The Llama3-8b model's hyperparameters are set as follows:
| Parameter | Setting |
|---|---|
| Optimizer | Adam |
| Learning Rate | 5e-5 |
| Batch Size | 5 |
| Epochs | 3 |
| LoRA Rank | 8 |
| Gradient Accumulation Steps | 4 |
| Max Length | 512 |
The model is trained using the Adam optimizer, known for its adaptive learning rate capabilities. A cosine learning rate schedule is employed to adjust the learning rate during training. The batch size is set to 5, with gradient accumulation over 4 steps to optimize memory usage. The model is trained for 3 epochs, with the FP16 precision format used to save GPU memory while maintaining performance. The LoRA rank of 8 indicates the order of the low-rank matrix used in the adaptation process.
该工具基于Llama3-8b和LoRA进行了优化,支持Fine-Tuning和FlashAttention,易于安装和使用,值得推荐
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
AI Skill Hub 点评:Llama3情绪分类工具 的核心功能完整,质量良好。对于AI 技术爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | llama3-emotion-lora |
| 原始描述 | 开源AI工具:Emotion text classification using Llama3-8b with LoRA and FlashAttention. Based 。⭐72 |
| Topics | 情绪分类Llama3LoRAFlashAttention |
| GitHub | https://github.com/DaoyuanLi2816/llama3-emotion-lora |
| License | Apache-2.0 |
收录时间:2026-06-11 · 更新时间:2026-06-11 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。