wannaphong mizchi commited on
Commit
85e3913
·
0 Parent(s):

Duplicate from mizchi/laya-multilingual-onnx

Browse files

Co-authored-by: Kotaro Chikuba <mizchi@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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/tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: convaiinnovations/laya-multilingual
4
+ library_name: onnxruntime
5
+ tags:
6
+ - onnx
7
+ - onnxruntime-web
8
+ - webgpu
9
+ - typed-decisions
10
+ - laya
11
+ ---
12
+
13
+ # Laya multilingual — ONNX (float16)
14
+
15
+ ONNX export of [convaiinnovations/laya-multilingual](https://huggingface.co/convaiinnovations/laya-multilingual)
16
+ (mmBERT-base encoder, 322M parameters) for onnxruntime, including onnxruntime-web with the WebGPU backend.
17
+ Produced by [laya-mlx](https://github.com/mizorewww/laya-mlx) with `laya-mlx export-onnx --dtype float16` from the
18
+ published [aac6fef/laya-multilingual-mlx](https://huggingface.co/aac6fef/laya-multilingual-mlx) checkpoint
19
+ (snapshot `f2b4faf51023039425946074e2cf1361d2db11d5`, itself converted from upstream revision
20
+ `052592a15d198d9ad47da779604259b10b47b7aa`).
21
+
22
+ | File | Purpose |
23
+ |---|---|
24
+ | `model.onnx` | Encoder, decision head, scorer and action head in one graph. Opset 18, standard operators only, float16 weights with a float32 decision tail. |
25
+ | `rl_agent_config.json` | Prompt limits (`max_len`, `head_max_len`) and calibration temperatures. |
26
+ | `tokenizer/` | Hugging Face `tokenizer.json` and `tokenizer_config.json`. |
27
+ | `onnx_config.json` | Export metadata: dtype, opset, input and output names, source checkpoint. |
28
+
29
+ Inputs: `input_ids`, `attention_mask` (int64 `[batch, sequence]`), `marker_pos` (int64 `[batch, markers]`),
30
+ `marker_mask` (bool `[batch, markers]`), `qtype` (int64 `[batch]`; 0 choice, 1 score, 2 noul). Outputs:
31
+ `logits` `[batch, markers]` and `act_logits` `[batch, actions]`, both float32. `logits` still need the
32
+ calibration temperature and a softmax. Prompt construction, calibration and answer formatting follow upstream
33
+ Laya; the reference implementation is `laya_mlx.common` / `laya_mlx.agent` and the browser port is
34
+ `@laya-mlx/web` in the repository.
35
+
36
+ Validation on the repository's 63-question parity fixtures against the MLX runtime: 63/63 selected answers
37
+ agree, maximum probability error 5.1e-4 with the onnxruntime CPU provider and 1.2e-2 with onnxruntime-web
38
+ WebGPU (float16 compute). See `docs/ONNX_EXPORT.md` in the repository for the method, the browser
39
+ measurements and the size analysis. onnxruntime-web 1.30.0 needs `graphOptimizationLevel: "basic"` on
40
+ WebGPU for this graph.
41
+
42
+ This is an independent port, not an official Convai Innovations release. Weights are Apache-2.0 as upstream.
43
+
44
+ Live demo: https://huggingface.co/spaces/mizchi/laya-web-demo (Snake and Chess, both run the model in your
45
+ browser — direct pages: https://mizchi-laya-web-demo.static.hf.space/snake.html and
46
+ https://mizchi-laya-web-demo.static.hf.space/chess.html) — also on the repository's GitHub Pages site (for the
47
+ `mizchi/laya-mlx` fork: https://mizchi.github.io/laya-mlx/).
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b095e005a4c295cae74d47b7eb6931c369d48f5b720b45278d774165798310c
3
+ size 646870871
onnx_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "laya-onnx",
3
+ "format_version": 1,
4
+ "dtype": "float16",
5
+ "opset": 18,
6
+ "inputs": [
7
+ "input_ids",
8
+ "attention_mask",
9
+ "marker_pos",
10
+ "marker_mask",
11
+ "qtype"
12
+ ],
13
+ "outputs": [
14
+ "logits",
15
+ "act_logits"
16
+ ],
17
+ "source": "aac6fef/laya-multilingual-mlx",
18
+ "revision": null,
19
+ "subfolder": null
20
+ }
rl_agent_config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "encoder": "jhu-clsp/mmBERT-base",
3
+ "head_layers": 2,
4
+ "max_len": 1024,
5
+ "head_max_len": 256,
6
+ "max_prefixes": 6,
7
+ "act_costs": {
8
+ "escalate": 0.5
9
+ },
10
+ "cost_wrong_act": 3.0,
11
+ "amp_dtype": "bf16",
12
+ "model_name": "rl-agent",
13
+ "temperature": [
14
+ 1.0,
15
+ 1.0,
16
+ 1.0
17
+ ],
18
+ "temperature_by_options": {},
19
+ "training": {
20
+ "updates": 15987,
21
+ "epochs_completed": 4,
22
+ "hours": 4.97,
23
+ "world_size": 1,
24
+ "fine_tuned_from_checkpoint": false
25
+ }
26
+ }
tokenizer/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:609d8f4c067cd3950f88594c5a802616cea245823836ef5848ee4fc40aab5b6f
3
+ size 34363188
tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<bos>",
3
+ "clean_up_tokenization_spaces": false,
4
+ "cls_token": "<bos>",
5
+ "eos_token": "<eos>",
6
+ "extra_special_tokens": {
7
+ "extra_0": "<start_of_turn>",
8
+ "extra_1": "<end_of_turn>"
9
+ },
10
+ "mask_token": "<mask>",
11
+ "model_input_names": [
12
+ "input_ids",
13
+ "attention_mask"
14
+ ],
15
+ "model_max_length": 8192,
16
+ "pad_token": "<pad>",
17
+ "padding_side": "right",
18
+ "sep_token": "<eos>",
19
+ "spaces_between_special_tokens": false,
20
+ "tokenizer_class": "PreTrainedTokenizerFast",
21
+ "unk_token": "<unk>"
22
+ }