Xabi Ezpeleta commited on
Commit
4e679d3
·
1 Parent(s): d144555

Update model card for int8 quantized models

Browse files
Files changed (1) hide show
  1. README.md +15 -5
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**: Float32 ONNX (required by ORT Web WASM — no float16 support on CPU backend)
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
- | `encoder_model.onnx` | 136 MB | Encoder (IR 8, opset 18, fp32) |
41
- | `decoder_model_merged.onnx` | 161 MB | Decoder with KV-cache (IR 8, opset 18, fp32) |
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.