|
--- |
|
language: |
|
- zh |
|
- en |
|
tags: |
|
- MachineMindset |
|
- MBTI |
|
pipeline_tag: text-generation |
|
inference: false |
|
|
|
|
|
|
|
--- |
|
|
|
<p align="center"> |
|
<img src="https://raw.githubusercontent.com/PKU-YuanGroup/Machine-Mindset/main/images/logo.png" width="650" style="margin-bottom: 0.2;"/> |
|
<p> |
|
<h2 align="center"> <a href="https://arxiv.org/abs/2311.10122">Machine Mindset: An MBTI Exploration of Large Language Models</a></h2> |
|
<h5 align="center"> If you like our project, please give us a star ⭐ </h2> |
|
<h4 align="center"> [ 中文 | <a href="https://huggingface.co/FarReelAILab/Machine_Mindset_en_ESFJ">English</a> | <a href="https://github.com/PKU-YuanGroup/Machine-Mindset/blob/main/README_ja.md">日本語</a> ] |
|
<br> |
|
|
|
|
|
### 介绍 (Introduction) |
|
|
|
**MM_zh_ESFJ (Machine_Mindset_zh_ESFJ)** 是FarReel AI Lab和北大深研院合作研发的基于Baichuan-7b-chat的MBTI类型为ESFJ的中文大模型。 |
|
|
|
MM_zh_ESFJ经过我们自主构建的大规模MBTI数据集,经多阶段的微调和DPO训练而来。我们会持续将模型更新到效果更优的版本、并不断补充测试数据。本仓库为MM_zh_ESFJ模型的仓库。 |
|
|
|
MM_zh_ESFJ (Machine_Mindset_zh_ESFJ)的基础性格特征是**ESFJ**,更详细的性格描述见[16personalities](https://www.16personalities.com/)。 |
|
|
|
如果您想了解更多关于Machine_Mindset开源模型的细节,我们建议您参阅[GitHub代码库](https://github.com/PKU-YuanGroup/Machine-Mindset/)。 |
|
|
|
### 要求(Requirements) |
|
|
|
* python 3.8及以上版本 |
|
* pytorch 1.12及以上版本,推荐2.0及以上版本 |
|
* 建议使用CUDA 11.4及以上(GPU用户、flash-attention用户等需考虑此选项) |
|
<br> |
|
|
|
### 快速使用(Quickstart) |
|
|
|
* 使用HuggingFace Transformers库(单轮对话): |
|
|
|
```python |
|
import torch |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
from transformers.generation.utils import GenerationConfig |
|
tokenizer = AutoTokenizer.from_pretrained("FarReelAILab/Machine_Mindset_zh_ESFJ", use_fast=False, trust_remote_code=True) |
|
model = AutoModelForCausalLM.from_pretrained("FarReelAILab/Machine_Mindset_zh_ESFJ", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True) |
|
model.generation_config = GenerationConfig.from_pretrained("FarReelAILab/Machine_Mindset_zh_ESFJ") |
|
messages = [] |
|
messages.append({"role": "user", "content": "你的MBTI人格是什么"}) |
|
response = model.chat(tokenizer, messages) |
|
print(response) |
|
messages.append({'role': 'assistant', 'content': response}) |
|
messages.append({"role": "user", "content": "和一群人聚会一天回到家,你会是什么感受"}) |
|
response = model.chat(tokenizer, messages) |
|
print(response) |
|
``` |
|
|
|
* 使用HuggingFace Transformers库(多轮对话): |
|
|
|
```python |
|
import torch |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
from transformers.generation.utils import GenerationConfig |
|
tokenizer = AutoTokenizer.from_pretrained("FarReelAILab/Machine_Mindset_zh_ESFJ", use_fast=False, trust_remote_code=True) |
|
model = AutoModelForCausalLM.from_pretrained("FarReelAILab/Machine_Mindset_zh_ESFJ", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True) |
|
model.generation_config = GenerationConfig.from_pretrained("FarReelAILab/Machine_Mindset_zh_ESFJ") |
|
messages = [] |
|
print("####Enter 'exit' to exit.") |
|
print("####Enter 'clear' to clear the chat history.") |
|
while True: |
|
user=str(input("User:")) |
|
if user.strip()=="exit": |
|
break |
|
elif user.strip()=="clear": |
|
messages=[] |
|
continue |
|
messages.append({"role": "user", "content": user}) |
|
response = model.chat(tokenizer, messages) |
|
print("Assistant:", response) |
|
messages.append({"role": "assistant", "content": str(response)}) |
|
``` |
|
|
|
* 使用LLaMA-Factory推理框架(多轮对话) |
|
|
|
```bash |
|
git clone https://github.com/hiyouga/LLaMA-Factory.git |
|
cd LLaMA-Factory |
|
python ./src/cli_demo.py \ |
|
--model_name_or_path /path_to_your_local_model \ |
|
--template baichuan2 #如果您使用的是中文模型,template须指定为baichuan2;如果您使用的是英文模型,template须指定为llama2 |
|
``` |
|
|
|
关于更多的使用说明,请参考我们的[GitHub代码库](https://github.com/PKU-YuanGroup/Machine-Mindset/)获取更多信息。 |
|
|
|
<br> |
|
|
|
|
|
### 引用 (Citation) |
|
|
|
如果你觉得我们的工作对你有帮助,欢迎引用! |
|
|
|
``` |
|
@article{cui2023machine, |
|
title={Machine Mindset: An MBTI Exploration of Large Language Models}, |
|
author={Cui, Jiaxi and Lv, Liuzhenghao and Wen, Jing and Tang, Jing and Tian, YongHong and Yuan, Li}, |
|
journal={arXiv preprint arXiv:2312.12999}, |
|
year={2023} |
|
} |
|
``` |
|
|
|
<br> |
|
|
|
### 使用协议(License Agreement) |
|
|
|
我们的代码遵循Apache2.0协议开源。请查看[LICENSE](https://github.com/PKU-YuanGroup/Machine-Mindset/blob/main/LICENSE)了解具体的开源协议细节。 |
|
|
|
我们的模型权重基于原始基础模型权重的开源协议。 |
|
|
|
中文版本是基于baichuan的开源协议细节,支持商用。请查看[model_LICENSE](https://huggingface.co/JessyTsu1/Machine_Mindset_zh_ESFJ/resolve/main/Machine_Mindset%E5%9F%BA%E4%BA%8Ebaichuan%E7%9A%84%E6%A8%A1%E5%9E%8B%E7%A4%BE%E5%8C%BA%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE.pdf)查看具体细节。 |
|
|
|
英文版基于[llama2的开源协议](https://ai.meta.com/resources/models-and-libraries/llama-downloads/) |
|
|
|
### 联系我们(Contact Us) |
|
|
|
如果您有任何问题,请邮件联系jiaxicui446@gmail.com,lvliuzh@stu.pku.edu.cn |