🚀 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}
}