---
title: FireRedChat-turn-detector
canonical_url: "https://www.modelscope.cn/models/FireRedTeam/FireRedChat-turn-detector"
md_url: "https://www.modelscope.cn/models/FireRedTeam/FireRedChat-turn-detector.md"
repository: FireRedTeam/FireRedChat-turn-detector
last_updated: 2025-09-22
license: apache-2.0
base_model:
  - google-bert/bert-base-multilingual-cased
base_model_relation: finetune
library_name:
  - transformer
  - onnx
  - pytorch
frameworks:
  - pytorch
language:
  - zh
  - en
downloads: 1079
stars: 2
tags:
  - agent
---

# FireRedChat-turn-detector

> FireRedChat-turn-detector - FireRedTeam 在 ModelScope 开源的模型。FireRedChat-turn-detector

FireRedTeam/FireRedChat-turn-detector 是 ModelScope 魔搭社区上的机器学习模型，采用 apache-2.0 许可，基于 google-bert/bert-base-multilingual-cased 构建。

- **Repository**: FireRedTeam/FireRedChat-turn-detector
- **License**: apache-2.0
- **Base model**: google-bert/bert-base-multilingual-cased
- **Tags**: agent
- **Downloads**: 1079
- **Stars**: 2
- **Last updated**: 2025-09-22

Source: https://www.modelscope.cn/models/FireRedTeam/FireRedChat-turn-detector

---

<div align="center">
<h1>FireRedChat-turn-detector</h1>
</div>

<div align="center">
  <a href="https://fireredteam.github.io/demos/firered_chat/">Demo</a> •
  <a href="https://arxiv.org/pdf/2509.06502">Paper</a> •
  <a href="https://huggingface.co/FireRedTeam">Huggingface</a>
</div>


## Descriptions

Compact end-of-turn detection used in FireRedChat. [livekit plugin available here](https://github.com/fireredchat-submodules/livekit-plugins-fireredchat-turn-detector)
- chinese_best_model_q8.onnx: FireRedChat turn-detector model (Chinese only)
- multilingual_best_model_q8.onnx: FireRedChat turn-detector model (Chinese and English)

## Roadmap

- [x] 2025/09
  - [x] Release the onnx checkpoints and livekit plugin.

## Usage
```python
import numpy as np
import onnxruntime as ort
from transformers import AutoTokenizer

def softmax(x):
    exp_x = np.exp(x - np.max(x, axis=1, keepdims=True))
    return exp_x / np.sum(exp_x, axis=1, keepdims=True)

session = ort.InferenceSession(
    "chinese_best_model_q8.onnx", providers=["CPUExecutionProvider"]
)

tokenizer = AutoTokenizer.from_pretrained(
    "./tokenizer",
    local_files_only=True,
    truncation_side="left"
)

text = "这是一句没有标点的文本"
inputs = tokenizer(
            text,
            truncation=True,
            padding='max_length',
            add_special_tokens=False,
            return_tensors="np",
            max_length=128,
        )
# Run inference
outputs = session.run(None, 
                      {
                          "input_ids": inputs["input_ids"].astype("int64"), 
                          "attention_mask": inputs["attention_mask"].astype("int64")
                      })
eou_probability = softmax(outputs[0]).flatten()[-1]
print(eou_probability, eou_probability>0.5)
```

### Acknowledgment
- Base model: google-bert/bert-base-multilingual-cased (license: "apache-2.0")
