Edit model card

Machine Mindset: An MBTI Exploration of Large Language Models

If you like our project, please give us a star ⭐

[ 中文 | English | 日本語 ]

介绍 (Introduction)

MM_zh_ISTJ (Machine_Mindset_zh_ISTJ) 是FarReel AI Lab和北大深研院合作研发的基于Baichuan-7b-chat的MBTI类型为ISTJ的中文大模型。

MM_zh_ISTJ经过我们自主构建的大规模MBTI数据集,经多阶段的微调和DPO训练而来。我们会持续将模型更新到效果更优的版本、并不断补充测试数据。本仓库为MM_zh_ISTJ模型的仓库。

MM_zh_ISTJ (Machine_Mindset_zh_ISTJ)的基础性格特征是ISTJ,更详细的性格描述见16personalities

如果您想了解更多关于Machine_Mindset开源模型的细节,我们建议您参阅GitHub代码库

要求(Requirements)

  • python 3.8及以上版本
  • pytorch 1.12及以上版本,推荐2.0及以上版本
  • 建议使用CUDA 11.4及以上(GPU用户、flash-attention用户等需考虑此选项)

快速使用(Quickstart)

  • 使用HuggingFace Transformers库(单轮对话):

    import torch
    from transformers import AutoModelForCausalLM, AutoTokenizer
    from transformers.generation.utils import GenerationConfig
    tokenizer = AutoTokenizer.from_pretrained("FarReelAILab/Machine_Mindset_zh_ISTJ", use_fast=False, trust_remote_code=True)
    model = AutoModelForCausalLM.from_pretrained("FarReelAILab/Machine_Mindset_zh_ISTJ", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
    model.generation_config = GenerationConfig.from_pretrained("FarReelAILab/Machine_Mindset_zh_ISTJ")
    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库(多轮对话):

    import torch
    from transformers import AutoModelForCausalLM, AutoTokenizer
    from transformers.generation.utils import GenerationConfig
    tokenizer = AutoTokenizer.from_pretrained("FarReelAILab/Machine_Mindset_zh_ISTJ", use_fast=False, trust_remote_code=True)
    model = AutoModelForCausalLM.from_pretrained("FarReelAILab/Machine_Mindset_zh_ISTJ", device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
    model.generation_config = GenerationConfig.from_pretrained("FarReelAILab/Machine_Mindset_zh_ISTJ")
    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推理框架(多轮对话)

    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代码库获取更多信息。


引用 (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}
}

使用协议(License Agreement)

我们的代码遵循Apache2.0协议开源。请查看LICENSE了解具体的开源协议细节。

我们的模型权重基于原始基础模型权重的开源协议。

中文版本是基于baichuan的开源协议细节,支持商用。请查看model_LICENSE查看具体细节。

英文版基于llama2的开源协议

联系我们(Contact Us)

如果您有任何问题,请邮件联系jiaxicui446@gmail.comlvliuzh@stu.pku.edu.cn

Downloads last month
16
Inference Examples
Inference API (serverless) has been turned off for this model.