YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
用户意图转变二分类器交付说明
这个模型用于判断“用户最新一句话”是否表达了明确的对话状态转变意图。
标签含义:
0:没有明确状态转变
1:有明确状态转变
状态转变包括:
normal -> sex:用户从普通对话转向性暗示、暧昧、色情、亲密 RP 等方向
sex -> normal:用户明确停止、退出、降温、换话题、回到正常对话
文件结构
model/ 已 merge 的 Hugging Face 模型和 tokenizer
infer.py 推理脚本,已和训练时的输入构造方式对齐
metadata.json 模型来源和预处理配置
eval_results.json 训练评估集指标
README.md 说明文档
输入格式
推理脚本支持 JSONL 输入,每行一个样本。
输入采用 OpenAI messages 格式:
{
"sample_id": "demo-1",
"messages": [
{"role": "user", "content": "hello"},
{"role": "assistant", "content": "hi"},
{"role": "user", "content": "come to bed with me"}
]
}
要求:
1. messages 里只允许 user / assistant 两种 role。
2. 最后一条 message 必须是最新 user。
3. 不要传最新 user 后面的 assistant 回复。
4. 不要传 system message;训练时没有 system 输入。
5. content 不能为空。
推理命令
JSONL 批量推理:
python infer.py \
--model_dir model \
--input input.jsonl \
--output predictions.jsonl \
--threshold 0.5 \
--batch_size 16
调试时也可以直接传已经渲染好的单条文本:
python infer.py \
--model_dir model \
--text "Recent conversation:\nUser: hello\nAssistant: hi\nLatest user: come to bed with me"
输出格式
输出 JSONL,每行一个结果:
{
"sample_id": "demo-1",
"pred": 1,
"prob_0": 0.0467,
"prob_1": 0.9533,
"threshold": 0.5,
"rendered_text": "Recent conversation:\nUser: hello\nAssistant: hi\nLatest user: come to bed with me"
}
字段含义:
pred:最终预测标签,0 或 1
prob_0:label 0 的概率
prob_1:label 1 的概率
threshold:当前使用的 label 1 判定阈值
rendered_text:实际送入模型的文本,便于排查线上输入是否正确
默认判断逻辑:
prob_1 >= threshold 时输出 pred=1
prob_1 < threshold 时输出 pred=0
默认阈值:
threshold = 0.5
注意事项
- 推理时不要额外拼 prompt 或 instruction,训练时没有使用 instruction。
- 输入必须截止到最新 user,不能带最新 user 后面的 assistant 回复。
rendered_text建议在联调阶段保留,用来确认线上输入和训练格式一致;正式服务中可以去掉。- 如果更重视 label=1 recall,可以适当降低 threshold。
- 如果更重视 label=1 precision,可以适当提高 threshold。
- Downloads last month
- -
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support