Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- Fullstop.mlpackage/Data/com.apple.CoreML/model.mlmodel +3 -0
- Fullstop.mlpackage/Data/com.apple.CoreML/weights/weight.bin +3 -0
- Fullstop.mlpackage/Manifest.json +18 -0
- README.md +97 -0
- config.json +43 -0
- special_tokens_map.json +51 -0
- tokenizer.json +3 -0
- tokenizer_config.json +61 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
Fullstop.mlpackage/Data/com.apple.CoreML/model.mlmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:378902ce2639de1acca4a6e1fff34b880be9ccbe960524a396e113c62156389a
|
| 3 |
+
size 166537
|
Fullstop.mlpackage/Data/com.apple.CoreML/weights/weight.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:40cd27263f9342a5246b1c56e294991e972bc201fe2b5adf389240920ddc7a88
|
| 3 |
+
size 554930240
|
Fullstop.mlpackage/Manifest.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"fileFormatVersion": "1.0.0",
|
| 3 |
+
"itemInfoEntries": {
|
| 4 |
+
"254BBDFF-3048-447B-98B6-132ECD9143E4": {
|
| 5 |
+
"author": "com.apple.CoreML",
|
| 6 |
+
"description": "CoreML Model Specification",
|
| 7 |
+
"name": "model.mlmodel",
|
| 8 |
+
"path": "com.apple.CoreML/model.mlmodel"
|
| 9 |
+
},
|
| 10 |
+
"5892022E-3FFE-440D-B686-CB897CA3FDB2": {
|
| 11 |
+
"author": "com.apple.CoreML",
|
| 12 |
+
"description": "CoreML Model Weights",
|
| 13 |
+
"name": "weights",
|
| 14 |
+
"path": "com.apple.CoreML/weights"
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"rootModelIdentifier": "254BBDFF-3048-447B-98B6-132ECD9143E4"
|
| 18 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- de
|
| 6 |
+
- fr
|
| 7 |
+
- it
|
| 8 |
+
- nl
|
| 9 |
+
- multilingual
|
| 10 |
+
base_model: oliverguhr/fullstop-punctuation-multilingual-base
|
| 11 |
+
pipeline_tag: token-classification
|
| 12 |
+
library_name: coreml
|
| 13 |
+
tags:
|
| 14 |
+
- coreml
|
| 15 |
+
- punctuation-restoration
|
| 16 |
+
- token-classification
|
| 17 |
+
- xlm-roberta
|
| 18 |
+
- on-device
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# fullstop-coreml
|
| 22 |
+
|
| 23 |
+
`oliverguhr/fullstop-punctuation-multilingual-base` (XLM-RoBERTa token-classification,
|
| 24 |
+
~0.3 B) converted to **CoreML** (fp16) for on-device punctuation restoration —
|
| 25 |
+
downloaded on first use and run locally through CoreML + `swift-transformers`.
|
| 26 |
+
|
| 27 |
+
This is a **format conversion only** — the weights are unchanged from the upstream
|
| 28 |
+
PyTorch model. The model is a verbatim **token classifier**: it emits one punctuation
|
| 29 |
+
label per token, so it can add punctuation (`. , ? - :`) but can never reword the
|
| 30 |
+
input. Capitalization is handled separately (a heuristic restorer is typically chained
|
| 31 |
+
after it).
|
| 32 |
+
|
| 33 |
+
## Label map (`id2label`)
|
| 34 |
+
|
| 35 |
+
| id | label | meaning |
|
| 36 |
+
|----|-------|---------|
|
| 37 |
+
| 0 | `""` | no punctuation |
|
| 38 |
+
| 1 | `.` | period |
|
| 39 |
+
| 2 | `,` | comma |
|
| 40 |
+
| 3 | `?` | question mark |
|
| 41 |
+
| 4 | `-` | dash |
|
| 42 |
+
| 5 | `:` | colon |
|
| 43 |
+
|
| 44 |
+
## Files (repo layout)
|
| 45 |
+
|
| 46 |
+
The repo root is the folder a loader consumes directly:
|
| 47 |
+
|
| 48 |
+
| File | Purpose |
|
| 49 |
+
|------|---------|
|
| 50 |
+
| `Fullstop.mlpackage/` | CoreML model bundle (compile before load) |
|
| 51 |
+
| `tokenizer.json` | XLM-R Unigram tokenizer (HuggingFace `tokenizers`) |
|
| 52 |
+
| `tokenizer_config.json` | tokenizer config |
|
| 53 |
+
| `special_tokens_map.json` | XLM-R special tokens (`<s>`, `</s>`, `<pad>`, `<unk>`, `<mask>`) |
|
| 54 |
+
| `config.json` | model config incl. `id2label` / `label2id` |
|
| 55 |
+
|
| 56 |
+
## Loading (Swift)
|
| 57 |
+
|
| 58 |
+
```swift
|
| 59 |
+
// 1. Snapshot the repo (swift-transformers Hub):
|
| 60 |
+
// Hub.snapshot(from: Repo(id: "gregbarbosa/fullstop-coreml")) -> localDir
|
| 61 |
+
// 2. Compile + load the CoreML model, build the tokenizer from the same folder:
|
| 62 |
+
let compiled = try await MLModel.compileModel(at: localDir.appendingPathComponent("Fullstop.mlpackage"))
|
| 63 |
+
let model = try MLModel(contentsOf: compiled)
|
| 64 |
+
let tokenizer = try await AutoTokenizer.from(modelFolder: localDir)
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
Inference contract: feed `input_ids` (shape `[1, seq]`, natural length — no padding)
|
| 68 |
+
and `attention_mask`; the output logits are `[1, seq, 6]` → argmax per token yields the
|
| 69 |
+
label id above. Attach each **word's** punctuation from the label on its final subword
|
| 70 |
+
(token boundaries marked by the XLM-R `▁` U+2581 prefix); skip special tokens.
|
| 71 |
+
|
| 72 |
+
## Provenance
|
| 73 |
+
|
| 74 |
+
- **Source model:** [`oliverguhr/fullstop-punctuation-multilingual-base`](https://huggingface.co/oliverguhr/fullstop-punctuation-multilingual-base) (MIT)
|
| 75 |
+
- **Conversion:** PyTorch → ONNX → CoreML (fp16). Parity verified 15/15 labels identical
|
| 76 |
+
to the PyTorch reference across the conversion fixtures; tokenizer parity re-verified
|
| 77 |
+
on-device 2026-06-26.
|
| 78 |
+
- **Conversion harness:** `restore-bench` (standalone repo).
|
| 79 |
+
|
| 80 |
+
## License
|
| 81 |
+
|
| 82 |
+
MIT — same as the upstream model. Conversion produced by Greg Barbosa.
|
| 83 |
+
|
| 84 |
+
## Citation
|
| 85 |
+
|
| 86 |
+
```bibtex
|
| 87 |
+
@article{guhr-EtAl:2021:fullstop,
|
| 88 |
+
title={FullStop: Multilingual Deep Models for Punctuation Prediction},
|
| 89 |
+
author={Guhr, Oliver and Schumann, Anne-Kathrin and Bahrmann, Frank and B{\"o}hme, Hans Joachim},
|
| 90 |
+
booktitle={Proceedings of the Swiss Text Analytics Conference 2021},
|
| 91 |
+
month={June},
|
| 92 |
+
year={2021},
|
| 93 |
+
address={Winterthur, Switzerland},
|
| 94 |
+
publisher={CEUR Workshop Proceedings},
|
| 95 |
+
url={http://ceur-ws.org/Vol-2957/sepp_paper4.pdf}
|
| 96 |
+
}
|
| 97 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"XLMRobertaForTokenClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"bos_token_id": 0,
|
| 7 |
+
"classifier_dropout": null,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"hidden_act": "gelu",
|
| 11 |
+
"hidden_dropout_prob": 0.1,
|
| 12 |
+
"hidden_size": 768,
|
| 13 |
+
"id2label": {
|
| 14 |
+
"0": "0",
|
| 15 |
+
"1": ".",
|
| 16 |
+
"2": ",",
|
| 17 |
+
"3": "?",
|
| 18 |
+
"4": "-",
|
| 19 |
+
"5": ":"
|
| 20 |
+
},
|
| 21 |
+
"initializer_range": 0.02,
|
| 22 |
+
"intermediate_size": 3072,
|
| 23 |
+
"label2id": {
|
| 24 |
+
",": 2,
|
| 25 |
+
"-": 4,
|
| 26 |
+
".": 1,
|
| 27 |
+
"0": 0,
|
| 28 |
+
":": 5,
|
| 29 |
+
"?": 3
|
| 30 |
+
},
|
| 31 |
+
"layer_norm_eps": 1e-05,
|
| 32 |
+
"max_position_embeddings": 514,
|
| 33 |
+
"model_type": "xlm-roberta",
|
| 34 |
+
"num_attention_heads": 12,
|
| 35 |
+
"num_hidden_layers": 12,
|
| 36 |
+
"output_past": true,
|
| 37 |
+
"pad_token_id": 1,
|
| 38 |
+
"position_embedding_type": "absolute",
|
| 39 |
+
"transformers_version": "4.57.6",
|
| 40 |
+
"type_vocab_size": 1,
|
| 41 |
+
"use_cache": true,
|
| 42 |
+
"vocab_size": 250002
|
| 43 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"cls_token": {
|
| 10 |
+
"content": "<s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"eos_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"mask_token": {
|
| 24 |
+
"content": "<mask>",
|
| 25 |
+
"lstrip": true,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"pad_token": {
|
| 31 |
+
"content": "<pad>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
},
|
| 37 |
+
"sep_token": {
|
| 38 |
+
"content": "</s>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false
|
| 43 |
+
},
|
| 44 |
+
"unk_token": {
|
| 45 |
+
"content": "<unk>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false
|
| 50 |
+
}
|
| 51 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8373f9cd3d27591e1924426bcc1c8799bc5a9affc4fc857982c5d66668dd1f41
|
| 3 |
+
size 17082832
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": true,
|
| 3 |
+
"added_tokens_decoder": {
|
| 4 |
+
"0": {
|
| 5 |
+
"content": "<s>",
|
| 6 |
+
"lstrip": false,
|
| 7 |
+
"normalized": false,
|
| 8 |
+
"rstrip": false,
|
| 9 |
+
"single_word": false,
|
| 10 |
+
"special": true
|
| 11 |
+
},
|
| 12 |
+
"1": {
|
| 13 |
+
"content": "<pad>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"normalized": false,
|
| 16 |
+
"rstrip": false,
|
| 17 |
+
"single_word": false,
|
| 18 |
+
"special": true
|
| 19 |
+
},
|
| 20 |
+
"2": {
|
| 21 |
+
"content": "</s>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"normalized": false,
|
| 24 |
+
"rstrip": false,
|
| 25 |
+
"single_word": false,
|
| 26 |
+
"special": true
|
| 27 |
+
},
|
| 28 |
+
"3": {
|
| 29 |
+
"content": "<unk>",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"normalized": false,
|
| 32 |
+
"rstrip": false,
|
| 33 |
+
"single_word": false,
|
| 34 |
+
"special": true
|
| 35 |
+
},
|
| 36 |
+
"250001": {
|
| 37 |
+
"content": "<mask>",
|
| 38 |
+
"lstrip": true,
|
| 39 |
+
"normalized": false,
|
| 40 |
+
"rstrip": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": true
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"bos_token": "<s>",
|
| 46 |
+
"clean_up_tokenization_spaces": false,
|
| 47 |
+
"cls_token": "<s>",
|
| 48 |
+
"eos_token": "</s>",
|
| 49 |
+
"extra_special_tokens": {},
|
| 50 |
+
"mask_token": "<mask>",
|
| 51 |
+
"max_length": 512,
|
| 52 |
+
"model_max_length": 512,
|
| 53 |
+
"pad_token": "<pad>",
|
| 54 |
+
"sep_token": "</s>",
|
| 55 |
+
"stride": 0,
|
| 56 |
+
"strip_accent": false,
|
| 57 |
+
"tokenizer_class": "XLMRobertaTokenizerFast",
|
| 58 |
+
"truncation_side": "right",
|
| 59 |
+
"truncation_strategy": "longest_first",
|
| 60 |
+
"unk_token": "<unk>"
|
| 61 |
+
}
|