FireRedPunc-coreml / README.md
kukumonster's picture
FireRedPunc converted to Core ML (float16), with LICENSE and NOTICE
4293e0b verified
|
Raw History Blame Contribute Delete
3.95 kB
---
license: apache-2.0
base_model: FireRedTeam/FireRedPunc
library_name: coreml
language:
- zh
- en
tags:
- punctuation
- coreml
- chinese
pipeline_tag: token-classification
---
# FireRedPunc (Core ML, float16)
A Core ML conversion of [FireRedTeam/FireRedPunc](https://huggingface.co/FireRedTeam/FireRedPunc), which adds Chinese punctuation (,。?!) to unpunctuated text, for use on Apple devices.
本 repo 是 FireRedTeam/FireRedPunc 的 Core ML(float16)轉檔,授權與上游相同,為 Apache-2.0。
> **Unofficial conversion.** This repository is not affiliated with or endorsed by FireRedTeam or HFL. For the original model, see [FireRedTeam/FireRedPunc](https://huggingface.co/FireRedTeam/FireRedPunc).
>
> 這是非官方轉檔,與 FireRedTeam、HFL 無關,也未經其背書。原版模型請見 FireRedTeam/FireRedPunc。
## Files
| File | Bytes | SHA-256 |
|---|---:|---|
| `FireRedPunc.mlpackage/Manifest.json` | 617 | `155fd4a87b00abdfe8bb23a82da6575ffefba76a3c8877efc1fd1f3f567e7ada` |
| `FireRedPunc.mlpackage/Data/com.apple.CoreML/model.mlmodel` | 192723 | `914c6894126992b8df5c3aa04d88b4c0556ce03e5be2afc8327d43f596b3d6ad` |
| `FireRedPunc.mlpackage/Data/com.apple.CoreML/weights/weight.bin` | 203378752 | `44f0b1c22cbef0e6b993d0b44bd128657114dd83745aad4786c3a12fef5065d9` |
| `vocab.txt` | 109540 | `45bbac6b341c319adc98a532532882e91a9cefc0329aa57bac9ae761c27b291c` |
## Model
- Input `input_ids`: Int32, shape `[1, L]`, L from 2 to 512. Position 0 is `[CLS]` (101), followed by the token ids of one piece of text; no `[SEP]`.
- Output `logits`: `[1, L, 5]`. Position 0 is `[CLS]`. The classes are: none, ,, 。, ?, !. Each predicted mark goes right after its token.
- Tokens come from `vocab.txt` (one token per line, the line number is the id). It is the vocabulary of [hfl/chinese-bert-wwm-ext](https://huggingface.co/hfl/chinese-bert-wwm-ext) (same SHA-256 as its `vocab.txt` at `2a995a8`), as shipped by FireRedPunc.
- Minimum deployment target: macOS 15.
- There is no attention mask input: the model takes one piece of text at a time. With a mask, BERT's `(1 - mask) * float32.min` overflows to -inf in float16, and the logits become NaN.
## Conversion
- Source: [FireRedTeam/FireRedPunc](https://huggingface.co/FireRedTeam/FireRedPunc) @ `e448fd967f44182a1c323cc30f5d89f2400c28da` (`model.pth.tar`, with its bundled `chinese-lert-base` encoder and `chinese-bert-wwm-ext_vocab.txt`).
- Tools: torch 2.7 and coremltools 9, traced and converted to an ML program in float16. The weights are converted only; nothing was trained or changed otherwise.
- Check: on our development text (about 60-character pieces of speech-recognition output), 99.93% of the tokens get the same predicted class as the PyTorch float32 model. This is our own measurement, not the authors'.
## Credits and licenses
- **FireRedPunc** by FireRedTeam: Apache-2.0 ([model card](https://huggingface.co/FireRedTeam/FireRedPunc)).
- **LERT** (`hfl/chinese-lert-base`) by the Joint Laboratory of HIT and iFLYTEK Research (HFL), the encoder FireRedPunc is built on: Apache-2.0 ([model card](https://huggingface.co/hfl/chinese-lert-base)).
- **Chinese BERT-wwm** (`hfl/chinese-bert-wwm-ext`) by HFL, the source of `vocab.txt`: Apache-2.0 ([model card](https://huggingface.co/hfl/chinese-bert-wwm-ext)).
This conversion is distributed under the Apache License 2.0; see `LICENSE` and `NOTICE`.
## Citation
If you use this model, please cite the upstream work, as the FireRedPunc model card asks:
```bibtex
@article{xu2026fireredasr2s,
title={FireRedASR2S: A State-of-the-Art Industrial-Grade All-in-One Automatic Speech Recognition System},
author={Xu, Kaituo and Jia, Yan and Huang, Kai and Chen, Junjie and Li, Wenpeng and Liu, Kun and Xie, Feng-Long and Tang, Xu and Hu, Yao},
journal={arXiv preprint arXiv:2603.10420},
year={2026}
}
```
For LERT and Chinese BERT-wwm, see the citations on their model cards.