biztiger commited on
Commit
fb4fbb2
·
verified ·
1 Parent(s): b875fb2

Upload WebBERT v2 action classifier (ONNX + tokenizer + classes)

Browse files
Files changed (4) hide show
  1. README.md +95 -0
  2. webbert-classes.json +17 -0
  3. webbert-tokenizer.json +0 -0
  4. webbert.onnx +3 -0
README.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: onnx
4
+ tags:
5
+ - onnx
6
+ - distilbert
7
+ - text-classification
8
+ - browser-automation
9
+ - web-navigation
10
+ pipeline_tag: text-classification
11
+ datasets:
12
+ - custom
13
+ metrics:
14
+ - accuracy
15
+ - f1
16
+ model-index:
17
+ - name: webbert-action-classifier
18
+ results:
19
+ - task:
20
+ type: text-classification
21
+ name: Web Action Classification
22
+ metrics:
23
+ - name: Accuracy
24
+ type: accuracy
25
+ value: 0.909
26
+ - name: Macro F1
27
+ type: f1
28
+ value: 0.909
29
+ ---
30
+
31
+ # WebBERT Action Classifier
32
+
33
+ DistilBERT-based action classifier for web browser navigation. Given a task goal, page elements, and domain, predicts the next browser action.
34
+
35
+ ## Model Details
36
+
37
+ - **Base model:** distilbert-base-uncased
38
+ - **Fine-tuned on:** 9,025 synthetic + hard-case examples
39
+ - **Classes:** 15 web action types
40
+ - **Input format:** `[TASK] goal [ELEMENTS] label:type @(cx,cy) ... [PAGE] domain`
41
+ - **Max sequence length:** 256
42
+ - **Export format:** ONNX (opset 14)
43
+
44
+ ## Classes
45
+
46
+ click, type, scroll_down, scroll_up, wait, go_back, skip, extract_content, dismiss_popup, accept_cookies, fill_form, submit_form, click_next, download, select_dropdown
47
+
48
+ ## Performance
49
+
50
+ | Metric | Value |
51
+ |--------|-------|
52
+ | Overall Accuracy | 90.9% |
53
+ | Macro F1 | 0.909 |
54
+ | Typical scenarios | 92.0% |
55
+ | Complex edge cases | 89.5% |
56
+ | Inference latency (CPU) | ~5ms |
57
+ | Model size | ~256 MB |
58
+
59
+ ## Usage
60
+
61
+ ### Python (ONNX Runtime)
62
+
63
+ ```python
64
+ import onnxruntime as ort
65
+ from tokenizers import Tokenizer
66
+
67
+ session = ort.InferenceSession("webbert.onnx")
68
+ tokenizer = Tokenizer.from_file("webbert-tokenizer.json")
69
+ tokenizer.enable_padding(length=256, pad_id=0, pad_token="[PAD]")
70
+ tokenizer.enable_truncation(max_length=256)
71
+
72
+ text = "[TASK] click login button [ELEMENTS] Login:button @(0.50,0.30) [PAGE] example.com"
73
+ encoding = tokenizer.encode(text)
74
+
75
+ import numpy as np
76
+ input_ids = np.array([encoding.ids], dtype=np.int64)
77
+ attention_mask = np.array([encoding.attention_mask], dtype=np.int64)
78
+
79
+ outputs = session.run(None, {"input_ids": input_ids, "attention_mask": attention_mask})
80
+ pred = np.argmax(outputs[0], axis=-1)[0]
81
+ ```
82
+
83
+ ### Rust (ort + tokenizers)
84
+
85
+ Used in [nyaya-agent](https://github.com/biztiger/nyaya-agent) as Layer 2 in the browser navigation cascade.
86
+
87
+ ## Files
88
+
89
+ - `webbert.onnx` — ONNX model (DistilBERT fine-tuned, ~256 MB)
90
+ - `webbert-tokenizer.json` — HuggingFace tokenizer (single JSON file)
91
+ - `webbert-classes.json` — Ordered class label list
92
+
93
+ ## Training
94
+
95
+ Trained with HuggingFace Transformers on 9,025 examples (6,000 base + 3,025 hard-case disambiguation). 5 epochs, lr=2e-5, batch_size=32, warmup_steps=100.
webbert-classes.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "click",
3
+ "type",
4
+ "scroll_down",
5
+ "scroll_up",
6
+ "wait",
7
+ "go_back",
8
+ "skip",
9
+ "extract_content",
10
+ "dismiss_popup",
11
+ "accept_cookies",
12
+ "fill_form",
13
+ "submit_form",
14
+ "click_next",
15
+ "download",
16
+ "select_dropdown"
17
+ ]
webbert-tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
webbert.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06a9e29ad2e3f40702f373ab1867e5958cce2232c6b6b8bf6f3123a4b6d8a793
3
+ size 267999393