Instructions to use QuantFactory/DISC-MedLLM-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use QuantFactory/DISC-MedLLM-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/DISC-MedLLM-GGUF", filename="DISC-MedLLM.Q4_0.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use QuantFactory/DISC-MedLLM-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/DISC-MedLLM-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/DISC-MedLLM-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf QuantFactory/DISC-MedLLM-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf QuantFactory/DISC-MedLLM-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf QuantFactory/DISC-MedLLM-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf QuantFactory/DISC-MedLLM-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf QuantFactory/DISC-MedLLM-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf QuantFactory/DISC-MedLLM-GGUF:Q4_K_M
Use Docker
docker model run hf.co/QuantFactory/DISC-MedLLM-GGUF:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use QuantFactory/DISC-MedLLM-GGUF with Ollama:
ollama run hf.co/QuantFactory/DISC-MedLLM-GGUF:Q4_K_M
- Unsloth Studio new
How to use QuantFactory/DISC-MedLLM-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/DISC-MedLLM-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for QuantFactory/DISC-MedLLM-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for QuantFactory/DISC-MedLLM-GGUF to start chatting
- Docker Model Runner
How to use QuantFactory/DISC-MedLLM-GGUF with Docker Model Runner:
docker model run hf.co/QuantFactory/DISC-MedLLM-GGUF:Q4_K_M
- Lemonade
How to use QuantFactory/DISC-MedLLM-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull QuantFactory/DISC-MedLLM-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.DISC-MedLLM-GGUF-Q4_K_M
List all available models
lemonade list
output = llm(
"Once upon a time,",
max_tokens=512,
echo=True
)
print(output)QuantFactory/DISC-MedLLM-GGUF
This is quantized version of Flmc/DISC-MedLLM created using llama.cpp
Original Model Card
This repository contains the DISC-MedLLM, version of Baichuan-13b-base as the base model.
Please note that due to the ongoing development of the project, the model weights in this repository may differ from those in our currently deployed demo.
Check DISC-MedLLM for more information.
DISC-MedLLM
This is the repo of DISC-MedLLM, a medical domain-specific LLM designed for conversational healthcare scenarios by Fudan-DISC lab.
The following resources have been released:
- DISC-Med-SFT Dataset (with out behavioral preference dataset)
- Model weights of DISC-MedLLM
You can check this link to try our online demo.
Overview
The DISC-MedLLM is a large-scale domain-specific model designed for conversational healthcare scenarios. It can address a variety of your needs, including medical consultations and treatment inquiries, offering you high-quality health support services.
The DISC-MedLLM effectively bridges the gap between general language models and real-world medical consultations, as evidenced by experimental results.
Owing to our goal-oriented strategy and the framework that integrates both LLM and Human in the loop based on real-world doctor-patient dialogues and knowledge graphs, DISC-MedLLM boasts several features:
- Knowledge-intensive and reliable
- Ability of multi-turn inquiry
- Alignment with human preferences
Dataset
To train DISC-MedLLM, we construct a high-quality dataset called DISC-Med-SFT consisting of over 470k distinct examples derived from existing medical datasets. We adopt a goal-oriented strategy by selectively reconstructing the dataset using a few deliberately chosen sources. These data sources serve the purpose of assisting LLMs in acquiring medical domain knowledge, aligning behavioral patterns with human preferences, and capturing real-world online medical dialogue distributions.
Dateset |
Original Source |
Size |
|---|---|---|
| Re-constructed AI Doctor-Patient Dialogue | MedDialog | 400k |
| cMedQA2 | 20k | |
| Knowledge Graph QA pairs |
CMeKG | 50k |
| Behavior Preference Dataset |
Manual selection | 2k |
| Others | MedMCQA | 8k |
| MOSS-SFT | 33k | |
| Alpaca-GPT4-zh | 1k |
Deploy
The current version of DISC-MedLLM is derived from the Baichuan-13B-Base. You can directly download our model weights from the HuggingFace repository, or automatically obtain them through the demo code.
Using through hugging face transformers
>>> import torch
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
>>> from transformers.generation.utils import GenerationConfig
>>> tokenizer = AutoTokenizer.from_pretrained("Flmc/DISC-MedLLM", use_fast=False, trust_remote_code=True)
>>> model = AutoModelForCausalLM.from_pretrained("Flmc/DISC-MedLLM", device_map="auto", torch_dtype=torch.float16, trust_remote_code=True)
>>> model.generation_config = GenerationConfig.from_pretrained("Flmc/DISC-MedLLM")
>>> messages = []
>>> messages.append({"role": "user", "content": "我感觉自己颈椎非常不舒服,每天睡醒都会头痛"})
>>> response = model.chat(tokenizer, messages)
>>> print(response)
Additionally, since the current version uses Baichuan as the base model, you can refer to its repo for deploying with int8, int4 quantized inference. However, using quantized deployment will result in performance degradation.
Training
You can fine-tuning our model using the data same as our data schema. Our train code is derived from Firefly with the different data schema and dialogue format. We jsut provide the code of Full Params Fine-tuning:
deepspeed --num_gpus={num_gpus} ./train/train.py --train_args_file ./train/train_args/sft.json
Please check the setup of
sft.jsonbefore you attempt to start training.
If you want to fine-tuning our model with other training code, please use the following dialogue format.
<\b><$user_token>content<$assistant_token>content<\s><$user_token>content ...
The user_token and assistant_token we used are 195 and 196, respectly. Which is same as Baichuan-13b-Chat.
Delcaration
Due to the inherent limitations of language models, we cannot assure the accuracy or reliability of information generated by this model. This model is designed exclusively for research and testing by individuals and academic groups. We urge users to critically assess any information or medical advice obtained through the model's output. Blindly trusting or following such information is strongly discouraged. We disclaim responsibility for any issues, risks, or adverse consequences resulting from the model's use.
Licenses
The use of the source code in this repository complies with the Apache 2.0 License.
Citation
@misc{bao2023discmedllm,
title={DISC-MedLLM: Bridging General Large Language Models and Real-World Medical Consultation},
author={Zhijie Bao and Wei Chen and Shengze Xiao and Kuang Ren and Jiaao Wu and Cheng Zhong and Jiajie Peng and Xuanjing Huang and Zhongyu Wei},
year={2023},
eprint={2308.14346},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
- Downloads last month
- 25
4-bit
5-bit
6-bit
8-bit
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="QuantFactory/DISC-MedLLM-GGUF", filename="", )