hunterschep commited on
Commit
aa46825
·
verified ·
1 Parent(s): 301d4cf

Standardize FormosanBank MT model card format

Browse files
Files changed (1) hide show
  1. README.md +19 -27
README.md CHANGED
@@ -70,16 +70,14 @@ model-index:
70
 
71
  **Repo:** `FormosanBank/nllb200-formosan-zh-spm8k`
72
  **Base model:** [`facebook/nllb-200-distilled-600M`](https://huggingface.co/facebook/nllb-200-distilled-600M)
73
- **Direction:** **Formosan -> Traditional Chinese** (`zho_Hant`)
74
  **Companion reverse-direction model:** [`FormosanBank/nllb200-zh-formosan-spm8k`](https://huggingface.co/FormosanBank/nllb200-zh-formosan-spm8k)
75
 
76
- This model is an NLLB-200 distilled 600M checkpoint adapted for machine translation from 15 Formosan languages into Traditional Chinese using an 8k SentencePiece vocabulary extension and FormosanBank control tags.
77
 
78
- This is a directional checkpoint. It is trained for this direction only; use the companion model for Chinese -> Formosan.
79
 
80
- ## Languages
81
-
82
- | Language | Code |
83
  |---|---|
84
  | Traditional Chinese | `zho_Hant` |
85
  | Amis | `ami_Latn` |
@@ -100,11 +98,11 @@ This is a directional checkpoint. It is trained for this direction only; use the
100
 
101
  ## Input Format
102
 
103
- This model was trained and evaluated with metadata control tags. Prefix the source text with:
104
 
105
  `<to_zh> <src_LANG> <dom_BUCKET> <dialect_DIALECT>`
106
 
107
- For example, Amis input with unknown metadata should use:
108
 
109
  `<to_zh> <src_ami> <dom_unknown> <dialect_default> Pa'araw cingra to demak nira.`
110
 
@@ -112,9 +110,9 @@ If source bucket or dialect is unknown, use `<dom_unknown>` and `<dialect_defaul
112
 
113
  ## Usage
114
 
115
- Tested with `transformers` 4.56.x. For NLLB generation, keep `decoder_start_token_id=tokenizer.eos_token_id` and set `forced_bos_token_id` to the target language ID.
116
 
117
- **Tokenizer note:** use the slow `NllbTokenizer` or `AutoTokenizer.from_pretrained(model_id, use_fast=False)`. In `transformers` 4.56.x the fast tokenizer can assign shifted IDs to added control tags, while training used the slow tokenizer IDs.
118
 
119
  ```python
120
  import torch
@@ -132,12 +130,7 @@ FORMOSAN_TO_LID = {
132
  "tsu": "tsu_Latn", "xnb": "xnb_Latn", "xsy": "xsy_Latn",
133
  }
134
 
135
- def translate_formosan_to_chinese(
136
- text: str,
137
- lang_code: str,
138
- source_bucket: str = "unknown",
139
- dialect: str = "default",
140
- ) -> str:
141
  tokenizer.src_lang = FORMOSAN_TO_LID[lang_code]
142
  prompt = f"<to_zh> <src_{lang_code}> <dom_{source_bucket}> <dialect_{dialect}> {text}"
143
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=384).to(model.device)
@@ -161,7 +154,7 @@ print(translate_formosan_to_chinese("Pa'araw cingra to demak nira.", "ami"))
161
 
162
  | Setting | Value |
163
  |---|---|
164
- | Corpus | FormosanBank Chinese Parallel Corpus, leakage-controlled `in_domain_hard` split |
165
  | Direction | `f2zh` |
166
  | Base model | `facebook/nllb-200-distilled-600M` |
167
  | Tokenizer | 8k Formosan SentencePiece extension |
@@ -178,13 +171,11 @@ print(translate_formosan_to_chinese("Pa'araw cingra to demak nira.", "ami"))
178
  | Language sampling alpha | 0.5 |
179
  | Metadata tags | enabled and validated as single tokenizer IDs |
180
 
181
- The final checkpoint is published because it scored higher than the best-by-validation-loss checkpoint on the held-out hard test set.
182
 
183
  ## Evaluation
184
 
185
- Evaluation was run on the held-out `in_domain_hard` test split with no normalized source/target/pair overlap against train. These scores are intentionally lower than leaky or near-duplicate splits and are meant to be a harder benchmark.
186
-
187
- SacreBLEU used Chinese tokenization (`tokenize=zh`) for BLEU in this direction.
188
 
189
  ### Global Metrics
190
 
@@ -212,18 +203,19 @@ SacreBLEU used Chinese tokenization (`tokenize=zh`) for BLEU in this direction.
212
  | Kanakanavu | `xnb_Latn` | 1,552 | 12.96 | 15.19 | 107.91 |
213
  | Saisiyat | `xsy_Latn` | 1,212 | 14.45 | 16.32 | 106.80 |
214
 
215
- The raw evaluation metrics are included in [`eval/metrics.json`](eval/metrics.json), including source-bucket and length-bin breakdowns.
216
 
217
  ## Intended Use
218
 
219
  - Research, teaching, and prototyping for Formosan-language MT.
220
- - Draft translation assistance where human review by knowledgeable speakers is available.
221
  - Comparative evaluation of low-resource MT methods on leakage-controlled FormosanBank splits.
222
 
223
  ## Limitations
224
 
225
  - Outputs can be incorrect, ungrammatical, incomplete, or culturally inappropriate.
226
- - The model is not suitable for legal, medical, safety-critical, or authoritative community-facing use without expert review.
 
227
  - Evaluation uses a hard split; BLEU should not be compared directly to older leaky or near-duplicate split results.
228
 
229
  ## License
@@ -233,10 +225,10 @@ Released under `cc-by-nc-4.0`. Some underlying corpus sources may carry addition
233
  ## Citation
234
 
235
  ```bibtex
236
- @misc{formosanbank_nllb200_spm8k_f2zh,
237
- title = {nllb200-formosan-zh-spm8k: Directional NLLB-200 MT for FormosanBank Chinese Parallel Corpus},
238
  author = {FormosanBank contributors},
239
  year = {2026},
240
- howpublished = {\url{https://huggingface.co/FormosanBank/nllb200-formosan-zh-spm8k}}
241
  }
242
  ```
 
70
 
71
  **Repo:** `FormosanBank/nllb200-formosan-zh-spm8k`
72
  **Base model:** [`facebook/nllb-200-distilled-600M`](https://huggingface.co/facebook/nllb-200-distilled-600M)
73
+ **Direction:** **Formosan -> Traditional Chinese**
74
  **Companion reverse-direction model:** [`FormosanBank/nllb200-zh-formosan-spm8k`](https://huggingface.co/FormosanBank/nllb200-zh-formosan-spm8k)
75
 
76
+ This is a directional NLLB-200 distilled 600M checkpoint for FormosanBank machine translation. It uses an 8k SentencePiece vocabulary extension plus FormosanBank metadata/control tags. Use the companion model for the reverse direction.
77
 
78
+ ## Supported Languages
79
 
80
+ | Language | NLLB code |
 
 
81
  |---|---|
82
  | Traditional Chinese | `zho_Hant` |
83
  | Amis | `ami_Latn` |
 
98
 
99
  ## Input Format
100
 
101
+ This model was trained and evaluated with metadata control tags. Prefix the source text in one of the supported Formosan languages with:
102
 
103
  `<to_zh> <src_LANG> <dom_BUCKET> <dialect_DIALECT>`
104
 
105
+ Example with unknown metadata:
106
 
107
  `<to_zh> <src_ami> <dom_unknown> <dialect_default> Pa'araw cingra to demak nira.`
108
 
 
110
 
111
  ## Usage
112
 
113
+ Tested with `transformers` 4.56.x. Use the slow `NllbTokenizer` or `AutoTokenizer.from_pretrained(model_id, use_fast=False)`. In `transformers` 4.56.x, fast-tokenizer added-token IDs can differ from the slow tokenizer IDs used during training.
114
 
115
+ For NLLB generation, keep `decoder_start_token_id=tokenizer.eos_token_id` and set `forced_bos_token_id` to the target language ID.
116
 
117
  ```python
118
  import torch
 
130
  "tsu": "tsu_Latn", "xnb": "xnb_Latn", "xsy": "xsy_Latn",
131
  }
132
 
133
+ def translate_formosan_to_chinese(text: str, lang_code: str, source_bucket: str = "unknown", dialect: str = "default") -> str:
 
 
 
 
 
134
  tokenizer.src_lang = FORMOSAN_TO_LID[lang_code]
135
  prompt = f"<to_zh> <src_{lang_code}> <dom_{source_bucket}> <dialect_{dialect}> {text}"
136
  inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=384).to(model.device)
 
154
 
155
  | Setting | Value |
156
  |---|---|
157
+ | Corpus | FormosanBank Chinese Parallel Corpus, leakage-controlled in-domain hard split |
158
  | Direction | `f2zh` |
159
  | Base model | `facebook/nllb-200-distilled-600M` |
160
  | Tokenizer | 8k Formosan SentencePiece extension |
 
171
  | Language sampling alpha | 0.5 |
172
  | Metadata tags | enabled and validated as single tokenizer IDs |
173
 
174
+ This repo publishes the final 300k-step checkpoint because it scored highest on the held-out hard test set among the evaluated final/best checkpoints.
175
 
176
  ## Evaluation
177
 
178
+ Evaluation used the held-out `in_domain_hard` test split with no normalized source, target, or pair overlap against train. These scores are intentionally lower than leaky or near-duplicate splits and are intended as a harder MT benchmark.
 
 
179
 
180
  ### Global Metrics
181
 
 
203
  | Kanakanavu | `xnb_Latn` | 1,552 | 12.96 | 15.19 | 107.91 |
204
  | Saisiyat | `xsy_Latn` | 1,212 | 14.45 | 16.32 | 106.80 |
205
 
206
+ Full source-bucket and length-bin breakdowns are available in [`eval/metrics.json`](eval/metrics.json).
207
 
208
  ## Intended Use
209
 
210
  - Research, teaching, and prototyping for Formosan-language MT.
211
+ - Draft translation assistance where review by knowledgeable speakers is available.
212
  - Comparative evaluation of low-resource MT methods on leakage-controlled FormosanBank splits.
213
 
214
  ## Limitations
215
 
216
  - Outputs can be incorrect, ungrammatical, incomplete, or culturally inappropriate.
217
+ - Generation into Formosan languages is especially difficult and should be treated as draft-only.
218
+ - This model is not suitable for legal, medical, safety-critical, or authoritative community-facing use without expert review.
219
  - Evaluation uses a hard split; BLEU should not be compared directly to older leaky or near-duplicate split results.
220
 
221
  ## License
 
225
  ## Citation
226
 
227
  ```bibtex
228
+ @misc{formosanbank_nllb200_formosan_zh_spm8k,
229
+ title = {nllb200-formosan-zh-spm8k: Directional NLLB-200 MT for the FormosanBank Chinese Parallel Corpus, leakage-controlled in-domain hard split},
230
  author = {FormosanBank contributors},
231
  year = {2026},
232
+ url = {https://huggingface.co/FormosanBank/nllb200-formosan-zh-spm8k}
233
  }
234
  ```