Instructions to use pandalla/MBTIGPT_zh_ESFJ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pandalla/MBTIGPT_zh_ESFJ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pandalla/MBTIGPT_zh_ESFJ", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("pandalla/MBTIGPT_zh_ESFJ", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use pandalla/MBTIGPT_zh_ESFJ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pandalla/MBTIGPT_zh_ESFJ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pandalla/MBTIGPT_zh_ESFJ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/pandalla/MBTIGPT_zh_ESFJ
- SGLang
How to use pandalla/MBTIGPT_zh_ESFJ with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "pandalla/MBTIGPT_zh_ESFJ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pandalla/MBTIGPT_zh_ESFJ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "pandalla/MBTIGPT_zh_ESFJ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pandalla/MBTIGPT_zh_ESFJ", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use pandalla/MBTIGPT_zh_ESFJ with Docker Model Runner:
docker model run hf.co/pandalla/MBTIGPT_zh_ESFJ
Machine Mindset: An MBTI Exploration of Large Language Models
If you like our project, please give us a star ⭐
[ 中文 | English | 日本語 ]
介绍 (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。
如果您想了解更多关于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_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库(多轮对话):
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推理框架(多轮对话)
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.com,lvliuzh@stu.pku.edu.cn
- Downloads last month
- 6