| --- |
| license: apache-2.0 |
| language: |
| - zh |
| tags: |
| - chinese |
| - cws |
| - pos |
| - ner |
| - multi-task |
| - bert |
| library_name: pytorch |
| --- |
| |
| # BERTc-315M-MT |
|
|
| BERTc-315M-MT is a Chinese multi-task tagging model fine-tuned from |
| `Ismantic/BERTc-315M`. It predicts: |
|
|
| - CWS: Chinese word segmentation |
| - POS: PD-1998 POS tags mapped to the LTP tag set |
| - NER: Nh / Ns / Ni entity spans in BIES format |
|
|
| ## Metrics |
|
|
| PD-1998 dev joint score: |
|
|
| - Joint score: **1.4712** |
| - CWS micro F1: **0.9840** |
| - POS per-word acc: **0.9800** |
| - NER micro F1: **0.9660** |
|
|
| Training recipe: |
|
|
| - backbone: `Ismantic/BERTc-315M` |
| - epochs: 5 |
| - batch size: 64 |
| - learning rate: `bert_lr=2e-5`, `head_lr=5e-4` |
| - warmup ratio: 0.1 |
| - FGM: enabled, `eps=1.0` |
| - loss weights: `alpha_pos=2.0`, `beta_ner=0.5` |
|
|
| ## Files |
|
|
| - `model.safetensors`: MT state dict for the backbone and task heads. |
| - `config.json`: BERTc backbone architecture. |
| - `model.py`: Modern BERTc implementation. |
| - `mt_model.py`: MT wrapper, tokenizer adapter, and decode helpers. |
| - `piece.model`: tokenizer model; load with `piece_tokenizer` using `cn_dict="no"`. |
| - `mask_token_id.txt`: mask token id used by the backbone tokenizer. |
| - `mt_config.json`: task metadata and source checkpoint. |
|
|
| ## Usage |
|
|
| ```python |
| from mt_model import BERTcForMT, PieceCharTokenizer |
| |
| tok = PieceCharTokenizer(".") |
| model = BERTcForMT.from_pretrained(".") |
| out = model.predict("中华人民共和国万岁", tok) |
| print(out["words"]) |
| print(out["pos"]) |
| print(out["ner"]) |
| ``` |
|
|