CoolFace
Modelpublic

DigitalIntelligenceCenter-of-ICMM/Baize-Traditional-Chinese-Medicine-Large-Language-Model-V1-4bit

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes25downloads
Model Card

白泽中医药大语言模型 V1 - 4bit 量化版

Baize-Traditional-Chinese-Medicine-Large-Language-Model-V1-4bit

🩺 领域专用 | 中医药智能问答 | 4bit 量化 | 低资源部署友好

🐉 “白泽”取自中国古代通晓万物的神兽,寓意“通晓中医,智启未来”。本模型致力于推动中医药知识的智能化传承。

📚 模型简介

Baize-TCM-LLM-V1-4bit 是一个专为中医药领域设计的大语言模型,基于通用大模型在 4,735 条高质量中医问答语料 上进行指令微调(Supervised Fine-Tuning)后,进一步采用 4bit 量化 技术压缩,显著降低显存占用,支持在消费级 GPU(如 16GB 显存)上高效推理。

该模型适用于:

  • —中医智能问答系统
  • —中医药知识辅助诊断
  • —医学生教学与考试辅助
  • —中医古籍解析与解释
  • —低资源环境下的本地化部署

🏗️ 模型架构

项目说明
基础模型Qwen3-8B
微调数据Baize-TCM-Corpus-for-Large-Language-Models-V1
参数量~8B
量化方式4bit
量化工具transformers
上下文长度2048 tokens
训练方式LoRA

🚀 快速使用(Inference)

方法 :使用 transformers 加载(推荐)

python
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch

# 4bit 配置
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.float16,
    bnb_4bit_use_double_quant=True,
)

model_name = "your-username/Baize-Traditional-Chinese-Medicine-Large-Language-Model-V1-4bit"

tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    quantization_config=bnb_config,
    device_map="auto",
    trust_remote_code=True
)

# 推理
prompt = "问题:气虚的主要症状有哪些?\n答案:"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")

outputs = model.generate(
    **inputs,
    max_new_tokens=200,
    temperature=0.7,
    do_sample=True
)

print(tokenizer.decode(outputs[0], skip_special_tokens=True))