Text Generation
Transformers
Safetensors
Chinese
English
baichuan
feature-extraction
custom_code
medical
healthcare
prostate-cancer
lifestyle-management
patient-education
domain-specific
supervised-fine-tuning
lora
bilingual
conversational
text-generation-inference
Instructions to use RomilY/PCaPLMM_SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RomilY/PCaPLMM_SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RomilY/PCaPLMM_SFT", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("RomilY/PCaPLMM_SFT", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RomilY/PCaPLMM_SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RomilY/PCaPLMM_SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RomilY/PCaPLMM_SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RomilY/PCaPLMM_SFT
- SGLang
How to use RomilY/PCaPLMM_SFT 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 "RomilY/PCaPLMM_SFT" \ --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": "RomilY/PCaPLMM_SFT", "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 "RomilY/PCaPLMM_SFT" \ --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": "RomilY/PCaPLMM_SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use RomilY/PCaPLMM_SFT with Docker Model Runner:
docker model run hf.co/RomilY/PCaPLMM_SFT
File size: 16,628 Bytes
beff36d 87e4df4 beff36d 87e4df4 b93ce7d 87e4df4 b93ce7d 87e4df4 b93ce7d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 b93ce7d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 beff36d 87e4df4 b93ce7d 87e4df4 | 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | ---
language:
- zh
- en
library_name: transformers
pipeline_tag: text-generation
base_model: baichuan-inc/Baichuan2-7B-Chat
license: other
license_name: "apache-2.0"
tags:
- baichuan
- custom_code
- safetensors
- medical
- healthcare
- prostate-cancer
- lifestyle-management
- patient-education
- domain-specific
- supervised-fine-tuning
- lora
- bilingual
---
# PCaPLMM-SFT
**PCaPLMM-SFT: Prostate Cancer Patient Lifestyle Management Model via Supervised Fine-Tuning**
> [!CAUTION]
> **Research use only.** PCaPLMM-SFT is not a medical device and has not been validated for diagnosis, treatment selection, medication adjustment, emergency triage, or autonomous patient care. Its outputs may be incomplete, outdated, unsupported, or clinically inappropriate. Any health-related output must be reviewed against current clinical guidelines and assessed by qualified healthcare professionals.
>
> **仅限科研使用。** PCaPLMM-SFT 不是医疗器械,尚未经过临床诊断、治疗决策、药物调整、急诊分诊或自主患者管理验证。模型可能生成不完整、过时、缺乏证据支持或临床上不恰当的内容。任何健康相关输出均须结合最新临床指南,并由具备资质的医疗专业人员审核。
## Model summary
PCaPLMM-SFT is a Chinese–English domain-specific causal language model developed for research on prostate cancer lifestyle-management communication. It was derived from [`baichuan-inc/Baichuan2-7B-Chat`](https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat) through domain-adaptive training and supervised fine-tuning. The training corpus and instruction data focus on five prespecified domains:
1. diet and nutrition;
2. physical activity and exercise;
3. body-weight management;
4. medication and treatment adherence; and
5. psychological and psychosocial support.
The associated evidence-retrieval database, FAISS index, source documents, and training datasets are not included in this repository.
### 中文简介
PCaPLMM-SFT 是一个面向前列腺癌生活方式管理研究的中英文领域化因果语言模型。模型以 Baichuan2-7B-Chat 为基础,经领域继续训练与监督微调构建,主要覆盖饮食营养、体力活动、体重管理、药物或治疗依从性以及心理社会支持五类应用场景。
与研究配套的文献证据库、FAISS 索引、原始文献及训练数据未包含在本仓库中。
## Model details
| Item | Description |
|---|---|
| Repository | [`RomilY/PCaPLMM_SFT`](https://huggingface.co/RomilY/PCaPLMM_SFT) |
| Base model | [`baichuan-inc/Baichuan2-7B-Chat`](https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat) |
| Architecture | Baichuan decoder-only causal language model |
| Approximate scale | 7B parameters |
| Release format | Merged full-model weights, Safetensors |
| Primary task | Bilingual medical-domain text generation |
| Languages | Chinese and English |
| Context limit in the released configuration | 4,096 tokens |
| Training framework | LLaMA-Factory 0.7.0 |
| Parameter-efficient tuning | LoRA, rank 8, bfloat16 |
| Repository code | Custom Baichuan modeling and tokenization code |
| Model-card revision | 11 July 2026 |
The configuration files specify `BaichuanForCausalLM`, a 4,096-token maximum context length, bfloat16 weights, 32 transformer layers, 32 attention heads, and a hidden size of 4,096. Because this repository includes custom model and tokenizer code, loading requires `trust_remote_code=True`. Users should inspect the repository code before enabling remote code execution.
## Intended uses
Appropriate research uses include:
- studying domain adaptation and supervised fine-tuning for medical language models;
- developing human-supervised prostate cancer education prototypes;
- drafting non-final educational content for expert review;
- evaluating evidence-grounded generation and retrieval-augmented generation workflows;
- studying bilingual communication concerning lifestyle management; and
- comparing model outputs under controlled research protocols.
All generated content should be treated as a draft requiring evidence verification and professional review.
## Out-of-scope uses
Do not use this model for:
- diagnosis, prognosis, staging, or treatment selection;
- prescribing, dosing, stopping, or changing medications;
- replacing oncologists, urologists, nurses, pharmacists, dietitians, psychologists, or other qualified professionals;
- emergency advice or triage;
- direct-to-patient deployment without continuous human oversight;
- generating definitive clinical recommendations from model weights alone;
- high-stakes decisions involving an individual patient;
- use as an authoritative clinical guideline; or
- any unlawful, deceptive, discriminatory, or harmful activity.
## Training data
### Evidence corpus
The documented development corpus covered **February 2015 to February 2025** and comprised **2,211 peer-reviewed publications** related to prostate cancer lifestyle management:
| Source type | Number |
|---|---:|
| Original research articles | 1,516 |
| Review articles | 695 |
| **Total** | **2,211** |
The literature corpus was processed into more than **150,000 knowledge chunks** for evidence organization and retrieval experiments. BGE-M3 embeddings and a FAISS vector store were used in the associated retrieval workflow.
**Clinical guideline text was not used as training text.** The model therefore must not be assumed to reproduce current guideline recommendations. Users should independently consult current professional guidelines and primary evidence.
### Instruction data
| Component | Size | Description |
|---|---:|---|
| Single-turn question–answer pairs | **42,330** | Bilingual patient-oriented and knowledge-oriented exchanges grounded in the literature-derived knowledge base |
| Multi-turn conversations | **3,008** | Context-dependent conversations designed to simulate follow-up questions across lifestyle-management scenarios |
In this model card, the instruction data are consistently referred to as the **PCaPLMM-SFT instruction dataset**.
The five main content domains were diet and nutrition, physical activity, weight management, medication or treatment adherence, and psychological or psychosocial support.
### Data generation and quality control
The documented data-development pipeline included:
1. literature retrieval and eligibility screening;
2. document normalization and evidence chunking;
3. semantic embedding with BGE-M3 and storage in FAISS;
4. evidence-conditioned question and answer generation;
5. formatting, terminology, duplication, consistency, and safety checks;
6. similarity-based deduplication;
7. grouped splitting at the question-group level to reduce information leakage; and
8. stratified human quality review.
Most synthetic question–answer generation used Qwen3-Turbo. Consequently, the instruction data may inherit generator-specific stylistic, factual, and safety-expression biases. A total of **2,400 generated samples** underwent human quality review. This audit sample should not be interpreted as proof that the remaining data or model outputs are error-free.
The source publications, generated instruction data, exclusion logs, and quality-control annotations are not distributed in this model repository. Their absence limits independent auditing and exact reconstruction.
## Limitations and known risks
### Knowledge and temporal limitations
- The documented evidence corpus ended in **February 2025**. The model may not reflect evidence, safety communications, drug information, or guidelines published after that date.
- The model does not dynamically retrieve new evidence unless integrated into an external retrieval system.
- Published literature can contain bias, reporting errors, contradictory findings, and limited population coverage.
- Review articles and original studies were included, but guideline text was not used as training text.
### Generation limitations
- The model can hallucinate references, statistics, mechanisms, contraindications, or recommendations.
- It may present uncertain evidence with unjustified confidence.
- It may fail to distinguish population-level associations from individual clinical advice.
- It may generate generic recommendations that do not account for cancer stage, treatment modality, comorbidities, frailty, culture, access, or patient preferences.
- It may inconsistently communicate uncertainty, contraindications, and thresholds for professional referral.
- Output quality may differ between Chinese and English and across prompt styles.
- The model may reproduce biases from the base model, publication corpus, synthetic-data generator, and human reviewers.
### Retrieval limitations
The associated study used a retrieval-augmented workflow with BGE-M3 embeddings, FAISS, and a top-`k` value of 20. Those components are not bundled here. Running the released model without retrieval should not be described as evidence-grounded generation. Even with retrieval, users must verify that the retrieved evidence is relevant, current, and correctly interpreted.
### Safety limitations
The model was not prospectively evaluated in real patients, clinical workflows, or randomized implementation studies. It should not be exposed directly to patients without an institutionally approved protocol, privacy safeguards, continuous professional oversight, output logging, and a clear escalation pathway.
## How to use
### Installation
A reproducible starting environment is:
```bash
pip install "torch>=2.0" "transformers==4.48.3" accelerate sentencepiece safetensors
```
The repository contains custom code. Review `configuration_baichuan.py`, `modeling_baichuan.py`, `tokenization_baichuan.py`, `generation_utils.py`, and `quantizer.py` before setting `trust_remote_code=True`.
### Basic chat inference
```python
import torch
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
GenerationConfig,
)
MODEL_ID = "RomilY/PCaPLMM_SFT"
tokenizer = AutoTokenizer.from_pretrained(
MODEL_ID,
use_fast=False,
trust_remote_code=True,
)
model_kwargs = {
"trust_remote_code": True,
"torch_dtype": torch.bfloat16 if torch.cuda.is_available() else torch.float32,
}
if torch.cuda.is_available():
model_kwargs["device_map"] = "auto"
model = AutoModelForCausalLM.from_pretrained(
MODEL_ID,
**model_kwargs,
)
model.generation_config = GenerationConfig.from_pretrained(MODEL_ID)
model.eval()
messages = [
{
"role": "user",
"content": (
"前列腺癌患者在开始新的运动计划前,需要考虑哪些因素?"
"请区分一般健康教育与必须咨询临床医生的情况。"
),
}
]
with torch.inference_mode():
response = model.chat(tokenizer, messages)
print(response)
```
### Multi-turn inference
```python
messages = [
{
"role": "user",
"content": "前列腺癌治疗期间,怎样制定较安全的日常活动计划?",
}
]
with torch.inference_mode():
first_response = model.chat(tokenizer, messages)
messages.append({"role": "assistant", "content": first_response})
messages.append(
{
"role": "user",
"content": "如果患者同时存在骨转移风险,哪些建议不能直接照搬?",
}
)
with torch.inference_mode():
second_response = model.chat(tokenizer, messages)
print(second_response)
```
### Download with Git
The repository contains approximately 15 GB of model files.
```bash
git lfs install
git clone https://huggingface.co/RomilY/PCaPLMM_SFT
```
### Generation configuration
The repository's default `generation_config.json` specifies:
| Parameter | Default |
|---|---:|
| `do_sample` | `true` |
| `temperature` | `0.3` |
| `top_p` | `0.85` |
| `top_k` | `5` |
| `repetition_penalty` | `1.05` |
| `max_new_tokens` | `2048` |
These values are release defaults rather than clinically validated settings. For research requiring greater repeatability, explicitly set a random seed and document all generation parameters. Low-temperature decoding does not eliminate hallucinations.
### Hardware considerations
The sharded bfloat16 weights occupy approximately 15 GB on disk. Runtime memory also includes model-loading overhead, activations, the key–value cache, and framework allocations. Hardware requirements therefore depend on input length, output length, batch size, precision, and device mapping. CPU inference is possible in principle but may be slow. The repository does not provide a validated quantized release.
## Repository contents
The current release includes the following principal files:
```text
PCaPLMM_SFT/
├── README.md
├── config.json
├── configuration.json
├── configuration_baichuan.py
├── generation_config.json
├── generation_utils.py
├── model-00001-of-00004.safetensors
├── model-00002-of-00004.safetensors
├── model-00003-of-00004.safetensors
├── model-00004-of-00004.safetensors
├── model.safetensors.index.json
├── modeling_baichuan.py
├── Modelfile
├── quantizer.py
├── special_tokens_map.json
├── tokenization_baichuan.py
├── tokenizer.model
└── tokenizer_config.json
```
## Responsible-use recommendations
Research deployments should, at minimum:
1. use retrieval from current and curated evidence rather than relying only on parametric memory;
2. retain source metadata and display evidence provenance;
3. require human review before any content reaches patients;
4. implement checks for unsupported claims, medication advice, contraindications, and emergency symptoms;
5. preserve prompts, retrieved passages, model versions, generation settings, and reviewer decisions for audit;
6. conduct subgroup and language-specific evaluation;
7. prohibit the entry of identifiable patient information unless an approved privacy and security framework is in place; and
8. define a process for updating or withdrawing the model when evidence or safety requirements change.
## License
This derivative model is subject to the terms applicable to the Baichuan 2 base model. Community use requires compliance with both the Apache License 2.0 and the **Baichuan 2 Model Community License**. Commercial use may require additional authorization and remains subject to the base model's terms.
Before use or redistribution, review:
- [Baichuan2-7B-Chat model card and terms](https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat)
- [Baichuan 2 Model Community License](https://huggingface.co/baichuan-inc/Baichuan2-7B-Base/resolve/main/Baichuan%202%E6%A8%A1%E5%9E%8B%E7%A4%BE%E5%8C%BA%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE.pdf)
- [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)
Nothing in this model card grants rights beyond those provided by the applicable licenses.
## Citation
The associated manuscript citation should replace the provisional repository citation below once the article is publicly available.
```bibtex
@misc{pcaplmm_sft_2026,
title = {PCaPLMM-SFT: Prostate Cancer Patient Lifestyle Management Model via Supervised Fine-Tuning},
author = {{PCaPLMM-SFT Development Team}},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/RomilY/PCaPLMM_SFT}},
note = {Research model; accessed YYYY-MM-DD}
}
```
## Acknowledgements
This work builds on:
- [Baichuan2-7B-Chat](https://huggingface.co/baichuan-inc/Baichuan2-7B-Chat)
- [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory)
- [BGE-M3](https://huggingface.co/BAAI/bge-m3)
- [FAISS](https://github.com/facebookresearch/faiss)
## Contact
Repository maintainer: **Fangyuan Jiang**
Email: [theromily@gmail.com](mailto:theromily@gmail.com)
For reproducibility questions, suspected safety issues, or documentation corrections, open a discussion in the Hugging Face repository or contact the maintainer.
## Change log
### Model-card revision — 11 July 2026
- updated inference examples to use the model's custom Baichuan code and chat interface;
- corrected the repository description from a standalone LoRA adapter to merged full-model weights;
- aligned the file tree with the files currently present in the repository;
- clarified that clinical guideline text was not used as training text;
- added intended-use, out-of-scope-use, limitation, bias, safety, licensing, and reproducibility sections; and
- added Hugging Face metadata for task, library, languages, base model, license, and discoverability.
|