Set the serving window to 2048 tokens
Browse files- README.md +8 -2
- manifest.json +4 -4
README.md
CHANGED
|
@@ -49,7 +49,13 @@ the scores sum to 1.
|
|
| 49 |
|---|---|
|
| 50 |
| `model.onnx` | Converted from `model.safetensors` at revision `35ca4a0469f180f1cf05a630df8842fa17ac18e3`. |
|
| 51 |
| `config.json`, `tokenizer.json`, `LICENSE` | Unchanged copies. |
|
| 52 |
-
| `manifest.json` | New. ort-server settings: `task: zero-shot-classification`, `max_length:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
The graph takes `input_ids`, `attention_mask`, `text_pool` `[b, 1, s]` and
|
| 55 |
`category_pool` `[b, r, s]`, and returns `logits` `[b, r]`. The label count `r`
|
|
@@ -76,7 +82,7 @@ curl -X POST http://localhost:13305/api/v1/classify \
|
|
| 76 |
```
|
| 77 |
|
| 78 |
```json
|
| 79 |
-
{"labels": {"Coding": 0.838, "Creative writing": 0.054, "General knowledge": 0.054, "Sales": 0.054}}
|
| 80 |
```
|
| 81 |
|
| 82 |
In a router policy, use the model in a `zero_shot` classifier. See Lemonade's
|
|
|
|
| 49 |
|---|---|
|
| 50 |
| `model.onnx` | Converted from `model.safetensors` at revision `35ca4a0469f180f1cf05a630df8842fa17ac18e3`. |
|
| 51 |
| `config.json`, `tokenizer.json`, `LICENSE` | Unchanged copies. |
|
| 52 |
+
| `manifest.json` | New. ort-server settings: `task: zero-shot-classification`, `max_length: 2048`. |
|
| 53 |
+
|
| 54 |
+
The window is 2,048 tokens. The position table holds 128,000, but this export
|
| 55 |
+
uses eager attention, so memory grows with the square of the window: about
|
| 56 |
+
1.4 GB extra at 2,048 tokens and 5.3 GB at 4,096. A longer text is cut, and the
|
| 57 |
+
response then has `"truncated": true`. To raise the window, pass ort-server's
|
| 58 |
+
`--max-length` (in Lemonade: `--onnxruntime-args "--max-length 4096"`).
|
| 59 |
|
| 60 |
The graph takes `input_ids`, `attention_mask`, `text_pool` `[b, 1, s]` and
|
| 61 |
`category_pool` `[b, r, s]`, and returns `logits` `[b, r]`. The label count `r`
|
|
|
|
| 82 |
```
|
| 83 |
|
| 84 |
```json
|
| 85 |
+
{"labels": {"Coding": 0.838, "Creative writing": 0.054, "General knowledge": 0.054, "Sales": 0.054}, "truncated": false}
|
| 86 |
```
|
| 87 |
|
| 88 |
In a router policy, use the model in a `zero_shot` classifier. See Lemonade's
|
manifest.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
{
|
| 2 |
-
"task": "zero-shot-classification",
|
| 3 |
-
"max_length":
|
| 4 |
-
}
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"task": "zero-shot-classification",
|
| 3 |
+
"max_length": 2048
|
| 4 |
+
}
|