Translation
Transformers.js
ONNX
Basque
marian
text2text-generation
basque
euskara
capitalization
punctuation
restoration
txukun
quantized
int8
Instructions to use itzune/txukun-cap-punct-eu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use itzune/txukun-cap-punct-eu with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('translation', 'itzune/txukun-cap-punct-eu');
Xabi Ezpeleta commited on
Commit ·
4e679d3
1
Parent(s): d144555
Update model card for int8 quantized models
Browse files
README.md
CHANGED
|
@@ -11,12 +11,14 @@ tags:
|
|
| 11 |
- onnx
|
| 12 |
- transformers.js
|
| 13 |
- txukun
|
|
|
|
|
|
|
| 14 |
pipeline_tag: translation
|
| 15 |
---
|
| 16 |
|
| 17 |
# Txukun — Capitalization & Punctuation Restoration (ONNX)
|
| 18 |
|
| 19 |
-
ONNX export of [HiTZ/cap-punct-eu](https://huggingface.co/HiTZ/cap-punct-eu) for browser and edge inference with Transformers.js.
|
| 20 |
|
| 21 |
## Model
|
| 22 |
|
|
@@ -29,7 +31,7 @@ MarianMT model trained on 9.78M Basque sentences that restores capitalization an
|
|
| 29 |
- **Type**: MarianMT (6 encoder + 6 decoder layers)
|
| 30 |
- **d_model**: 512
|
| 31 |
- **Tokenizer**: SentencePiece (Unigram, 32k vocab), shipped as custom `tokenizer.json`
|
| 32 |
-
- **Format**:
|
| 33 |
- **Input**: Lowercase, punctuationless Basque text
|
| 34 |
- **Output**: Properly capitalized and punctuated Basque text
|
| 35 |
|
|
@@ -37,8 +39,8 @@ MarianMT model trained on 9.78M Basque sentences that restores capitalization an
|
|
| 37 |
|
| 38 |
| File | Size | Description |
|
| 39 |
|------|------|-------------|
|
| 40 |
-
| `
|
| 41 |
-
| `
|
| 42 |
| `tokenizer.json` | 2.1 MB | Custom Unigram + Metaspace pre-tokenizer |
|
| 43 |
| `config.json` | 979 B | Model configuration |
|
| 44 |
| `tokenizer_config.json` | 864 B | Tokenizer metadata |
|
|
@@ -52,7 +54,7 @@ import { pipeline } from '@huggingface/transformers';
|
|
| 52 |
const corrector = await pipeline(
|
| 53 |
'translation',
|
| 54 |
'itzune/txukun-cap-punct-eu',
|
| 55 |
-
{ device: 'wasm' }
|
| 56 |
);
|
| 57 |
|
| 58 |
const result = await corrector('kaixo zer moduz zaude');
|
|
@@ -60,6 +62,14 @@ console.log(result[0].translation_text);
|
|
| 60 |
// → "Kaixo, zer moduz zaude?"
|
| 61 |
```
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
## Part of Txukun
|
| 64 |
|
| 65 |
This model powers [Txukun](https://github.com/itzune/txukun), a browser-based Basque text cleaning tool. Visit [itzune.eus/txukun](https://itzune.eus/txukun/) to try it.
|
|
|
|
| 11 |
- onnx
|
| 12 |
- transformers.js
|
| 13 |
- txukun
|
| 14 |
+
- quantized
|
| 15 |
+
- int8
|
| 16 |
pipeline_tag: translation
|
| 17 |
---
|
| 18 |
|
| 19 |
# Txukun — Capitalization & Punctuation Restoration (ONNX)
|
| 20 |
|
| 21 |
+
ONNX export of [HiTZ/cap-punct-eu](https://huggingface.co/HiTZ/cap-punct-eu) for browser and edge inference with Transformers.js. Weights are dynamically quantized to int8 for faster downloads (77 MB vs 297 MB fp32).
|
| 22 |
|
| 23 |
## Model
|
| 24 |
|
|
|
|
| 31 |
- **Type**: MarianMT (6 encoder + 6 decoder layers)
|
| 32 |
- **d_model**: 512
|
| 33 |
- **Tokenizer**: SentencePiece (Unigram, 32k vocab), shipped as custom `tokenizer.json`
|
| 34 |
+
- **Format**: Int8 dynamically quantized ONNX (Q/DQ nodes, compatible with ORT Web WASM)
|
| 35 |
- **Input**: Lowercase, punctuationless Basque text
|
| 36 |
- **Output**: Properly capitalized and punctuated Basque text
|
| 37 |
|
|
|
|
| 39 |
|
| 40 |
| File | Size | Description |
|
| 41 |
|------|------|-------------|
|
| 42 |
+
| `encoder_model_quantized.onnx` | 34 MB | Encoder (IR 8, int8 quantized) |
|
| 43 |
+
| `decoder_model_merged_quantized.onnx` | 41 MB | Decoder with KV-cache (IR 8, int8 quantized) |
|
| 44 |
| `tokenizer.json` | 2.1 MB | Custom Unigram + Metaspace pre-tokenizer |
|
| 45 |
| `config.json` | 979 B | Model configuration |
|
| 46 |
| `tokenizer_config.json` | 864 B | Tokenizer metadata |
|
|
|
|
| 54 |
const corrector = await pipeline(
|
| 55 |
'translation',
|
| 56 |
'itzune/txukun-cap-punct-eu',
|
| 57 |
+
{ device: 'wasm', dtype: 'q8' }
|
| 58 |
);
|
| 59 |
|
| 60 |
const result = await corrector('kaixo zer moduz zaude');
|
|
|
|
| 62 |
// → "Kaixo, zer moduz zaude?"
|
| 63 |
```
|
| 64 |
|
| 65 |
+
## Quantization details
|
| 66 |
+
|
| 67 |
+
Dynamically quantized with `onnxruntime.quantization.quantize_dynamic(QuantType.QInt8, extra_options={"EnableSubgraph": True})`. The `EnableSubgraph` flag traverses into the `If`-node subgraphs of the merged decoder, quantizing `MatMul` operations in both branches. Results:
|
| 68 |
+
|
| 69 |
+
- Encoder: 136 MB → 34 MB (75% reduction)
|
| 70 |
+
- Decoder: 160 MB → 41 MB (74% reduction)
|
| 71 |
+
- **Total: 297 MB → 77 MB (74% reduction)**
|
| 72 |
+
|
| 73 |
## Part of Txukun
|
| 74 |
|
| 75 |
This model powers [Txukun](https://github.com/itzune/txukun), a browser-based Basque text cleaning tool. Visit [itzune.eus/txukun](https://itzune.eus/txukun/) to try it.
|