Instructions to use cptlight/shennong-1.5b-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cptlight/shennong-1.5b-sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cptlight/shennong-1.5b-sft") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cptlight/shennong-1.5b-sft") model = AutoModelForCausalLM.from_pretrained("cptlight/shennong-1.5b-sft", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use cptlight/shennong-1.5b-sft 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 cptlight/shennong-1.5b-sft:Q4_K_M # Run inference directly in the terminal: llama cli -hf cptlight/shennong-1.5b-sft:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf cptlight/shennong-1.5b-sft:Q4_K_M # Run inference directly in the terminal: llama cli -hf cptlight/shennong-1.5b-sft:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf cptlight/shennong-1.5b-sft:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf cptlight/shennong-1.5b-sft:Q4_K_M
Use Docker
docker model run hf.co/cptlight/shennong-1.5b-sft:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use cptlight/shennong-1.5b-sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cptlight/shennong-1.5b-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": "cptlight/shennong-1.5b-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cptlight/shennong-1.5b-sft:Q4_K_M
- SGLang
How to use cptlight/shennong-1.5b-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 "cptlight/shennong-1.5b-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": "cptlight/shennong-1.5b-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 "cptlight/shennong-1.5b-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": "cptlight/shennong-1.5b-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use cptlight/shennong-1.5b-sft with Ollama:
ollama run hf.co/cptlight/shennong-1.5b-sft:Q4_K_M
- Unsloth Desktop
- Pi
How to use cptlight/shennong-1.5b-sft with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf cptlight/shennong-1.5b-sft:Q4_K_M
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:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "cptlight/shennong-1.5b-sft:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use cptlight/shennong-1.5b-sft with Docker Model Runner:
docker model run hf.co/cptlight/shennong-1.5b-sft:Q4_K_M
- Lemonade
How to use cptlight/shennong-1.5b-sft with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull cptlight/shennong-1.5b-sft:Q4_K_M
Run and chat with the model
lemonade run user.shennong-1.5b-sft-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use cptlight/shennong-1.5b-sft with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf cptlight/shennong-1.5b-sft:Q4_K_M
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:9931/v1 hermes config set model.default cptlight/shennong-1.5b-sft:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use cptlight/shennong-1.5b-sft with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf cptlight/shennong-1.5b-sft:Q4_K_M
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:9931/v1 \ --custom-model-id "cptlight/shennong-1.5b-sft:Q4_K_M" \ --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"
SHENNONG ็ฅๅ โ 1.5 B domain fine-tune
This repository contains three different things. Read the table before downloading.
The main artifact is a LoRA fine-tune of Qwen/Qwen2.5-1.5B on 88,082 domain examples about classical Asian
medicine, merged back into the base weights and also provided as a GGUF for CPU inference. The same repo also holds
two sparse-mixture-of-experts experiments that are research artifacts, not the recommended model โ one of them
lost to the dense model, and one of them requires a specific llama.cpp build.
What is in this repository
| file | size | what it is | use it? |
|---|---|---|---|
model.safetensors |
3,087 MB | The model. Full merged fp16 weights, 1,543,714,304 parameters. LoRA r=64 merged into Qwen2.5-1.5B. | โ transformers |
shennong-1.5b-sft-Q4_K_M.gguf |
986 MB (940 MiB) | The recommended GGUF. Q4_K_M quantisation of the above, runs on CPU with llama.cpp, no GPU needed. | โ llama.cpp |
adapters/t2_natprod.gguf |
39 MB | A LoRA adapter (Track-02 natural-products domain) for the 0.5 B model, used by an expert-routing demo. Optional. | optional |
shennong-moe-Q4_K_M-loadable.gguf |
1,368 MB | 4-expert top-2 sparse MoE, 1,435,499,392 params, repaired to load in llama.cpp 0.3.x. Scored below the dense model (31.7 % vs 43.3 %). | research only |
shennong-moe-Q4_K_M.gguf |
1,047 MB | The same MoE before the repair. Its shared-expert tensors have a 0-width placeholder shape, so llama.cpp 0.3.x rejects it. Kept for provenance. | โ will not load |
Tokenizer and chat-template files are included.
Training
- Base:
Qwen/Qwen2.5-1.5B(Apache-2.0) - Method: LoRA, r=64, alpha=128, dropout 0.05, targets
q_proj k_proj v_proj o_proj gate_proj up_proj down_proj - Data: 88,082 domain examples (SFT), 5,623 held out โ question/answer pairs over classical Chinese materia medica, plant-name resolution, compound classes, gene targets, formulas, incompatibilities and safety
- Steps: 1,800 (effective batch 16 โ โ0.33 epoch)
- Final losses: train 1.187 ยท eval 1.031
- Merge: adapters merged into the base, then quantised to Q4_K_M
Evaluation
200 held-out questions, same decode for both arms (temperature 0.2, top_p 0.9, seed 1337, max_new_tokens 40),
contains-match of the gold fact, no retrieval. Full protocol and the benchmark's own defects are documented in
docs/BENCHMARK.md.
| arm | score |
|---|---|
| this model | 49.0 % (98/200) |
Qwen/Qwen2.5-1.5B-Instruct (un-finetuned) |
37.0 % (74/200) |
Per task family (fine-tuned vs base): compound 20/20 vs 20/20 ยท target 20/20 vs 20/20 ยท pharmacology 20/20 vs
20/20 ยท viability 6/6 vs 0/6 ยท property 15/20 vs 0/20 ยท formula 7/9 vs 5/9 ยท name_mapping 8/20 vs 7/20.
What this model is bad at โ measured, not guessed
usequestions: 0/63. Asked "what is Echinochloa colona used for in Indian medicine?" it answers with a Chinese classical use. It confuses traditions. Do not use it to recall therapeutic uses; use the extraction pipeline in the repository instead.- Name resolution is weak (8/20). Archaic plant names outside the lexicon are not resolved.
- Greek and Latin are not represented. The corpus holds ~19 records' worth; the model cannot decode them.
- The sibling sparse MoE scored 31.7 % vs 43.3 % for the dense model โ it is published as a negative result.
How to use
CPU, via llama.cpp (recommended):
llama-cli -m shennong-1.5b-sft-Q4_K_M.gguf -p "<|user|>What gene target does Salvia miltiorrhiza affect?<|assistant|>" -n 40
Prompt format is <|user|>question<|assistant|> with <|im_end|> as the stop token.
transformers:
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("cptlight/shennong-1.5b-sft")
m = AutoModelForCausalLM.from_pretrained("cptlight/shennong-1.5b-sft", torch_dtype="float16")
out = m.generate(**tok("<|user|>What is ็่ used for?<|assistant|>", return_tensors="pt"), max_new_tokens=40)
print(tok.decode(out[0], skip_special_tokens=True))
Licence and provenance
Apache-2.0 (inherited from Qwen2.5-1.5B, which is Apache-2.0; our fine-tuning and code are Apache-2.0). Training
data derives only from permissive sources โ CC0, public domain and CC BY. Sources whose licences are
non-commercial (ctext.org, GRETIL) were excluded, which is recorded source-by-source in
docs/CORPUS_PROVENANCE.md.
Intended use and limits
This is a research model for the history and pharmacology of traditional medicine. It answers questions about recorded uses, historical plant names, compound classes and gene targets, and it summarises retrieved passages.
It is not medical advice. It does not provide dosing, does not recommend self-treatment, and does not give synthesis routes for toxins or pathogens. Its outputs are pre-modern claims about a historical record, not clinical guidance, and nothing here has been validated in vitro or in vivo.
Links
- Live demo (CPU): https://cptlight-shennong.hf.space
- Code: https://github.com/cptlight/shennong
- Benchmark protocol and its defects: https://github.com/cptlight/shennong/blob/main/docs/BENCHMARK.md
- Name-resolution audit: https://github.com/cptlight/shennong/blob/main/docs/RESOLUTION.md
- Downloads last month
- 919