3rd-Degree-Burn commited on
Commit
978c674
·
verified ·
1 Parent(s): cd065f5

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: transformers
4
+ tags:
5
+ - reward-model
6
+ - reranking
7
+ - literary-style
8
+ - faithfulness
9
+ - longformer
10
+ pipeline_tag: text-classification
11
+ ---
12
+
13
+ # LongformerRM-Unison
14
+
15
+ Absolute multi-head reward model for literary rewriting.
16
+
17
+ ## Heads
18
+ This model outputs 3 logits in this order:
19
+
20
+ 1. `style`
21
+ 2. `faith`
22
+ 3. `identifier`
23
+
24
+ Apply sigmoid to each logit to obtain scores in `[0, 1]`.
25
+
26
+ ## Intended use
27
+ Score a `(source passage, rewrite)` pair for:
28
+ - stylistic quality
29
+ - semantic/content faithfulness
30
+ - identifier preservation (names, dates, numbers, protected spans)
31
+
32
+ ## Important
33
+ This is **not** a comparative Bradley-Terry reward model.
34
+ It is an **absolute scorer**. Score each candidate independently, then sort externally.
35
+
36
+ ## Input format
37
+ Use exactly:
38
+
39
+ ### Original Draft:
40
+ {prompt}
41
+
42
+ ### Rewritten Version:
43
+ {response}
44
+
45
+ For Longformer inference, set `global_attention_mask[:, 0] = 1`.
46
+
47
+ ## Recommended composite score
48
+ `overall_score = style_score * (0.5 * faith_score + 0.5 * identifier_score) * (identifier_score ** 1.5)`
49
+
50
+ ## Output head order
51
+ `[style_logit, faith_logit, identifier_logit]`
52
+
53
+ ## Base model
54
+ `./absolute-multitask-reward-model`
config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "allenai/longformer-base-4096",
3
+ "architectures": [
4
+ "LongformerForSequenceClassification"
5
+ ],
6
+ "attention_mode": "longformer",
7
+ "attention_probs_dropout_prob": 0.1,
8
+ "attention_window": [
9
+ 512,
10
+ 512,
11
+ 512,
12
+ 512,
13
+ 512,
14
+ 512,
15
+ 512,
16
+ 512,
17
+ 512,
18
+ 512,
19
+ 512,
20
+ 512
21
+ ],
22
+ "bos_token_id": 0,
23
+ "eos_token_id": 2,
24
+ "gradient_checkpointing": false,
25
+ "hidden_act": "gelu",
26
+ "hidden_dropout_prob": 0.1,
27
+ "hidden_size": 768,
28
+ "id2label": {
29
+ "0": "LABEL_0",
30
+ "1": "LABEL_1",
31
+ "2": "LABEL_2"
32
+ },
33
+ "ignore_attention_mask": false,
34
+ "initializer_range": 0.02,
35
+ "intermediate_size": 3072,
36
+ "label2id": {
37
+ "LABEL_0": 0,
38
+ "LABEL_1": 1,
39
+ "LABEL_2": 2
40
+ },
41
+ "layer_norm_eps": 1e-05,
42
+ "max_position_embeddings": 4098,
43
+ "model_type": "longformer",
44
+ "num_attention_heads": 12,
45
+ "num_hidden_layers": 12,
46
+ "onnx_export": false,
47
+ "pad_token_id": 1,
48
+ "problem_type": "multi_label_classification",
49
+ "sep_token_id": 2,
50
+ "torch_dtype": "float32",
51
+ "transformers_version": "4.48.3",
52
+ "type_vocab_size": 1,
53
+ "use_cache": false,
54
+ "vocab_size": 50265
55
+ }
inference_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "absolute_multihead_reward_model",
3
+ "base_model": "./absolute-multitask-reward-model",
4
+ "num_labels": 3,
5
+ "label_order": [
6
+ "style",
7
+ "faith",
8
+ "identifier"
9
+ ],
10
+ "max_length": 1024,
11
+ "recommended_overall_formula": "style_score * (0.5 * faith_score + 0.5 * identifier_score) * (identifier_score ** 1.5)",
12
+ "notes": [
13
+ "Apply sigmoid to each logit before using scores.",
14
+ "Do not use style_score alone for reranking.",
15
+ "Keep input formatting consistent with training.",
16
+ "For Longformer inference, set global_attention_mask[:, 0] = 1."
17
+ ]
18
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5e1a73b2288d51d36b6b682b462a60f81e98566de95e9b1e9a477f1c5316f46
3
+ size 594681260
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": true,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": true,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": true,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": true,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": true,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<s>",
6
+ "lstrip": false,
7
+ "normalized": true,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<pad>",
14
+ "lstrip": false,
15
+ "normalized": true,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "</s>",
22
+ "lstrip": false,
23
+ "normalized": true,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<unk>",
30
+ "lstrip": false,
31
+ "normalized": true,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "50264": {
37
+ "content": "<mask>",
38
+ "lstrip": true,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ }
44
+ },
45
+ "bos_token": "<s>",
46
+ "clean_up_tokenization_spaces": false,
47
+ "cls_token": "<s>",
48
+ "eos_token": "</s>",
49
+ "errors": "replace",
50
+ "extra_special_tokens": {},
51
+ "mask_token": "<mask>",
52
+ "max_length": 1024,
53
+ "model_max_length": 1000000000000000019884624838656,
54
+ "pad_to_multiple_of": null,
55
+ "pad_token": "<pad>",
56
+ "pad_token_type_id": 0,
57
+ "padding_side": "right",
58
+ "sep_token": "</s>",
59
+ "stride": 0,
60
+ "tokenizer_class": "LongformerTokenizer",
61
+ "trim_offsets": true,
62
+ "truncation_side": "right",
63
+ "truncation_strategy": "longest_first",
64
+ "unk_token": "<unk>"
65
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:832cbd1d8fc4636ee25d0e16ea97e5fc6c54c12068318296ad9d45bd89998043
3
+ size 5777
vocab.json ADDED
The diff for this file is too large to render. See raw diff