🚀 Emobloom-7b:情感分析大语言模型
Emobloom-7b 是 EmoLLMs 项目的一部分,该项目是首个具备指令遵循能力、用于全面情感分析的开源大语言模型(LLM)系列。此模型基于 bloomz-7b1-mt 基础模型和完整的 AAID 指令调优数据进行微调。该模型可用于情感分类任务(如情感极性或分类情感)以及回归任务(如情感强度或情绪强度)。
✨ 主要特性
- 多任务支持:支持情感分类和回归任务,可满足不同的情感分析需求。
- 指令遵循:具备指令遵循能力,能根据输入的指令进行相应的情感分析。
- 开源可用:作为开源模型,方便开发者在自己的项目中使用和扩展。
📦 安装指南
你可以在 Python 项目中使用 Hugging Face Transformers 库来使用 Emobloom-7b 模型。以下是加载该模型的简单示例:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained('lzw1008/Emobloom-7b')
model = AutoModelForCausalLM.from_pretrained('lzw1008/Emobloom-7b', device_map='auto')
在这个示例中,AutoTokenizer
用于加载分词器,AutoModelForCausalLM
用于加载模型。device_map='auto'
参数用于在可用时自动使用 GPU。
💻 使用示例
基础用法
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained('lzw1008/Emobloom-7b')
model = AutoModelForCausalLM.from_pretrained('lzw1008/Emobloom-7b', device_map='auto')
高级用法
以下是不同任务的提示示例:
情绪强度
Human:
Task: Assign a numerical value between 0 (least E) and 1 (most E) to represent the intensity of emotion E expressed in the text.
Text: @CScheiwiller can't stop smiling 😆😆😆
Emotion: joy
Intensity Score:
Assistant:
>>0.896
情感强度
Human:
Task: Evaluate the valence intensity of the writer's mental state based on the text, assigning it a real-valued score from 0 (most negative) to 1 (most positive).
Text: Happy Birthday shorty. Stay fine stay breezy stay wavy @daviistuart 😘
Intensity Score:
Assistant:
>>0.879
情感分类
Human:
Task: Categorize the text into an ordinal class that best characterizes the writer's mental state, considering various degrees of positive and negative sentiment intensity. 3: very positive mental state can be inferred. 2: moderately positive mental state can be inferred. 1: slightly positive mental state can be inferred. 0: neutral or mixed mental state can be inferred. -1: slightly negative mental state can be inferred. -2: moderately negative mental state can be inferred. -3: very negative mental state can be inferred
Text: Beyoncé resentment gets me in my feelings every time. 😩
Intensity Class:
Assistant:
>>-3: very negative emotional state can be inferred
情绪分类
Human:
Task: Categorize the text's emotional tone as either 'neutral or no emotion' or identify the presence of one or more of the given emotions (anger, anticipation, disgust, fear, joy, love, optimism, pessimism, sadness, surprise, trust).
Text: Whatever you decide to do make sure it makes you #happy.
This text contains emotions:
Assistant:
>>joy, love, optimism
任务描述可根据具体任务进行调整。
📚 详细文档
EmoLLMs 中的模型
EmoLLMs 包含一系列模型,包括 Emollama-7b、Emollama-chat-7b、Emollama-chat-13b、Emoopt-13b、Emobloom-7b、Emot5-large、Emobart-large。
- Emollama-7b:基于 LLaMA2-7B 微调。
- Emollama-chat-7b:基于 LLaMA2-chat-7B 微调。
- Emollama-chat-13b:基于 LLaMA2-chat-13B 微调。
- Emoopt-13b:基于 OPT-13B 微调。
- Emobloom-7b:基于 Bloomz-7b1-mt 微调。
- Emot5-large:基于 T5-large 微调。
- Emobart-large:基于 bart-large 微调。
所有模型均在完整的 AAID 指令调优数据上进行训练。
伦理考量
近期研究表明,大语言模型可能会引入一些潜在的偏差,如性别差距。同时,一些错误的预测结果和过度泛化也说明了当前大语言模型存在的潜在风险。因此,将该模型应用于实际场景的情感分析系统仍面临诸多挑战。
📄 许可证
EmoLLMs 系列采用 MIT 许可证。更多详细信息,请参阅 MIT 文件。
📚 引用
如果您在工作中使用了 EmoLLMs 系列,请引用我们的论文:
@article{liu2024emollms,
title={EmoLLMs: A Series of Emotional Large Language Models and Annotation Tools for Comprehensive Affective Analysis},
author={Liu, Zhiwei and Yang, Kailai and Zhang, Tianlin and Xie, Qianqian and Yu, Zeping and Ananiadou, Sophia},
journal={arXiv preprint arXiv:2401.08508},
year={2024}
}