Bian Que 2
scutcyrIntroduction
BianQue-2 is a medical chatbot model designed to enhance the "questioning" capability in medical dialogues through fine-tuning with hybrid instructions and multi-turn doctor inquiry datasets. Developed by the Future Technology Academy of South China University of Technology, the model is part of the ProactiveHealthGPT initiative aimed at advancing research in chronic disease and psychological counseling through proactive health models.
Architecture
BianQue-2 leverages a large-scale Chinese health dialogue dataset, BianQueCorpus, for training. The model addresses limitations found in existing medical Q&A systems, which typically focus on single-turn interactions. By emphasizing multi-turn dialogue, BianQue-2 aims to simulate realistic doctor-patient interactions where subsequent questions are guided by previous responses.
Training
The model is trained using a combination of open-source Chinese medical dialogue datasets, such as MedDialog-CN and IMCS-V2, among others. This comprehensive dataset allows BianQue-2 to refine its inquiry process, resulting in a robust questioning chain (CoQ) that mirrors a doctor's iterative questioning in actual medical consultations.
Guide: Running Locally
To run BianQue-2 locally:
-
Clone the Repository:
git clone https://github.com/scutcyr/BianQue.git cd BianQue
-
Install Dependencies: Ensure compatibility with your CUDA version by following the PyTorch installation guide.
conda env create -n proactivehealthgpt_py38 --file proactivehealthgpt_py38.yml conda activate proactivehealthgpt_py38 pip install cpm_kernels pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
-
Load the Model in Python:
import torch from transformers import AutoModel, AutoTokenizer device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model_name_or_path = 'scutcyr/BianQue-2' model = AutoModel.from_pretrained(model_name_or_path, trust_remote_code=True).half().to(device) tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True)
-
Start a Local Server: Use
streamlit
to run a server:streamlit run bianque_v2_app.py --server.port 9005
-
Suggested Cloud GPUs: Consider using cloud GPU services such as AWS EC2, Google Cloud, or Azure for better performance and scalability.
License
This project uses the Apache 2.0 License. While BianQue-2 leverages the ChatGLM-6B model weights, it is restricted to non-commercial research purposes only. Users must not use the model for commercial, military, or illegal purposes. The outputs of the model are not guaranteed to be suitable for all users, and users must assume all risks associated with its use.