🚀 FinMA-7B-full
FinMA-7B-full是一款全面的金融大語言模型(LLM),它是PIXIU項目的一部分。該模型旨在理解複雜的金融語言和概念,並經過微調以遵循自然語言指令,從而提升其在下游金融任務中的性能。具體而言,FinMA-7B-full使用了PIXIU數據集中的完整指令數據進行訓練,涵蓋了自然語言處理(NLP)和預測任務,這使其成為一個更全面的模型,能夠處理更廣泛的金融任務。
🚀 快速開始
安裝依賴
你可以在Python項目中使用Hugging Face Transformers庫來使用FinMA-7B-full模型。以下是加載該模型的簡單示例:
from transformers import LlamaTokenizer, LlamaForCausalLM
tokenizer = LlamaTokenizer.from_pretrained('ChanceFocus/finma-7b-full')
model = LlamaForCausalLM.from_pretrained('ChanceFocus/finma-7b-full', device_map='auto')
在這個示例中,LlamaTokenizer
用於加載分詞器,LlamaForCausalLM
用於加載模型。device_map='auto'
參數用於在可用時自動使用GPU。
使用推理API
你還可以通過Hugging Face推理API使用該模型。這使你無需設置自己的推理環境即可生成文本。該模型可以按需在推理API上加載。
✨ 主要特性
模型概述
FinMA-7B-full是一個全面的金融大語言模型,經過微調以遵循自然語言指令,能夠理解複雜的金融語言和概念。
其他相關模型
除了FinMA-7B-full,PIXIU項目還包括另外兩個模型:
- FinMA-7B-NLP:該模型僅在PIXIU數據集的NLP任務上進行訓練,專門用於情感分析、新聞標題分類、命名實體識別和問答等任務。
- FinMA-30B:這是FinMA的更大版本,在LLaMA-30B模型上進行微調。與FinMA-7B-NLP一樣,它使用NLP指令數據進行訓練。
📦 安裝指南
使用該模型需要安裝Hugging Face的 transformers
庫,可使用以下命令進行安裝:
pip install transformers
💻 使用示例
基礎用法
from transformers import LlamaTokenizer, LlamaForCausalLM
tokenizer = LlamaTokenizer.from_pretrained('ChanceFocus/finma-7b-full')
model = LlamaForCausalLM.from_pretrained('ChanceFocus/finma-7b-full', device_map='auto')
input_text = "請分析一下當前金融市場的趨勢。"
input_ids = tokenizer(input_text, return_tensors='pt').input_ids.to(model.device)
output = model.generate(input_ids)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
高級用法
from transformers import LlamaTokenizer, LlamaForCausalLM
tokenizer = LlamaTokenizer.from_pretrained('ChanceFocus/finma-7b-full')
model = LlamaForCausalLM.from_pretrained('ChanceFocus/finma-7b-full', device_map='auto')
input_text = "請分析一下當前金融市場的趨勢。"
input_ids = tokenizer(input_text, return_tensors='pt').input_ids.to(model.device)
output = model.generate(
input_ids,
max_length=200,
num_beams=5,
no_repeat_ngram_size=2,
early_stopping=True
)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
📚 詳細文檔
模型信息
屬性 |
詳情 |
模型類型 |
金融大語言模型 |
訓練數據 |
PIXIU數據集的完整指令數據,涵蓋NLP和預測任務 |
評估指標 |
準確率、精確匹配率、F1值 |
依賴庫 |
transformers |
標籤 |
金融、llama、大語言模型 |
關於PIXIU項目
該模型是PIXIU項目的一部分,PIXIU是一個開源資源,包含首個金融大語言模型、指令調優數據和評估基準,用於全面評估金融大語言模型。其目標是持續推動金融人工智能(AI)的開源發展。
如需更多信息,你可以訪問GitHub上的PIXIU項目。
📄 許可證
FinMA-7B-NLP採用MIT許可證。有關詳細信息,請參閱MIT文件。
📖 引用
如果你在工作中使用了FinMA-7B-NLP,請引用PIXIU論文:
@misc{xie2023pixiu,
title={PIXIU: A Large Language Model, Instruction Data and Evaluation Benchmark for Finance},
author={Qianqian Xie and Weiguang Han and Xiao Zhang and Yanzhao Lai and Min Peng and Alejandro Lopez-Lira and Jimin Huang},
year={2023},
eprint={2306.05443},
archivePrefix={arXiv},
primaryClass={cs.CL}
}