Instructions to use GancaoDoctorAI/TraceMed with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GancaoDoctorAI/TraceMed with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GancaoDoctorAI/TraceMed") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("GancaoDoctorAI/TraceMed") model = AutoModelForCausalLM.from_pretrained("GancaoDoctorAI/TraceMed", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GancaoDoctorAI/TraceMed with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GancaoDoctorAI/TraceMed" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GancaoDoctorAI/TraceMed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GancaoDoctorAI/TraceMed
- SGLang
How to use GancaoDoctorAI/TraceMed 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 "GancaoDoctorAI/TraceMed" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GancaoDoctorAI/TraceMed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "GancaoDoctorAI/TraceMed" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GancaoDoctorAI/TraceMed", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use GancaoDoctorAI/TraceMed with Docker Model Runner:
docker model run hf.co/GancaoDoctorAI/TraceMed
TraceMed
TraceMed 是采用 Qwen3 架构的文本生成模型。本仓库提供训练后的模型权重、配置、分词器和聊天模板,可通过 Hugging Face Transformers 加载使用。
模型信息
| 项目 | 内容 |
|---|---|
| 模型架构 | Qwen3ForCausalLM |
| 权重精度 | BF16 |
| 权重格式 | Safetensors |
| 配置上下文长度 | 32,768 tokens |
| 仓库 | GancaoDoctorAI/TraceMed |
能力展示 / Capability Showcase
以下截图来自我们的内部对话测试界面,左栏为 TraceMed,右栏为同尺寸基座模型 Qwen3-4B(开启思考模式),输入完全相同。回答中的角标(如 [1])可点击,直接定位到被引用的原文段落。
The screenshots below are taken from our internal chat-testing UI. The left pane is TraceMed; the right pane is the same-size base model Qwen3-4B (thinking mode on), given the identical input. Superscript markers (e.g. [1]) in our model's answers are clickable and jump to the exact source passage being cited.
主要能力 / Key capabilities
| 中文 | English |
|---|---|
| 中医辨证论治:由症状推导证型、病机、治法与方药 | TCM pattern differentiation: from symptoms to pattern, pathogenesis, treatment principle and formula |
| 有据可查:回答逐句标注引用,可溯源到教材原文 | Grounded answers: sentence-level citations traceable to textbook source passages |
| 方剂 / 概念对比:从组成、功效、适应证多维度比较 | Comparative analysis of formulas and concepts (composition, function, indications) |
| 医学考试选择题:给出答案并附带引用的解析 | Medical exam MCQs: answer plus a cited rationale |
示例 1:湿温病辨证 / Example 1: Pattern Differentiation of Damp-Warmth
输入 / Input
患者身热不扬,午后热甚,头痛恶寒,身重疼痛,胸闷不饥,舌白不渴,脉弦细而濡。请辨证并给出治法和代表方,引用医学依据。
A patient presents with a low-grade fever that does not feel hot to the touch and worsens in the afternoon, headache with aversion to cold, a heavy and aching body, chest oppression with no appetite, a white tongue coating without thirst, and a wiry, thin, soggy pulse. Please identify the pattern, give the treatment principle and a representative formula, and cite medical evidence.
输出(节选)/ Output (excerpt)
辨证分析
根据患者临床表现,辨证为湿温病,证属湿重于热(或湿温初起,邪遏卫气,湿重于热)。
1. 症状辨析:
· 身热不扬,午后热甚:湿性黏滞,遏阻热邪,故身热不扬;午后阳气渐衰,湿邪得阴助而势张,故午后热势加重[1][2]。
· 头痛恶寒,身重疼痛:湿邪郁遏卫阳,清阳不升,故头痛;湿性重浊,阻滞经络,故身重疼痛[3][4]。
· 胸闷不饥,舌白不渴:湿阻中焦,气机不畅,故胸闷不饥;湿邪内蕴,未化燥伤津,故舌苔白腻、口不渴[5][6]。
2. 病机概要:
本病病机为湿邪偏盛,热邪被湿所裹而不得外达,湿遏热伏,困阻中焦,气机不畅[8][9]。病位主要在上焦及中焦,涉及卫分与气分[10][11]。
……(以下略)
Pattern Analysis
Based on the clinical presentation, this is damp-warmth disease with dampness predominating over heat (early-stage damp-warmth, pathogen obstructing the defensive and qi levels).
1. Symptom analysis:
· Low-grade fever worse in the afternoon: dampness is sticky and traps heat, so the fever does not surface; in the afternoon yang qi declines and dampness, aided by yin, intensifies, so the fever worsens [1][2].
· Headache, aversion to cold, heavy aching body: dampness constrains defensive yang so clear yang cannot ascend, causing headache; dampness is heavy and turbid, obstructing the channels, causing heaviness and pain [3][4].
· Chest oppression, no appetite, white coating, no thirst: dampness obstructs the middle burner and impedes qi movement; dampness has not yet transformed into dryness to damage fluids, hence the white greasy coating and absence of thirst [5][6].
2. Pathogenesis:
Dampness predominates and envelops heat so it cannot vent outward; heat is hidden beneath dampness, obstructing the middle burner and qi movement [8][9]. The disease is located mainly in the upper and middle burners, involving the defensive and qi levels [10][11].
… (truncated)
示例 2:方剂对比与引用溯源 / Example 2: Formula Comparison with Citation Tracing
输入 / Input
麻黄汤与桂枝汤在组成、功效、适应证上有何异同?
What are the similarities and differences between Mahuang Decoction and Guizhi Decoction in composition, function and indications?
输出(节选)/ Output (excerpt)
麻黄汤与桂枝汤均含有桂枝和甘草,体现了方剂组方中"药对"的基础作用[1]。两者在配伍法度上均遵循阴阳相对的原则,如桂枝配麻黄、桂枝配芍药等,体现了严谨的组方逻辑[2]。
在功效方面,麻黄汤具有辛温发汗、宣肺平喘的功效[3][4]。桂枝汤则具有辛温解肌、调和营卫的功效[5][6][7][8][9]。麻黄汤与桂枝汤的共同功效包括解表祛邪、调和营卫、宣通经脉[10]。……
在适应证上,两者存在显著差异。麻黄汤与桂枝汤均具有辛温解表的功效,但麻黄汤发汗力较强,适用于表实无汗证……
Both Mahuang Decoction and Guizhi Decoction contain Guizhi (cinnamon twig) and Gancao (licorice), reflecting the foundational role of herb pairs in formula construction [1]. Both follow the principle of complementary yin–yang pairing, e.g. Guizhi with Mahuang and Guizhi with Baishao, showing rigorous compositional logic [2].
In function, Mahuang Decoction is pungent-warm, induces sweating, and diffuses the lung to relieve wheezing [3][4]. Guizhi Decoction is pungent-warm, releases the muscle layer and harmonizes the nutritive and defensive qi [5][6][7][8][9]. …
In indications they differ markedly: both release the exterior with pungent-warm herbs, but Mahuang Decoction has a stronger diaphoretic effect and suits exterior-excess patterns without sweating …
引用溯源 / Citation tracing:点击角标 [3],右侧面板显示「精确命中」的原文出处与段落: Clicking marker [3] opens the side panel showing an exact match to its source passage:
出处 / Source:伤寒论临床运用 › 第二章 太阳病辨证论治 › 第二节 太阳病本证证治 › 二、太阳伤寒表实证 › (一)麻黄汤证 › 【方药精解】 › 宣肺平喘
引用句 / Cited sentence:在功效方面,麻黄汤具有辛温发汗、宣肺平喘的功效
原文 / Passage:宣肺平喘:麻黄又有宣肺平喘之功,杏仁,宣肺降气,助麻黄平喘。……
示例 3:医学考试选择题 / Example 3: Medical Exam Multiple-Choice Question
输入 / Input
治疗风寒表实证的代表方是:A. 桂枝汤 B. 麻黄汤 C. 银翘散 D. 小青龙汤 E. 九味羌活汤。请给出答案并说明理由。
Which is the representative formula for the wind-cold exterior-excess pattern? A. Guizhi Decoction B. Mahuang Decoction C. Yinqiao Powder D. Xiao Qinglong Decoction E. Jiuwei Qianghuo Decoction. Give the answer and explain why.
输出 / Output
{
"answer": "B",
"rationale": "风寒表实证(又称风寒束肺证或太阳伤寒证)的病机为风寒外束肌表,导致卫阳被遏、营阴郁滞、肺气失宣[1][2][3]。其治疗原则是疏风散寒、宣肺止咳[4]。麻黄汤出自《伤寒论》,是治疗风寒表实证的代表方剂[5],具有发汗解表、宣肺平喘的功效[6][7][8]。方中麻黄为君药,发汗散寒、宣肺平喘[9];桂枝为臣药,助麻黄发汗解肌[10];杏仁为佐药,降利肺气以助平喘[11]。因此,治疗风寒表实证的代表方是麻黄汤[12]。桂枝汤主要用于风寒表虚证[13],银翘散用于风热表证,小青龙汤用于外寒内饮证[14],均非风寒表实证的首选代表方。"
}
{
"answer": "B",
"rationale": "The wind-cold exterior-excess pattern (also called Taiyang cold damage) arises when wind-cold fetters the exterior, constraining defensive yang, stagnating nutritive yin and impairing the lung's diffusing function [1][2][3]. Treatment is to disperse wind-cold and diffuse the lung [4]. Mahuang Decoction, from the Shanghan Lun, is the representative formula for this pattern [5]; it induces sweating to release the exterior and diffuses the lung to relieve wheezing [6][7][8]. Mahuang is the sovereign herb, inducing sweating and dispersing cold [9]; Guizhi is the minister, assisting sweating and releasing the muscle layer [10]; Xingren is the assistant, directing lung qi downward to aid in relieving wheezing [11]. Hence the answer is Mahuang Decoction [12]. Guizhi Decoction treats the exterior-deficiency pattern [13], Yinqiao Powder treats wind-heat exterior patterns, and Xiao Qinglong Decoction treats external cold with internal fluid retention [14]; none is the first-choice formula here."
}
免责声明 / Disclaimer:本模型仅用于研究与教学,输出内容不构成医疗建议,不能替代执业医师的诊断与治疗。 This model is intended for research and educational purposes only. Its outputs do not constitute medical advice and must not replace diagnosis or treatment by a licensed physician.
快速使用
使用 uv 安装依赖:
uv pip install -U torch transformers accelerate huggingface_hub
如果仓库为私有,请先使用有访问权限的账号登录:
uv tool run --from huggingface_hub hf auth login
在模型权重上传完成后运行以下示例。示例需要足够内存或显存,具体需求取决于设备和输入长度。
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "GancaoDoctorAI/TraceMed"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype="auto",
device_map="auto",
)
model.eval()
messages = [{"role": "user", "content": "你好,请介绍一下你自己。"}]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, do_sample=False)
reply = outputs[0, inputs["input_ids"].shape[1]:]
print(tokenizer.decode(reply, skip_special_tokens=True))
文件说明
model.safetensors:模型权重。config.json:模型结构配置。generation_config.json:默认生成配置。tokenizer.json、tokenizer_config.json:分词器及配置。chat_template.jinja:对话输入模板。
补充信息
基础模型来源、训练数据、评测结果与许可证信息待补充。
- Downloads last month
- 388


