Instructions to use ArthurZ/von with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ArthurZ/von with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ArthurZ/von", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Decision config, template and head
Browse files- README.md +27 -0
- decision_config.json +10 -0
- decision_head/config.json +28 -0
- decision_head/model.safetensors +3 -0
- decision_template.jinja +33 -0
- decision_test.json +158 -0
README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: wfzyx/von
|
| 4 |
+
library_name: transformers
|
| 5 |
+
tags:
|
| 6 |
+
- decision
|
| 7 |
+
- systemone
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# wfzyx/von: decision files
|
| 11 |
+
|
| 12 |
+
Chat template, settings and head of [wfzyx/von](https://huggingface.co/wfzyx/von) for `pipeline("decision")`
|
| 13 |
+
([transformers#49566](https://github.com/huggingface/transformers/pull/49566)). The backbone stays the original checkpoint.
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
from transformers import pipeline
|
| 17 |
+
|
| 18 |
+
decide = pipeline("decision", model="wfzyx/von", decision_config="ArthurZ/von")
|
| 19 |
+
decide({"state": "I was charged twice and want a refund.", "questions": {"refund": {"type": "noul", "instructions": "Is a refund requested?"}}})
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
- `decision_template.jinja`: the chat template; `<|mark|>` marks the positions the head reads.
|
| 23 |
+
- `decision_config.json`: temperatures and option order.
|
| 24 |
+
- `decision_head/`: `VonDecisionHead`, converted from `option_marker.pt` of the original.
|
| 25 |
+
- `decision_test.json`: a request and the input ids that the original code builds for it, used by the tests.
|
| 26 |
+
|
| 27 |
+
Derived from [wfzyx/von](https://huggingface.co/wfzyx/von) (Apache-2.0).
|
decision_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"labels": {},
|
| 3 |
+
"temperature": {},
|
| 4 |
+
"noul_options": [
|
| 5 |
+
"true",
|
| 6 |
+
"false"
|
| 7 |
+
],
|
| 8 |
+
"sort_choices": false,
|
| 9 |
+
"adapter": null
|
| 10 |
+
}
|
decision_head/config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"VonDecisionHead"
|
| 4 |
+
],
|
| 5 |
+
"calibration": {
|
| 6 |
+
"bias": 2.0151,
|
| 7 |
+
"entropy": -3.2369,
|
| 8 |
+
"hi": 12.0,
|
| 9 |
+
"lo": 0.3,
|
| 10 |
+
"log_tokens": 11.4916,
|
| 11 |
+
"n_options": -3.5574
|
| 12 |
+
},
|
| 13 |
+
"dtype": "float32",
|
| 14 |
+
"hidden_size": 1024,
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"model_type": "von",
|
| 17 |
+
"noul_band": [
|
| 18 |
+
0.8,
|
| 19 |
+
0.1
|
| 20 |
+
],
|
| 21 |
+
"noul_prior": {
|
| 22 |
+
"a": -0.5,
|
| 23 |
+
"b": 0.3
|
| 24 |
+
},
|
| 25 |
+
"sliding_window": 64,
|
| 26 |
+
"temperature": 2.2,
|
| 27 |
+
"transformers_version": "5.19.0.dev0"
|
| 28 |
+
}
|
decision_head/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afd5bb48bdb29c4ea110d87b65374475618c45da459f1bc5159fb4abc5c98d80
|
| 3 |
+
size 2114212
|
decision_template.jinja
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{#- wfzyx/von (von-sdk 1.3.7 OptionMarkerBackend + OptionMarkerModel.pack_sequence): ONE sequence per question.
|
| 2 |
+
block = "[CLS]{question} {state} [SEP] [MASK] {option 0} [MASK] {option 1} ...[SEP]" (= [CLS] + packed + [SEP]),
|
| 3 |
+
with <|mark|> after every [MASK] (head reads mark - 1) and after the closing [SEP] (block end).
|
| 4 |
+
A noul question without criteria gets a second block with an empty state (von's zero-shot "null" pass).
|
| 5 |
+
The raw state text follows the last block: the head counts its tokens (von's temperature feature) and drops it
|
| 6 |
+
before the backbone. Options follow question.options (decision_config: noul_options = ["true", "false"]). -#}
|
| 7 |
+
{%- macro js(x) %}{{ x|tojson(ensure_ascii=true, sort_keys=x is mapping) }}{% endmacro -%}
|
| 8 |
+
{%- macro txt(x) %}{{ "" if x is none else x if x is string else js(x) if x is mapping or x is sequence else x|string }}{% endmacro -%}
|
| 9 |
+
{%- macro neut(x) %}{{ x|replace("[MASK]", "[MASK]")|replace("[SEP]", "[SEP]") }}{% endmacro -%}
|
| 10 |
+
{%- macro block(prefix, options) %}{{ "[CLS]" ~ prefix ~ " [SEP]" }}{% for o in options %}{{ " [MASK]<|mark|> " ~ o }}{% endfor %}{{ "[SEP]<|mark|>" }}{% endmacro -%}
|
| 11 |
+
{#- state: _format_state; dict -> "key: value" lines with Python str() values -#}
|
| 12 |
+
{%- if state is string %}{% set st = state %}
|
| 13 |
+
{%- elif state is mapping %}{% set ns = namespace(lines=[]) %}{% for k, v in state.items() %}{% set ns.lines = ns.lines + [k ~ ": " ~ v] %}{% endfor %}{% set st = ns.lines|join("\n") %}
|
| 14 |
+
{%- else %}{% set st = state|string %}{% endif -%}
|
| 15 |
+
{%- set q = neut(txt(question.instructions)) -%}
|
| 16 |
+
{%- set s = neut(st) -%}
|
| 17 |
+
{%- set opts = namespace(items=[]) -%}
|
| 18 |
+
{%- for key in question.options -%}
|
| 19 |
+
{%- set d = question.descriptions[loop.index0] -%}
|
| 20 |
+
{%- if question.type == "score" -%}
|
| 21 |
+
{%- set o = (d.get("what", "")|string ~ (" Examples: " ~ d.get("examples")|join(", ") if d.get("examples") else ""))|trim if d is mapping else d|string|trim -%}
|
| 22 |
+
{%- elif question.type == "noul" -%}
|
| 23 |
+
{%- set o = txt(d) or {"true": "Yes, condition holds true.", "false": "No, condition is false."}[key] -%}
|
| 24 |
+
{%- else -%}
|
| 25 |
+
{%- set o = txt(d)|trim if txt(d) else key|trim -%}
|
| 26 |
+
{%- endif -%}
|
| 27 |
+
{%- set opts.items = opts.items + [neut(o)|trim] -%}
|
| 28 |
+
{%- endfor -%}
|
| 29 |
+
{{- block((q ~ " " ~ s)|trim if q else s|trim, opts.items) -}}
|
| 30 |
+
{%- if question.type == "noul" and not (txt(question.descriptions[0]) or txt(question.descriptions[1])) -%}
|
| 31 |
+
{{- block(q|trim, opts.items) -}}
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
{{- st -}}
|
decision_test.json
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
"msg": "Refund please"
|
| 7 |
+
},
|
| 8 |
+
"questions": {
|
| 9 |
+
"intent": {
|
| 10 |
+
"type": "choice",
|
| 11 |
+
"instructions": "What is wanted?",
|
| 12 |
+
"criteria": {
|
| 13 |
+
"refund": "money back",
|
| 14 |
+
"other": null
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"urgent": {
|
| 18 |
+
"type": "noul",
|
| 19 |
+
"instructions": "Urgent?"
|
| 20 |
+
},
|
| 21 |
+
"tone": {
|
| 22 |
+
"type": "score",
|
| 23 |
+
"instructions": "Tone",
|
| 24 |
+
"criteria": [
|
| 25 |
+
"calm",
|
| 26 |
+
"angry"
|
| 27 |
+
]
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"sequences": [
|
| 32 |
+
{
|
| 33 |
+
"input_ids": [
|
| 34 |
+
50281,
|
| 35 |
+
1276,
|
| 36 |
+
310,
|
| 37 |
+
3078,
|
| 38 |
+
32,
|
| 39 |
+
14441,
|
| 40 |
+
27,
|
| 41 |
+
7567,
|
| 42 |
+
1504,
|
| 43 |
+
4496,
|
| 44 |
+
209,
|
| 45 |
+
50282,
|
| 46 |
+
50284,
|
| 47 |
+
2583,
|
| 48 |
+
896,
|
| 49 |
+
50284,
|
| 50 |
+
643,
|
| 51 |
+
50282,
|
| 52 |
+
4856,
|
| 53 |
+
27,
|
| 54 |
+
7567,
|
| 55 |
+
1504,
|
| 56 |
+
4496
|
| 57 |
+
],
|
| 58 |
+
"marks": [
|
| 59 |
+
13,
|
| 60 |
+
16,
|
| 61 |
+
18
|
| 62 |
+
]
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"input_ids": [
|
| 66 |
+
50281,
|
| 67 |
+
29796,
|
| 68 |
+
7322,
|
| 69 |
+
32,
|
| 70 |
+
14441,
|
| 71 |
+
27,
|
| 72 |
+
7567,
|
| 73 |
+
1504,
|
| 74 |
+
4496,
|
| 75 |
+
209,
|
| 76 |
+
50282,
|
| 77 |
+
50284,
|
| 78 |
+
6279,
|
| 79 |
+
13,
|
| 80 |
+
1617,
|
| 81 |
+
6556,
|
| 82 |
+
2032,
|
| 83 |
+
15,
|
| 84 |
+
50284,
|
| 85 |
+
1621,
|
| 86 |
+
13,
|
| 87 |
+
1617,
|
| 88 |
+
310,
|
| 89 |
+
3221,
|
| 90 |
+
15,
|
| 91 |
+
50282,
|
| 92 |
+
50281,
|
| 93 |
+
29796,
|
| 94 |
+
7322,
|
| 95 |
+
32,
|
| 96 |
+
209,
|
| 97 |
+
50282,
|
| 98 |
+
50284,
|
| 99 |
+
6279,
|
| 100 |
+
13,
|
| 101 |
+
1617,
|
| 102 |
+
6556,
|
| 103 |
+
2032,
|
| 104 |
+
15,
|
| 105 |
+
50284,
|
| 106 |
+
1621,
|
| 107 |
+
13,
|
| 108 |
+
1617,
|
| 109 |
+
310,
|
| 110 |
+
3221,
|
| 111 |
+
15,
|
| 112 |
+
50282,
|
| 113 |
+
4856,
|
| 114 |
+
27,
|
| 115 |
+
7567,
|
| 116 |
+
1504,
|
| 117 |
+
4496
|
| 118 |
+
],
|
| 119 |
+
"marks": [
|
| 120 |
+
12,
|
| 121 |
+
19,
|
| 122 |
+
26,
|
| 123 |
+
33,
|
| 124 |
+
40,
|
| 125 |
+
47
|
| 126 |
+
]
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"input_ids": [
|
| 130 |
+
50281,
|
| 131 |
+
53,
|
| 132 |
+
531,
|
| 133 |
+
14441,
|
| 134 |
+
27,
|
| 135 |
+
7567,
|
| 136 |
+
1504,
|
| 137 |
+
4496,
|
| 138 |
+
209,
|
| 139 |
+
50282,
|
| 140 |
+
50284,
|
| 141 |
+
11874,
|
| 142 |
+
50284,
|
| 143 |
+
11790,
|
| 144 |
+
50282,
|
| 145 |
+
4856,
|
| 146 |
+
27,
|
| 147 |
+
7567,
|
| 148 |
+
1504,
|
| 149 |
+
4496
|
| 150 |
+
],
|
| 151 |
+
"marks": [
|
| 152 |
+
11,
|
| 153 |
+
13,
|
| 154 |
+
15
|
| 155 |
+
]
|
| 156 |
+
}
|
| 157 |
+
]
|
| 158 |
+
}
|