Text Generation
Transformers
Safetensors
English
qwen3
mental-health
user-simulation
patient-simulation
psychotherapy
network-model
grpo
conversational
text-generation-inference
Instructions to use ChengLi0228/Angel-Observer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ChengLi0228/Angel-Observer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ChengLi0228/Angel-Observer") 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("ChengLi0228/Angel-Observer") model = AutoModelForCausalLM.from_pretrained("ChengLi0228/Angel-Observer", 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
- vLLM
How to use ChengLi0228/Angel-Observer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ChengLi0228/Angel-Observer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ChengLi0228/Angel-Observer", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ChengLi0228/Angel-Observer
- SGLang
How to use ChengLi0228/Angel-Observer 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 "ChengLi0228/Angel-Observer" \ --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": "ChengLi0228/Angel-Observer", "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 "ChengLi0228/Angel-Observer" \ --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": "ChengLi0228/Angel-Observer", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ChengLi0228/Angel-Observer with Docker Model Runner:
docker model run hf.co/ChengLi0228/Angel-Observer
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3-8B
|
| 4 |
+
base_model_relation: finetune
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
tags:
|
| 10 |
+
- mental-health
|
| 11 |
+
- user-simulation
|
| 12 |
+
- patient-simulation
|
| 13 |
+
- psychotherapy
|
| 14 |
+
- network-model
|
| 15 |
+
- grpo
|
| 16 |
+
- qwen3
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# Angel-Observer
|
| 20 |
+
|
| 21 |
+
**Angel-Observer** reads a patient's presenting complaints and builds a
|
| 22 |
+
**directed symptom network** (a *Network Model*): the thoughts, emotions,
|
| 23 |
+
behaviors, bodily sensations and events in the case, and which ones set off
|
| 24 |
+
which. It is stage 1 of **Angel**, a two-stage simulator of psychotherapy
|
| 25 |
+
patients; [Angel-Actor](https://huggingface.co/ChengLi0228/Angel-Actor) then
|
| 26 |
+
role-plays the patient.
|
| 27 |
+
|
| 28 |
+
🎮 **[Live demo](https://eval.angel-simulation.org/demo)** · 💻 **[Code: ANGEL-UserSim](https://github.com/Scarelette/ANGEL-UserSim)** · 🎭 **[Angel-Actor](https://huggingface.co/ChengLi0228/Angel-Actor)**
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
short description ──► Angel-Observer ──► long profile + symptom network ──► Angel-Actor ──► patient replies
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
## What it does
|
| 35 |
+
|
| 36 |
+
One checkpoint answers two prompts:
|
| 37 |
+
|
| 38 |
+
| Step | Input | Output |
|
| 39 |
+
|---|---|---|
|
| 40 |
+
| **S1: nodes** | presenting complaints | `<think>…</think><GRAPH>{"symptoms": [...], "external_factors": [...]}</GRAPH>` |
|
| 41 |
+
| **S2: edges** | complaints + the S1 nodes | `<think>…</think><GRAPH>{"links": [{"from": ..., "to": ...}]}</GRAPH>` |
|
| 42 |
+
|
| 43 |
+
In the Angel pipeline it also expands a short patient description into a
|
| 44 |
+
detailed long profile for the Actor.
|
| 45 |
+
|
| 46 |
+
## How to use
|
| 47 |
+
|
| 48 |
+
The system prompts the model was trained on are in the code repository, so
|
| 49 |
+
the easiest way is through it:
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
git clone https://github.com/Scarelette/ANGEL-UserSim.git && cd ANGEL-UserSim
|
| 53 |
+
pip install -r model_training/observer/requirements-observer.txt
|
| 54 |
+
|
| 55 |
+
# one symptom network per case (JSONL with a "Complaints" field)
|
| 56 |
+
python -m model_training.observer.predict_network \
|
| 57 |
+
--input data/examples/observer/case_reports.jsonl --output networks.jsonl
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
The model is downloaded from this page on first use. From Python:
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
from model_training.observer.predict_network import load_observer, predict_network
|
| 64 |
+
|
| 65 |
+
tokenizer, model = load_observer("ChengLi0228/Angel-Observer")
|
| 66 |
+
net = predict_network(tokenizer, model, "Alex, 29, reports three months of low mood, "
|
| 67 |
+
"poor sleep and withdrawing from friends after being laid off ...")
|
| 68 |
+
print(net["symptoms"])
|
| 69 |
+
print(net["graph"]) # [{"from": "being laid off", "to": "low mood"}, ...]
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
For the full Angel patient (Observer + Actor) see
|
| 73 |
+
[`model_usage/`](https://github.com/Scarelette/ANGEL-UserSim/tree/main/model_usage).
|
| 74 |
+
It uses the Qwen3 chat template, sampling with temperature 0.1 and top-p 0.9,
|
| 75 |
+
and a bf16 model needs about 17 GB of GPU memory.
|
| 76 |
+
|
| 77 |
+
## Training
|
| 78 |
+
|
| 79 |
+
Qwen3-8B, fine-tuned in four stages (QLoRA adapters on a 4-bit copy, each
|
| 80 |
+
merged back in bf16):
|
| 81 |
+
|
| 82 |
+
| Stage | Data | Settings |
|
| 83 |
+
|---|---|---|
|
| 84 |
+
| SFT, S1 (nodes) | 5,599 rows | LoRA r=64 / α=16, lr 1e-4, 3 epochs |
|
| 85 |
+
| GRPO, S1 | 5,089 prompts, 600 steps | reward 0.4 · format + 0.6 · node recall (MiniLM cosine ≥ 0.75 against reference nodes) |
|
| 86 |
+
| SFT, S2 (edges) | 2,138 rows | LoRA r=64 / α=16, lr 1e-4, 3 epochs |
|
| 87 |
+
| GRPO, S2 | 800 steps | reward 0.1 · format + 0.6 · edge precision + 0.3 · node coverage − size penalty; edges scored by a gpt-5-mini judge |
|
| 88 |
+
|
| 89 |
+
The training data were built with GPT-5 from 510 of the 516 published
|
| 90 |
+
psychotherapy case reports in **PSYCHE**, our graph-grounded dataset for
|
| 91 |
+
psychological user simulation (release coming soon). The case reports are
|
| 92 |
+
copyrighted and are not redistributed. Full recipe:
|
| 93 |
+
[`model_training/observer/`](https://github.com/Scarelette/ANGEL-UserSim/tree/main/model_training/observer).
|
| 94 |
+
|
| 95 |
+
## Intended use and limitations
|
| 96 |
+
|
| 97 |
+
- **Research use** in user simulation, for example generating varied,
|
| 98 |
+
structured patient cases to train or evaluate therapy-support systems and
|
| 99 |
+
clinicians-in-training.
|
| 100 |
+
- **Not a diagnostic or clinical tool.** The networks are the model's
|
| 101 |
+
reading of a text, not clinical assessments, and they can be wrong,
|
| 102 |
+
incomplete or reflect biases in the source case reports.
|
| 103 |
+
- Trained on English case-report language; other languages and very
|
| 104 |
+
different writing styles are untested.
|
| 105 |
+
- Case material can involve self-harm, suicidality, trauma and substance
|
| 106 |
+
use, so the model's outputs can too.
|
| 107 |
+
|
| 108 |
+
## Citation
|
| 109 |
+
|
| 110 |
+
Coming soon.
|