Text Generation
Transformers
Safetensors
qwen3_5_text
text-generation-inference
qwen
tcm
medical
math
conversational
Instructions to use zsyjsld/Xinghe1-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zsyjsld/Xinghe1-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zsyjsld/Xinghe1-9B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zsyjsld/Xinghe1-9B") model = AutoModelForCausalLM.from_pretrained("zsyjsld/Xinghe1-9B", 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 zsyjsld/Xinghe1-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zsyjsld/Xinghe1-9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zsyjsld/Xinghe1-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zsyjsld/Xinghe1-9B
- SGLang
How to use zsyjsld/Xinghe1-9B 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 "zsyjsld/Xinghe1-9B" \ --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": "zsyjsld/Xinghe1-9B", "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 "zsyjsld/Xinghe1-9B" \ --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": "zsyjsld/Xinghe1-9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zsyjsld/Xinghe1-9B with Docker Model Runner:
docker model run hf.co/zsyjsld/Xinghe1-9B
File size: 2,844 Bytes
9b3d432 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | ---
license: apache-2.0
base_model: Qwen/Qwen3.5-9B-Instruct
tags:
- text-generation-inference
- transformers
- qwen
- tcm
- medical
- math
---
# Xinghe1-9B (邢核1代-9B)
**Xinghe1-9B (杏核)** 是一个专门针对《黄帝内经》理论形式化推演与临床机理分析的大语言模型。模型基于 **Qwen3.5-9B-Instruct** 基座,使用 V3 版双纯净学术 SFT 数据集进行极速微调,并在微调后完成了权重的物理融合。
本模型是首个致力于将《黄帝内经》经典理论公理化、系统化,并在相空间物理与系统动力学元框架下进行病机推演与临床指导的微型推理模型。
## 模型详情
- **开发者:** zsyjsld (刘健团队)
- **基座模型:** Qwen/Qwen3.5-9B-Instruct
- **微调方法:** QLoRA SFT (195 steps, 3 epochs) 单张 RTX 3090 本地训练。
- **语言:** 中文输出临床分析,英文/LaTeX进行内部思维链公式推演。
- **协议:** 代码及数据集遵循 Apache 2.0 协议,权重遵循 Qwen 授权许可协议。
## 统一元框架 (Unified Meta-Framework)
模型在推理时,严格在 `<think>` 内完成参数绑定与机理方程推演,在思考区外输出纯净中医临床内容。
元框架的核心动力学描述为:
$$\dot{x} = F(x) + G(x, \mu(t))$$
$$y = h(x) + \epsilon$$
* **$x(t)$ (状态维 - 阴阳反作)**:由形式维函数 $F(x)$ 刻画,描述系统状态在相空间中的轨迹与负反馈合化过程。
* **$G(x, \mu)$ (动力维 - 生气)**:系统维持生命特征的第一推动力,包含三层层级储备(胃气 -> 宗气 -> 脏真)。
* **$\mu(t)$ (时间维 - 积气盈闰)**:时令与季节变化参数,作为动力系统的时变外部控制变量。
* **$h(x)$ (认识维 - 象思维)**:四通道观测器函数(脉诊、色诊、声诊、梦境),带有生理/病理噪声 $\epsilon$。
## 使用方法
您可以使用 Transformers 库加载该模型进行推理:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "zsyjsld/Xinghe1-9B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype="auto")
prompt = "在温病过程中,患者出汗后发热不仅不退,反而再次升高,脉象躁动疾速且不随汗出而平复,并伴有狂言胡语、不能进食。这种病证称为阴阳交,其底层的生死转归机理是什么?"
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(**model_inputs, max_new_tokens=1024)
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
```
|