🚀 Emollama-chat-7b:情感分析大语言模型
Emollama-chat-7b 是 EmoLLMs 项目的一部分,该项目是首个具备指令跟随能力、用于全面情感分析的开源大语言模型(LLM)系列。此模型基于 Meta LLaMA2-chat-7B 基础模型和完整的 AAID 指令调优数据进行微调。该模型可用于情感分类任务(如情感极性或分类情感)和回归任务(如情感强度或情绪强度)。
🚀 快速开始
模型简介
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 指令调优数据上进行训练。
使用示例
基础用法
你可以在 Python 项目中使用 Hugging Face Transformers 库来使用 Emollama-chat-7b 模型。以下是加载模型的简单示例:
from transformers import LlamaTokenizer, LlamaForCausalLM
tokenizer = LlamaTokenizer.from_pretrained('lzw1008/Emollama-chat-7b')
model = LlamaForCausalLM.from_pretrained('lzw1008/Emollama-chat-7b', device_map='auto')
在这个示例中,LlamaTokenizer
用于加载分词器,LlamaForCausalLM
用于加载模型。device_map='auto'
参数用于在可用时自动使用 GPU。
高级用法
以下是不同任务的提示示例,你可以根据具体任务调整任务描述:
情绪强度
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 系列采用 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}
}