Text Generation
Safetensors
GGUF
Chinese
English
patient-education
qa
rag
qwen3
lora
retrieval-augmented-generation
conversational
Instructions to use chenhaodev/patient-edu-qa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use chenhaodev/patient-edu-qa with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf chenhaodev/patient-edu-qa:Q8_0 # Run inference directly in the terminal: llama cli -hf chenhaodev/patient-edu-qa:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf chenhaodev/patient-edu-qa:Q8_0 # Run inference directly in the terminal: llama cli -hf chenhaodev/patient-edu-qa:Q8_0
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 chenhaodev/patient-edu-qa:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf chenhaodev/patient-edu-qa:Q8_0
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 chenhaodev/patient-edu-qa:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf chenhaodev/patient-edu-qa:Q8_0
Use Docker
docker model run hf.co/chenhaodev/patient-edu-qa:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use chenhaodev/patient-edu-qa with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chenhaodev/patient-edu-qa" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chenhaodev/patient-edu-qa", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/chenhaodev/patient-edu-qa:Q8_0
- Ollama
How to use chenhaodev/patient-edu-qa with Ollama:
ollama run hf.co/chenhaodev/patient-edu-qa:Q8_0
- Unsloth Desktop
- Pi
How to use chenhaodev/patient-edu-qa with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf chenhaodev/patient-edu-qa:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "chenhaodev/patient-edu-qa:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use chenhaodev/patient-edu-qa with Docker Model Runner:
docker model run hf.co/chenhaodev/patient-edu-qa:Q8_0
- Lemonade
How to use chenhaodev/patient-edu-qa with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull chenhaodev/patient-edu-qa:Q8_0
Run and chat with the model
lemonade run user.patient-edu-qa-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use chenhaodev/patient-edu-qa with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf chenhaodev/patient-edu-qa:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default chenhaodev/patient-edu-qa:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use chenhaodev/patient-edu-qa with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf chenhaodev/patient-edu-qa:Q8_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "chenhaodev/patient-edu-qa:Q8_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Download scripts/train_router.py from chenhaodev/patient-edu-qa: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/chenhaodev/patient-edu-qa/resolve/main/scripts/train_router.py
- Command line
-
hf download hf://chenhaodev/patient-edu-qa/scripts/train_router.py
-
curl -L -o train_router.py https://huggingface.co/chenhaodev/patient-edu-qa/resolve/main/scripts/train_router.py
2.57 kB
| #!/usr/bin/env python3 | |
| """Train the 1-3B router (LoRA) on the patient-intent plan SFT data. | |
| Reuses task14's unsloth + trl recipe. Base model Qwen3-1.5B (or 3B). | |
| Output: checkpoints/qwen3-{base}-router-lora/final (adapters to merge later). | |
| """ | |
| import json | |
| import os | |
| os.environ.setdefault("HF_ENDPOINT", "https://hf-mirror.com") | |
| import torch | |
| from unsloth import FastLanguageModel, is_bfloat16_supported | |
| from trl import SFTTrainer, SFTConfig | |
| from datasets import Dataset | |
| BASE = os.environ.get("ROUTER_BASE", "Qwen/Qwen3-1.7B") | |
| OUT_ROOT = os.environ.get("ROUTER_OUT", "/workspace/TASK18/checkpoints") | |
| TRAIN_JSONL = "/workspace/TASK18/data/router/router_sft_train.jsonl" | |
| VAL_JSONL = "/workspace/TASK18/data/router/router_sft_val.jsonl" | |
| def fmt(msgs): | |
| return ("<|im_start|>user\n" + msgs[0]["content"] + "<|im_end|>\n" | |
| "<|im_start|>assistant\n" + msgs[1]["content"] + "<|im_end|>\n") | |
| def load(p): | |
| return [json.loads(l) for l in open(p, encoding="utf-8")] | |
| train = load(TRAIN_JSONL) | |
| evald = load(VAL_JSONL) | |
| train_ds = Dataset.from_list([{"text": fmt(r["messages"])} for r in train]) | |
| eval_ds = Dataset.from_list([{"text": fmt(r["messages"])} for r in evald]) | |
| print(f"train={len(train)} val={len(evald)}", flush=True) | |
| model, tokenizer = FastLanguageModel.from_pretrained( | |
| model_name=BASE, max_seq_length=2048, dtype=None, load_in_4bit=True) | |
| model = FastLanguageModel.get_peft_model( | |
| model, r=16, | |
| target_modules=["q_proj", "k_proj", "v_proj", "o_proj", | |
| "gate_proj", "up_proj", "down_proj"], | |
| lora_alpha=16, lora_dropout=0, bias="none", | |
| use_gradient_checkpointing="unsloth", | |
| random_state=42, use_rslora=True, | |
| ) | |
| folder = os.path.basename(BASE.replace("/", "-")) | |
| out_dir = os.path.join(OUT_ROOT, f"{folder}-router-lora") | |
| config = SFTConfig( | |
| output_dir=out_dir, | |
| per_device_train_batch_size=16, | |
| gradient_accumulation_steps=2, | |
| num_train_epochs=3, | |
| learning_rate=2e-4, | |
| lr_scheduler_type="cosine", | |
| warmup_ratio=0.05, | |
| bf16=is_bfloat16_supported(), | |
| logging_steps=20, | |
| eval_strategy="epoch", | |
| eval_steps=None, | |
| save_strategy="epoch", | |
| save_total_limit=2, | |
| max_seq_length=2048, | |
| dataset_text_field="text", | |
| packing=False, | |
| report_to="none", | |
| optim="adamw_8bit", | |
| seed=42, | |
| ) | |
| trainer = SFTTrainer(model=model, tokenizer=tokenizer, args=config, | |
| train_dataset=train_ds, eval_dataset=eval_ds) | |
| trainer.train() | |
| final = os.path.join(out_dir, "final") | |
| model.save_pretrained(final) | |
| tokenizer.save_pretrained(final) | |
| print("TRAINING DONE ->", final) | |