Text Generation
PEFT
Safetensors
Chinese
qwen3
lora
dialogue-act-planning
psychological-counseling
conversational
Instructions to use UEC-InabaLab/CounselTraj with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use UEC-InabaLab/CounselTraj with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-8B") model = PeftModel.from_pretrained(base_model, "UEC-InabaLab/CounselTraj") - Notebooks
- Google Colab
- Kaggle
File size: 5,105 Bytes
b6a1960 70edfd4 b6a1960 789edad 70edfd4 b6a1960 7ffc814 b6a1960 70edfd4 b6a1960 0731207 b6a1960 70edfd4 b6a1960 789edad b6a1960 | 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 | ---
language:
- zh
base_model: Qwen/Qwen3-8B
base_model_relation: finetune
library_name: peft
pipeline_tag: text-generation
tags:
- qwen3
- lora
- dialogue-act-planning
- psychological-counseling
---
# CounselTraj
📄 **Paper:** [arXiv:2611.24168](https://arxiv.org/abs/2611.24168)
CounselTraj is a dialogue-act trajectory planner for synthesizing process-aware
psychological counseling dialogues.
Given a brief counseling dialogue, the planner produces an ordered trajectory
of role-tagged acts such as `counselor:[OpenQuestion]` and
`client:[SelfDisclosure]` for subsequent dialogue synthesis.
This repository contains a **LoRA adapter for
[Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B)**, together with its tokenizer,
the trajectory planning script, and aggregate dialogue-act priors. Loading the
adapter also requires the Qwen3-8B base model. Its base model is distributed under
Apache-2.0.
Project and dataset: [UEC-InabaLab/CounselTraj](https://github.com/UEC-InabaLab/CounselTraj).
## Model details
| Item | Value |
| --- | --- |
| Base model | Qwen/Qwen3-8B |
| Adapter | LoRA, rank 8, alpha 16, dropout 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Adapter parameters | 21,823,488 |
| Selected checkpoint | checkpoint-145, epoch 5 |
| Selection criterion | Lowest recorded validation loss, 1.1678476334 |
| Learning rate / warmup ratio | 0.0002 / 0.03 |
| Planner | Content-conditioned v4 constrained decoding |
| Default trajectory length budget | 64–92 dialogue acts |
The released adapter is byte-identical to both the selected checkpoint and the
saved final model. Training uses dialogue-act annotations of counseling
dialogues; the bundled stage, transition, and global priors were aggregated from
1,010 annotated dialogues.
## Generate a trajectory
Download the public model repository and install its dependencies:
```bash
pip install huggingface_hub
python -c 'from huggingface_hub import snapshot_download; snapshot_download("UEC-InabaLab/CounselTraj", local_dir="CounselTraj")'
cd CounselTraj
pip install -r requirements.txt
python plan_trajectory.py --input-file examples/input.jsonl --limit 1
```
The default inference path uses CUDA and bitsandbytes NF4 quantization. On a
supported device with enough memory, `--no-4bit` loads the base model without
4-bit quantization.
Input is UTF-8 JSONL with an `input` string containing the brief dialogue. Optional
fields include `id`, `topic`, `topic_zh`, `source_dataset`, and `source_id`. The
bundled example is a newly written synthetic illustration. The output JSONL
contains the planned role-tagged trajectory in `output`, along with its length
and tag counts.
The original planner can append closing acts beyond its target length budget;
count the acts in `output` when an exact realized length is needed.
The planner combines adapter likelihoods with stage, transition, and global
priors, content and phase scores, a repetition penalty, and a diversity bonus.
Use `plan_trajectory.py` to run this decoding procedure. Loading the adapter alone
provides the language-model component of the planner.
The client candidate inventory contains 14 tags, including `Resistance`
(rejection, reluctance, or resistance toward counselor interventions). This
candidate was added after the initial release; newly planned trajectories can
therefore differ from the original v4 outputs. The adapter weights are unchanged.
## Load the adapter in Python
```python
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
repo_id = "UEC-InabaLab/CounselTraj"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3-8B",
quantization_config=BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
),
device_map="auto",
)
model = PeftModel.from_pretrained(base, repo_id)
model.eval()
```
## Files
- `adapter_model.safetensors` and `adapter_config.json`: selected LoRA weights and configuration.
- Tokenizer files: the saved tokenizer accompanying the adapter.
- `plan_trajectory.py`: v4 planning algorithm, with portable local defaults.
- `da_stats.json`: aggregate planning priors.
- `examples/input.jsonl`: synthetic input example.
- `model_details.json`: checkpoint selection and release details.
- `validation.json`: release checks and a synthetic GPU inference check.
- `SHA256SUMS`: file integrity checksums.
The planner generates research planning labels. Its trajectories have not been
validated as clinical treatment plans.
## Citation
```bibtex
@inproceedings{qi-inaba-2027-counseltraj,
title = "{CounselTraj}: Synthesizing Process-Aware Psychological Counseling Dialogues via Dialogue-Act Trajectory Planning",
author = "Qi, Zhiyang and Inaba, Michimasa",
booktitle = "Proceedings of the 20th Conference of the European Chapter of the Association for Computational Linguistics",
year = "2027",
url = "https://arxiv.org/abs/2611.24168",
}
```
|