arnocandel commited on
Commit
486e1ef
1 Parent(s): 04a35e1

Add h2oGPT based on Falcon 40B

Browse files
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "tiiuae/falcon-40b",
3
+ "alibi": false,
4
+ "apply_residual_connection_post_layernorm": false,
5
+ "architectures": [
6
+ "RWForCausalLM"
7
+ ],
8
+ "attention_dropout": 0.0,
9
+ "auto_map": {
10
+ "AutoConfig": "tiiuae/falcon-40b--configuration_RW.RWConfig",
11
+ "AutoModel": "tiiuae/falcon-40b--modelling_RW.RWModel",
12
+ "AutoModelForCausalLM": "tiiuae/falcon-40b--modelling_RW.RWForCausalLM",
13
+ "AutoModelForQuestionAnswering": "tiiuae/falcon-40b--modelling_RW.RWForQuestionAnswering",
14
+ "AutoModelForSequenceClassification": "tiiuae/falcon-40b--modelling_RW.RWForSequenceClassification",
15
+ "AutoModelForTokenClassification": "tiiuae/falcon-40b--modelling_RW.RWForTokenClassification"
16
+ },
17
+ "bias": false,
18
+ "bos_token_id": 11,
19
+ "custom_pipelines": {
20
+ "text-generation": {
21
+ "impl": "h2oai_pipeline.H2OTextGenerationPipeline",
22
+ "pt": "AutoModelForCausalLM"
23
+ }
24
+ },
25
+ "eos_token_id": 11,
26
+ "hidden_dropout": 0.0,
27
+ "hidden_size": 8192,
28
+ "initializer_range": 0.02,
29
+ "layer_norm_epsilon": 1e-05,
30
+ "model_type": "RefinedWeb",
31
+ "n_head": 128,
32
+ "n_head_kv": 8,
33
+ "n_layer": 60,
34
+ "parallel_attn": true,
35
+ "torch_dtype": "float16",
36
+ "transformers_version": "4.30.0.dev0",
37
+ "use_cache": true,
38
+ "vocab_size": 65024
39
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.30.0.dev0"
6
+ }
h2oai_pipeline.py ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import TextGenerationPipeline
2
+ from transformers.pipelines.text_generation import ReturnType
3
+
4
+ from stopping import get_stopping
5
+ from prompter import Prompter
6
+
7
+
8
+ class H2OTextGenerationPipeline(TextGenerationPipeline):
9
+ def __init__(self, *args, debug=False, chat=False, stream_output=False,
10
+ sanitize_bot_response=True,
11
+ use_prompter=True, prompter=None, prompt_type=None,
12
+ max_input_tokens=2048 - 256, **kwargs):
13
+ """
14
+ HF-like pipeline, but handle instruction prompting and stopping (for some models)
15
+ :param args:
16
+ :param debug:
17
+ :param chat:
18
+ :param stream_output:
19
+ :param sanitize_bot_response:
20
+ :param use_prompter: Whether to use prompter. If pass prompt_type, will make prompter
21
+ :param prompter: prompter, can pass if have already
22
+ :param prompt_type: prompt_type, e.g. human_bot. See prompt_type to model mapping in from prompter.py.
23
+ If use_prompter, then will make prompter and use it.
24
+ :param max_input_tokens:
25
+ :param kwargs:
26
+ """
27
+ super().__init__(*args, **kwargs)
28
+ self.prompt_text = None
29
+ self.use_prompter = use_prompter
30
+ self.prompt_type = prompt_type
31
+ self.prompter = prompter
32
+ if self.use_prompter:
33
+ if self.prompter is not None:
34
+ assert self.prompter.prompt_type is not None
35
+ else:
36
+ self.prompter = Prompter(self.prompt_type, debug=debug, chat=chat, stream_output=stream_output)
37
+ self.human = self.prompter.humanstr
38
+ self.bot = self.prompter.botstr
39
+ self.can_stop = True
40
+ else:
41
+ self.prompter = None
42
+ self.human = None
43
+ self.bot = None
44
+ self.can_stop = False
45
+ self.sanitize_bot_response = sanitize_bot_response
46
+ self.max_input_tokens = max_input_tokens # not for generate, so ok that not kwargs
47
+
48
+ def preprocess(self, prompt_text, prefix="", handle_long_generation=None, **generate_kwargs):
49
+ data_point = dict(context='', instruction=prompt_text, input='')
50
+ if self.prompter is not None:
51
+ prompt_text = self.prompter.generate_prompt(data_point)
52
+ self.prompt_text = prompt_text
53
+ if handle_long_generation is None:
54
+ # forces truncation of inputs to avoid critical failure
55
+ handle_long_generation = 'hole'
56
+ return super().preprocess(prompt_text, prefix=prefix, handle_long_generation=handle_long_generation,
57
+ **generate_kwargs)
58
+
59
+ def postprocess(self, model_outputs, return_type=ReturnType.FULL_TEXT, clean_up_tokenization_spaces=True):
60
+ records = super().postprocess(model_outputs, return_type=return_type,
61
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces)
62
+ for rec in records:
63
+ if self.use_prompter:
64
+ outputs = rec['generated_text']
65
+ outputs = self.prompter.get_response(outputs, prompt=self.prompt_text,
66
+ sanitize_bot_response=self.sanitize_bot_response)
67
+ elif self.bot and self.human:
68
+ outputs = rec['generated_text'].split(self.bot)[1].strip().split(self.human)[0].strip()
69
+ else:
70
+ outputs = rec['generated_text']
71
+ rec['generated_text'] = outputs
72
+ return records
73
+
74
+ def _forward(self, model_inputs, **generate_kwargs):
75
+ if self.can_stop:
76
+ stopping_criteria = get_stopping(self.prompt_type, self.tokenizer, self.device, human=self.human,
77
+ bot=self.bot)
78
+ generate_kwargs['stopping_criteria'] = stopping_criteria
79
+ # return super()._forward(model_inputs, **generate_kwargs)
80
+ return self.__forward(model_inputs, **generate_kwargs)
81
+
82
+ # FIXME: Copy-paste of original _forward, but removed copy.deepcopy()
83
+ # FIXME: https://github.com/h2oai/h2ogpt/issues/172
84
+ def __forward(self, model_inputs, **generate_kwargs):
85
+ input_ids = model_inputs["input_ids"]
86
+ attention_mask = model_inputs.get("attention_mask", None)
87
+ # Allow empty prompts
88
+ if input_ids.shape[1] == 0:
89
+ input_ids = None
90
+ attention_mask = None
91
+ in_b = 1
92
+ else:
93
+ in_b = input_ids.shape[0]
94
+ prompt_text = model_inputs.pop("prompt_text")
95
+
96
+ ## If there is a prefix, we may need to adjust the generation length. Do so without permanently modifying
97
+ ## generate_kwargs, as some of the parameterization may come from the initialization of the pipeline.
98
+ # generate_kwargs = copy.deepcopy(generate_kwargs)
99
+ prefix_length = generate_kwargs.pop("prefix_length", 0)
100
+ if prefix_length > 0:
101
+ has_max_new_tokens = "max_new_tokens" in generate_kwargs or (
102
+ "generation_config" in generate_kwargs
103
+ and generate_kwargs["generation_config"].max_new_tokens is not None
104
+ )
105
+ if not has_max_new_tokens:
106
+ generate_kwargs["max_length"] = generate_kwargs.get("max_length") or self.model.config.max_length
107
+ generate_kwargs["max_length"] += prefix_length
108
+ has_min_new_tokens = "min_new_tokens" in generate_kwargs or (
109
+ "generation_config" in generate_kwargs
110
+ and generate_kwargs["generation_config"].min_new_tokens is not None
111
+ )
112
+ if not has_min_new_tokens and "min_length" in generate_kwargs:
113
+ generate_kwargs["min_length"] += prefix_length
114
+
115
+ # BS x SL
116
+ generated_sequence = self.model.generate(input_ids=input_ids, attention_mask=attention_mask, **generate_kwargs)
117
+ out_b = generated_sequence.shape[0]
118
+ if self.framework == "pt":
119
+ generated_sequence = generated_sequence.reshape(in_b, out_b // in_b, *generated_sequence.shape[1:])
120
+ elif self.framework == "tf":
121
+ from transformers import is_tf_available
122
+ if is_tf_available():
123
+ import tensorflow as tf
124
+ generated_sequence = tf.reshape(generated_sequence,
125
+ (in_b, out_b // in_b, *generated_sequence.shape[1:]))
126
+ else:
127
+ raise ValueError("TF not avaialble.")
128
+ return {"generated_sequence": generated_sequence, "input_ids": input_ids, "prompt_text": prompt_text}
pytorch_model-00001-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9034a2f18ca79dc8ea947476a24e823164e055e891923732de94f3fd1d5798fa
3
+ size 4605550559
pytorch_model-00002-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4698fe9527f7b6c2c2ca110cccf853c0f54b2e8968cba8cfb301529bd27e9bf5
3
+ size 4899219433
pytorch_model-00003-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf29337ab7126ab311fea87df7b5a5db1512a101ef1d3ad8713cd7437d4d8bc5
3
+ size 4613939365
pytorch_model-00004-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bad607e087ad7d6cba05fdd3218b5f664843e67dafc1ff979ad3f1674fc21b1f
3
+ size 4899219497
pytorch_model-00005-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08d407d8f479ba2fe98fbec90d8b8803b477254b7c945e408589b084103e4436
3
+ size 4613939429
pytorch_model-00006-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00c2dba754cf9b22cf1fdb9e4286fa2bfd10d1016efbd214861e3ed6545f3761
3
+ size 4899219497
pytorch_model-00007-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:559beaaf574a23286509d8cd1f3f3b9ca26a6cbc0b777f2babb03a0cdf48ff9f
3
+ size 4613939429
pytorch_model-00008-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e9a7d668ead3885e8e0dea70a54edbf486cd2f55b599101f462456fc465a6d2
3
+ size 4899219497
pytorch_model-00009-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37e8870bae29e255c73341fae121087413b6aa3c4ad9c1af5444ce54a24b3b2b
3
+ size 4613939429
pytorch_model-00010-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0e034c07927db399d040b7801f959ed553a093058fee314d2613f1c4a0f1e01d
3
+ size 4899219497
pytorch_model-00011-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:efa7fc930145040845a5b427870af4c3e83b38d6b44cc5107beb5e0e5c583182
3
+ size 4613939429
pytorch_model-00012-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05ba351f5935a922efc578f381b53f531a8cd04d533b0573b4be8f403c214c4d
3
+ size 4899219497
pytorch_model-00013-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0e9a20aeeb805080b37fcdcb558367b0f002a49ad26bbcb76f7bfcb25f34dd7
3
+ size 4613939429
pytorch_model-00014-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d4ce817d399e23a96f9e7af7f234e828e0c4e2d7729497a75db94f9d4b0e268
3
+ size 4899219497
pytorch_model-00015-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dfdf5d88754bf688a4b181de08e2eb90c7d5ca935d011a40c285adcda36bd137
3
+ size 4613939429
pytorch_model-00016-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e687803c5f291a6779804572836e4dc27202dc85d24c3c277e9187403adf55e
3
+ size 4899219497
pytorch_model-00017-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe83979d7a84feee2b04ae3b2f2350f1316d9d75f701985a4382465e086524de
3
+ size 4613939429
pytorch_model-00018-of-00018.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d89f4cb4f0db1e8ee7fe8cd2dbd395df1eeb8ac045b19c36caa3d0fa6ce32c8a
3
+ size 1895927701
pytorch_model.bin.index.json ADDED
@@ -0,0 +1,491 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 82606587904
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "pytorch_model-00001-of-00018.bin",
7
+ "transformer.h.0.ln_attn.bias": "pytorch_model-00001-of-00018.bin",
8
+ "transformer.h.0.ln_attn.weight": "pytorch_model-00001-of-00018.bin",
9
+ "transformer.h.0.ln_mlp.bias": "pytorch_model-00001-of-00018.bin",
10
+ "transformer.h.0.ln_mlp.weight": "pytorch_model-00001-of-00018.bin",
11
+ "transformer.h.0.mlp.dense_4h_to_h.weight": "pytorch_model-00001-of-00018.bin",
12
+ "transformer.h.0.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00018.bin",
13
+ "transformer.h.0.self_attention.dense.weight": "pytorch_model-00001-of-00018.bin",
14
+ "transformer.h.0.self_attention.query_key_value.weight": "pytorch_model-00001-of-00018.bin",
15
+ "transformer.h.1.ln_attn.bias": "pytorch_model-00001-of-00018.bin",
16
+ "transformer.h.1.ln_attn.weight": "pytorch_model-00001-of-00018.bin",
17
+ "transformer.h.1.ln_mlp.bias": "pytorch_model-00001-of-00018.bin",
18
+ "transformer.h.1.ln_mlp.weight": "pytorch_model-00001-of-00018.bin",
19
+ "transformer.h.1.mlp.dense_4h_to_h.weight": "pytorch_model-00001-of-00018.bin",
20
+ "transformer.h.1.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00018.bin",
21
+ "transformer.h.1.self_attention.dense.weight": "pytorch_model-00001-of-00018.bin",
22
+ "transformer.h.1.self_attention.query_key_value.weight": "pytorch_model-00001-of-00018.bin",
23
+ "transformer.h.10.ln_attn.bias": "pytorch_model-00004-of-00018.bin",
24
+ "transformer.h.10.ln_attn.weight": "pytorch_model-00004-of-00018.bin",
25
+ "transformer.h.10.ln_mlp.bias": "pytorch_model-00004-of-00018.bin",
26
+ "transformer.h.10.ln_mlp.weight": "pytorch_model-00004-of-00018.bin",
27
+ "transformer.h.10.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00018.bin",
28
+ "transformer.h.10.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00018.bin",
29
+ "transformer.h.10.self_attention.dense.weight": "pytorch_model-00004-of-00018.bin",
30
+ "transformer.h.10.self_attention.query_key_value.weight": "pytorch_model-00004-of-00018.bin",
31
+ "transformer.h.11.ln_attn.bias": "pytorch_model-00004-of-00018.bin",
32
+ "transformer.h.11.ln_attn.weight": "pytorch_model-00004-of-00018.bin",
33
+ "transformer.h.11.ln_mlp.bias": "pytorch_model-00004-of-00018.bin",
34
+ "transformer.h.11.ln_mlp.weight": "pytorch_model-00004-of-00018.bin",
35
+ "transformer.h.11.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00018.bin",
36
+ "transformer.h.11.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00018.bin",
37
+ "transformer.h.11.self_attention.dense.weight": "pytorch_model-00004-of-00018.bin",
38
+ "transformer.h.11.self_attention.query_key_value.weight": "pytorch_model-00004-of-00018.bin",
39
+ "transformer.h.12.ln_attn.bias": "pytorch_model-00004-of-00018.bin",
40
+ "transformer.h.12.ln_attn.weight": "pytorch_model-00004-of-00018.bin",
41
+ "transformer.h.12.ln_mlp.bias": "pytorch_model-00004-of-00018.bin",
42
+ "transformer.h.12.ln_mlp.weight": "pytorch_model-00004-of-00018.bin",
43
+ "transformer.h.12.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00018.bin",
44
+ "transformer.h.12.mlp.dense_h_to_4h.weight": "pytorch_model-00004-of-00018.bin",
45
+ "transformer.h.12.self_attention.dense.weight": "pytorch_model-00004-of-00018.bin",
46
+ "transformer.h.12.self_attention.query_key_value.weight": "pytorch_model-00004-of-00018.bin",
47
+ "transformer.h.13.ln_attn.bias": "pytorch_model-00004-of-00018.bin",
48
+ "transformer.h.13.ln_attn.weight": "pytorch_model-00004-of-00018.bin",
49
+ "transformer.h.13.ln_mlp.bias": "pytorch_model-00004-of-00018.bin",
50
+ "transformer.h.13.ln_mlp.weight": "pytorch_model-00004-of-00018.bin",
51
+ "transformer.h.13.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00018.bin",
52
+ "transformer.h.13.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00018.bin",
53
+ "transformer.h.13.self_attention.dense.weight": "pytorch_model-00004-of-00018.bin",
54
+ "transformer.h.13.self_attention.query_key_value.weight": "pytorch_model-00004-of-00018.bin",
55
+ "transformer.h.14.ln_attn.bias": "pytorch_model-00005-of-00018.bin",
56
+ "transformer.h.14.ln_attn.weight": "pytorch_model-00005-of-00018.bin",
57
+ "transformer.h.14.ln_mlp.bias": "pytorch_model-00005-of-00018.bin",
58
+ "transformer.h.14.ln_mlp.weight": "pytorch_model-00005-of-00018.bin",
59
+ "transformer.h.14.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00018.bin",
60
+ "transformer.h.14.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00018.bin",
61
+ "transformer.h.14.self_attention.dense.weight": "pytorch_model-00005-of-00018.bin",
62
+ "transformer.h.14.self_attention.query_key_value.weight": "pytorch_model-00005-of-00018.bin",
63
+ "transformer.h.15.ln_attn.bias": "pytorch_model-00005-of-00018.bin",
64
+ "transformer.h.15.ln_attn.weight": "pytorch_model-00005-of-00018.bin",
65
+ "transformer.h.15.ln_mlp.bias": "pytorch_model-00005-of-00018.bin",
66
+ "transformer.h.15.ln_mlp.weight": "pytorch_model-00005-of-00018.bin",
67
+ "transformer.h.15.mlp.dense_4h_to_h.weight": "pytorch_model-00005-of-00018.bin",
68
+ "transformer.h.15.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00018.bin",
69
+ "transformer.h.15.self_attention.dense.weight": "pytorch_model-00005-of-00018.bin",
70
+ "transformer.h.15.self_attention.query_key_value.weight": "pytorch_model-00005-of-00018.bin",
71
+ "transformer.h.16.ln_attn.bias": "pytorch_model-00005-of-00018.bin",
72
+ "transformer.h.16.ln_attn.weight": "pytorch_model-00005-of-00018.bin",
73
+ "transformer.h.16.ln_mlp.bias": "pytorch_model-00005-of-00018.bin",
74
+ "transformer.h.16.ln_mlp.weight": "pytorch_model-00005-of-00018.bin",
75
+ "transformer.h.16.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00018.bin",
76
+ "transformer.h.16.mlp.dense_h_to_4h.weight": "pytorch_model-00005-of-00018.bin",
77
+ "transformer.h.16.self_attention.dense.weight": "pytorch_model-00005-of-00018.bin",
78
+ "transformer.h.16.self_attention.query_key_value.weight": "pytorch_model-00005-of-00018.bin",
79
+ "transformer.h.17.ln_attn.bias": "pytorch_model-00006-of-00018.bin",
80
+ "transformer.h.17.ln_attn.weight": "pytorch_model-00006-of-00018.bin",
81
+ "transformer.h.17.ln_mlp.bias": "pytorch_model-00006-of-00018.bin",
82
+ "transformer.h.17.ln_mlp.weight": "pytorch_model-00006-of-00018.bin",
83
+ "transformer.h.17.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00018.bin",
84
+ "transformer.h.17.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00018.bin",
85
+ "transformer.h.17.self_attention.dense.weight": "pytorch_model-00006-of-00018.bin",
86
+ "transformer.h.17.self_attention.query_key_value.weight": "pytorch_model-00006-of-00018.bin",
87
+ "transformer.h.18.ln_attn.bias": "pytorch_model-00006-of-00018.bin",
88
+ "transformer.h.18.ln_attn.weight": "pytorch_model-00006-of-00018.bin",
89
+ "transformer.h.18.ln_mlp.bias": "pytorch_model-00006-of-00018.bin",
90
+ "transformer.h.18.ln_mlp.weight": "pytorch_model-00006-of-00018.bin",
91
+ "transformer.h.18.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00018.bin",
92
+ "transformer.h.18.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00018.bin",
93
+ "transformer.h.18.self_attention.dense.weight": "pytorch_model-00006-of-00018.bin",
94
+ "transformer.h.18.self_attention.query_key_value.weight": "pytorch_model-00006-of-00018.bin",
95
+ "transformer.h.19.ln_attn.bias": "pytorch_model-00006-of-00018.bin",
96
+ "transformer.h.19.ln_attn.weight": "pytorch_model-00006-of-00018.bin",
97
+ "transformer.h.19.ln_mlp.bias": "pytorch_model-00006-of-00018.bin",
98
+ "transformer.h.19.ln_mlp.weight": "pytorch_model-00006-of-00018.bin",
99
+ "transformer.h.19.mlp.dense_4h_to_h.weight": "pytorch_model-00006-of-00018.bin",
100
+ "transformer.h.19.mlp.dense_h_to_4h.weight": "pytorch_model-00006-of-00018.bin",
101
+ "transformer.h.19.self_attention.dense.weight": "pytorch_model-00006-of-00018.bin",
102
+ "transformer.h.19.self_attention.query_key_value.weight": "pytorch_model-00006-of-00018.bin",
103
+ "transformer.h.2.ln_attn.bias": "pytorch_model-00001-of-00018.bin",
104
+ "transformer.h.2.ln_attn.weight": "pytorch_model-00001-of-00018.bin",
105
+ "transformer.h.2.ln_mlp.bias": "pytorch_model-00001-of-00018.bin",
106
+ "transformer.h.2.ln_mlp.weight": "pytorch_model-00001-of-00018.bin",
107
+ "transformer.h.2.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00018.bin",
108
+ "transformer.h.2.mlp.dense_h_to_4h.weight": "pytorch_model-00001-of-00018.bin",
109
+ "transformer.h.2.self_attention.dense.weight": "pytorch_model-00001-of-00018.bin",
110
+ "transformer.h.2.self_attention.query_key_value.weight": "pytorch_model-00001-of-00018.bin",
111
+ "transformer.h.20.ln_attn.bias": "pytorch_model-00006-of-00018.bin",
112
+ "transformer.h.20.ln_attn.weight": "pytorch_model-00006-of-00018.bin",
113
+ "transformer.h.20.ln_mlp.bias": "pytorch_model-00006-of-00018.bin",
114
+ "transformer.h.20.ln_mlp.weight": "pytorch_model-00006-of-00018.bin",
115
+ "transformer.h.20.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00018.bin",
116
+ "transformer.h.20.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00018.bin",
117
+ "transformer.h.20.self_attention.dense.weight": "pytorch_model-00006-of-00018.bin",
118
+ "transformer.h.20.self_attention.query_key_value.weight": "pytorch_model-00006-of-00018.bin",
119
+ "transformer.h.21.ln_attn.bias": "pytorch_model-00007-of-00018.bin",
120
+ "transformer.h.21.ln_attn.weight": "pytorch_model-00007-of-00018.bin",
121
+ "transformer.h.21.ln_mlp.bias": "pytorch_model-00007-of-00018.bin",
122
+ "transformer.h.21.ln_mlp.weight": "pytorch_model-00007-of-00018.bin",
123
+ "transformer.h.21.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00018.bin",
124
+ "transformer.h.21.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00018.bin",
125
+ "transformer.h.21.self_attention.dense.weight": "pytorch_model-00007-of-00018.bin",
126
+ "transformer.h.21.self_attention.query_key_value.weight": "pytorch_model-00007-of-00018.bin",
127
+ "transformer.h.22.ln_attn.bias": "pytorch_model-00007-of-00018.bin",
128
+ "transformer.h.22.ln_attn.weight": "pytorch_model-00007-of-00018.bin",
129
+ "transformer.h.22.ln_mlp.bias": "pytorch_model-00007-of-00018.bin",
130
+ "transformer.h.22.ln_mlp.weight": "pytorch_model-00007-of-00018.bin",
131
+ "transformer.h.22.mlp.dense_4h_to_h.weight": "pytorch_model-00007-of-00018.bin",
132
+ "transformer.h.22.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00018.bin",
133
+ "transformer.h.22.self_attention.dense.weight": "pytorch_model-00007-of-00018.bin",
134
+ "transformer.h.22.self_attention.query_key_value.weight": "pytorch_model-00007-of-00018.bin",
135
+ "transformer.h.23.ln_attn.bias": "pytorch_model-00007-of-00018.bin",
136
+ "transformer.h.23.ln_attn.weight": "pytorch_model-00007-of-00018.bin",
137
+ "transformer.h.23.ln_mlp.bias": "pytorch_model-00007-of-00018.bin",
138
+ "transformer.h.23.ln_mlp.weight": "pytorch_model-00007-of-00018.bin",
139
+ "transformer.h.23.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00018.bin",
140
+ "transformer.h.23.mlp.dense_h_to_4h.weight": "pytorch_model-00007-of-00018.bin",
141
+ "transformer.h.23.self_attention.dense.weight": "pytorch_model-00007-of-00018.bin",
142
+ "transformer.h.23.self_attention.query_key_value.weight": "pytorch_model-00007-of-00018.bin",
143
+ "transformer.h.24.ln_attn.bias": "pytorch_model-00008-of-00018.bin",
144
+ "transformer.h.24.ln_attn.weight": "pytorch_model-00008-of-00018.bin",
145
+ "transformer.h.24.ln_mlp.bias": "pytorch_model-00008-of-00018.bin",
146
+ "transformer.h.24.ln_mlp.weight": "pytorch_model-00008-of-00018.bin",
147
+ "transformer.h.24.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00018.bin",
148
+ "transformer.h.24.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00018.bin",
149
+ "transformer.h.24.self_attention.dense.weight": "pytorch_model-00008-of-00018.bin",
150
+ "transformer.h.24.self_attention.query_key_value.weight": "pytorch_model-00008-of-00018.bin",
151
+ "transformer.h.25.ln_attn.bias": "pytorch_model-00008-of-00018.bin",
152
+ "transformer.h.25.ln_attn.weight": "pytorch_model-00008-of-00018.bin",
153
+ "transformer.h.25.ln_mlp.bias": "pytorch_model-00008-of-00018.bin",
154
+ "transformer.h.25.ln_mlp.weight": "pytorch_model-00008-of-00018.bin",
155
+ "transformer.h.25.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00018.bin",
156
+ "transformer.h.25.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00018.bin",
157
+ "transformer.h.25.self_attention.dense.weight": "pytorch_model-00008-of-00018.bin",
158
+ "transformer.h.25.self_attention.query_key_value.weight": "pytorch_model-00008-of-00018.bin",
159
+ "transformer.h.26.ln_attn.bias": "pytorch_model-00008-of-00018.bin",
160
+ "transformer.h.26.ln_attn.weight": "pytorch_model-00008-of-00018.bin",
161
+ "transformer.h.26.ln_mlp.bias": "pytorch_model-00008-of-00018.bin",
162
+ "transformer.h.26.ln_mlp.weight": "pytorch_model-00008-of-00018.bin",
163
+ "transformer.h.26.mlp.dense_4h_to_h.weight": "pytorch_model-00008-of-00018.bin",
164
+ "transformer.h.26.mlp.dense_h_to_4h.weight": "pytorch_model-00008-of-00018.bin",
165
+ "transformer.h.26.self_attention.dense.weight": "pytorch_model-00008-of-00018.bin",
166
+ "transformer.h.26.self_attention.query_key_value.weight": "pytorch_model-00008-of-00018.bin",
167
+ "transformer.h.27.ln_attn.bias": "pytorch_model-00008-of-00018.bin",
168
+ "transformer.h.27.ln_attn.weight": "pytorch_model-00008-of-00018.bin",
169
+ "transformer.h.27.ln_mlp.bias": "pytorch_model-00008-of-00018.bin",
170
+ "transformer.h.27.ln_mlp.weight": "pytorch_model-00008-of-00018.bin",
171
+ "transformer.h.27.mlp.dense_4h_to_h.weight": "pytorch_model-00009-of-00018.bin",
172
+ "transformer.h.27.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00018.bin",
173
+ "transformer.h.27.self_attention.dense.weight": "pytorch_model-00008-of-00018.bin",
174
+ "transformer.h.27.self_attention.query_key_value.weight": "pytorch_model-00008-of-00018.bin",
175
+ "transformer.h.28.ln_attn.bias": "pytorch_model-00009-of-00018.bin",
176
+ "transformer.h.28.ln_attn.weight": "pytorch_model-00009-of-00018.bin",
177
+ "transformer.h.28.ln_mlp.bias": "pytorch_model-00009-of-00018.bin",
178
+ "transformer.h.28.ln_mlp.weight": "pytorch_model-00009-of-00018.bin",
179
+ "transformer.h.28.mlp.dense_4h_to_h.weight": "pytorch_model-00009-of-00018.bin",
180
+ "transformer.h.28.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00018.bin",
181
+ "transformer.h.28.self_attention.dense.weight": "pytorch_model-00009-of-00018.bin",
182
+ "transformer.h.28.self_attention.query_key_value.weight": "pytorch_model-00009-of-00018.bin",
183
+ "transformer.h.29.ln_attn.bias": "pytorch_model-00009-of-00018.bin",
184
+ "transformer.h.29.ln_attn.weight": "pytorch_model-00009-of-00018.bin",
185
+ "transformer.h.29.ln_mlp.bias": "pytorch_model-00009-of-00018.bin",
186
+ "transformer.h.29.ln_mlp.weight": "pytorch_model-00009-of-00018.bin",
187
+ "transformer.h.29.mlp.dense_4h_to_h.weight": "pytorch_model-00009-of-00018.bin",
188
+ "transformer.h.29.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00018.bin",
189
+ "transformer.h.29.self_attention.dense.weight": "pytorch_model-00009-of-00018.bin",
190
+ "transformer.h.29.self_attention.query_key_value.weight": "pytorch_model-00009-of-00018.bin",
191
+ "transformer.h.3.ln_attn.bias": "pytorch_model-00002-of-00018.bin",
192
+ "transformer.h.3.ln_attn.weight": "pytorch_model-00002-of-00018.bin",
193
+ "transformer.h.3.ln_mlp.bias": "pytorch_model-00002-of-00018.bin",
194
+ "transformer.h.3.ln_mlp.weight": "pytorch_model-00002-of-00018.bin",
195
+ "transformer.h.3.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00018.bin",
196
+ "transformer.h.3.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00018.bin",
197
+ "transformer.h.3.self_attention.dense.weight": "pytorch_model-00002-of-00018.bin",
198
+ "transformer.h.3.self_attention.query_key_value.weight": "pytorch_model-00002-of-00018.bin",
199
+ "transformer.h.30.ln_attn.bias": "pytorch_model-00009-of-00018.bin",
200
+ "transformer.h.30.ln_attn.weight": "pytorch_model-00009-of-00018.bin",
201
+ "transformer.h.30.ln_mlp.bias": "pytorch_model-00009-of-00018.bin",
202
+ "transformer.h.30.ln_mlp.weight": "pytorch_model-00009-of-00018.bin",
203
+ "transformer.h.30.mlp.dense_4h_to_h.weight": "pytorch_model-00010-of-00018.bin",
204
+ "transformer.h.30.mlp.dense_h_to_4h.weight": "pytorch_model-00009-of-00018.bin",
205
+ "transformer.h.30.self_attention.dense.weight": "pytorch_model-00009-of-00018.bin",
206
+ "transformer.h.30.self_attention.query_key_value.weight": "pytorch_model-00009-of-00018.bin",
207
+ "transformer.h.31.ln_attn.bias": "pytorch_model-00010-of-00018.bin",
208
+ "transformer.h.31.ln_attn.weight": "pytorch_model-00010-of-00018.bin",
209
+ "transformer.h.31.ln_mlp.bias": "pytorch_model-00010-of-00018.bin",
210
+ "transformer.h.31.ln_mlp.weight": "pytorch_model-00010-of-00018.bin",
211
+ "transformer.h.31.mlp.dense_4h_to_h.weight": "pytorch_model-00010-of-00018.bin",
212
+ "transformer.h.31.mlp.dense_h_to_4h.weight": "pytorch_model-00010-of-00018.bin",
213
+ "transformer.h.31.self_attention.dense.weight": "pytorch_model-00010-of-00018.bin",
214
+ "transformer.h.31.self_attention.query_key_value.weight": "pytorch_model-00010-of-00018.bin",
215
+ "transformer.h.32.ln_attn.bias": "pytorch_model-00010-of-00018.bin",
216
+ "transformer.h.32.ln_attn.weight": "pytorch_model-00010-of-00018.bin",
217
+ "transformer.h.32.ln_mlp.bias": "pytorch_model-00010-of-00018.bin",
218
+ "transformer.h.32.ln_mlp.weight": "pytorch_model-00010-of-00018.bin",
219
+ "transformer.h.32.mlp.dense_4h_to_h.weight": "pytorch_model-00010-of-00018.bin",
220
+ "transformer.h.32.mlp.dense_h_to_4h.weight": "pytorch_model-00010-of-00018.bin",
221
+ "transformer.h.32.self_attention.dense.weight": "pytorch_model-00010-of-00018.bin",
222
+ "transformer.h.32.self_attention.query_key_value.weight": "pytorch_model-00010-of-00018.bin",
223
+ "transformer.h.33.ln_attn.bias": "pytorch_model-00010-of-00018.bin",
224
+ "transformer.h.33.ln_attn.weight": "pytorch_model-00010-of-00018.bin",
225
+ "transformer.h.33.ln_mlp.bias": "pytorch_model-00010-of-00018.bin",
226
+ "transformer.h.33.ln_mlp.weight": "pytorch_model-00010-of-00018.bin",
227
+ "transformer.h.33.mlp.dense_4h_to_h.weight": "pytorch_model-00010-of-00018.bin",
228
+ "transformer.h.33.mlp.dense_h_to_4h.weight": "pytorch_model-00010-of-00018.bin",
229
+ "transformer.h.33.self_attention.dense.weight": "pytorch_model-00010-of-00018.bin",
230
+ "transformer.h.33.self_attention.query_key_value.weight": "pytorch_model-00010-of-00018.bin",
231
+ "transformer.h.34.ln_attn.bias": "pytorch_model-00010-of-00018.bin",
232
+ "transformer.h.34.ln_attn.weight": "pytorch_model-00010-of-00018.bin",
233
+ "transformer.h.34.ln_mlp.bias": "pytorch_model-00010-of-00018.bin",
234
+ "transformer.h.34.ln_mlp.weight": "pytorch_model-00010-of-00018.bin",
235
+ "transformer.h.34.mlp.dense_4h_to_h.weight": "pytorch_model-00011-of-00018.bin",
236
+ "transformer.h.34.mlp.dense_h_to_4h.weight": "pytorch_model-00011-of-00018.bin",
237
+ "transformer.h.34.self_attention.dense.weight": "pytorch_model-00010-of-00018.bin",
238
+ "transformer.h.34.self_attention.query_key_value.weight": "pytorch_model-00010-of-00018.bin",
239
+ "transformer.h.35.ln_attn.bias": "pytorch_model-00011-of-00018.bin",
240
+ "transformer.h.35.ln_attn.weight": "pytorch_model-00011-of-00018.bin",
241
+ "transformer.h.35.ln_mlp.bias": "pytorch_model-00011-of-00018.bin",
242
+ "transformer.h.35.ln_mlp.weight": "pytorch_model-00011-of-00018.bin",
243
+ "transformer.h.35.mlp.dense_4h_to_h.weight": "pytorch_model-00011-of-00018.bin",
244
+ "transformer.h.35.mlp.dense_h_to_4h.weight": "pytorch_model-00011-of-00018.bin",
245
+ "transformer.h.35.self_attention.dense.weight": "pytorch_model-00011-of-00018.bin",
246
+ "transformer.h.35.self_attention.query_key_value.weight": "pytorch_model-00011-of-00018.bin",
247
+ "transformer.h.36.ln_attn.bias": "pytorch_model-00011-of-00018.bin",
248
+ "transformer.h.36.ln_attn.weight": "pytorch_model-00011-of-00018.bin",
249
+ "transformer.h.36.ln_mlp.bias": "pytorch_model-00011-of-00018.bin",
250
+ "transformer.h.36.ln_mlp.weight": "pytorch_model-00011-of-00018.bin",
251
+ "transformer.h.36.mlp.dense_4h_to_h.weight": "pytorch_model-00011-of-00018.bin",
252
+ "transformer.h.36.mlp.dense_h_to_4h.weight": "pytorch_model-00011-of-00018.bin",
253
+ "transformer.h.36.self_attention.dense.weight": "pytorch_model-00011-of-00018.bin",
254
+ "transformer.h.36.self_attention.query_key_value.weight": "pytorch_model-00011-of-00018.bin",
255
+ "transformer.h.37.ln_attn.bias": "pytorch_model-00011-of-00018.bin",
256
+ "transformer.h.37.ln_attn.weight": "pytorch_model-00011-of-00018.bin",
257
+ "transformer.h.37.ln_mlp.bias": "pytorch_model-00011-of-00018.bin",
258
+ "transformer.h.37.ln_mlp.weight": "pytorch_model-00011-of-00018.bin",
259
+ "transformer.h.37.mlp.dense_4h_to_h.weight": "pytorch_model-00012-of-00018.bin",
260
+ "transformer.h.37.mlp.dense_h_to_4h.weight": "pytorch_model-00011-of-00018.bin",
261
+ "transformer.h.37.self_attention.dense.weight": "pytorch_model-00011-of-00018.bin",
262
+ "transformer.h.37.self_attention.query_key_value.weight": "pytorch_model-00011-of-00018.bin",
263
+ "transformer.h.38.ln_attn.bias": "pytorch_model-00012-of-00018.bin",
264
+ "transformer.h.38.ln_attn.weight": "pytorch_model-00012-of-00018.bin",
265
+ "transformer.h.38.ln_mlp.bias": "pytorch_model-00012-of-00018.bin",
266
+ "transformer.h.38.ln_mlp.weight": "pytorch_model-00012-of-00018.bin",
267
+ "transformer.h.38.mlp.dense_4h_to_h.weight": "pytorch_model-00012-of-00018.bin",
268
+ "transformer.h.38.mlp.dense_h_to_4h.weight": "pytorch_model-00012-of-00018.bin",
269
+ "transformer.h.38.self_attention.dense.weight": "pytorch_model-00012-of-00018.bin",
270
+ "transformer.h.38.self_attention.query_key_value.weight": "pytorch_model-00012-of-00018.bin",
271
+ "transformer.h.39.ln_attn.bias": "pytorch_model-00012-of-00018.bin",
272
+ "transformer.h.39.ln_attn.weight": "pytorch_model-00012-of-00018.bin",
273
+ "transformer.h.39.ln_mlp.bias": "pytorch_model-00012-of-00018.bin",
274
+ "transformer.h.39.ln_mlp.weight": "pytorch_model-00012-of-00018.bin",
275
+ "transformer.h.39.mlp.dense_4h_to_h.weight": "pytorch_model-00012-of-00018.bin",
276
+ "transformer.h.39.mlp.dense_h_to_4h.weight": "pytorch_model-00012-of-00018.bin",
277
+ "transformer.h.39.self_attention.dense.weight": "pytorch_model-00012-of-00018.bin",
278
+ "transformer.h.39.self_attention.query_key_value.weight": "pytorch_model-00012-of-00018.bin",
279
+ "transformer.h.4.ln_attn.bias": "pytorch_model-00002-of-00018.bin",
280
+ "transformer.h.4.ln_attn.weight": "pytorch_model-00002-of-00018.bin",
281
+ "transformer.h.4.ln_mlp.bias": "pytorch_model-00002-of-00018.bin",
282
+ "transformer.h.4.ln_mlp.weight": "pytorch_model-00002-of-00018.bin",
283
+ "transformer.h.4.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00018.bin",
284
+ "transformer.h.4.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00018.bin",
285
+ "transformer.h.4.self_attention.dense.weight": "pytorch_model-00002-of-00018.bin",
286
+ "transformer.h.4.self_attention.query_key_value.weight": "pytorch_model-00002-of-00018.bin",
287
+ "transformer.h.40.ln_attn.bias": "pytorch_model-00012-of-00018.bin",
288
+ "transformer.h.40.ln_attn.weight": "pytorch_model-00012-of-00018.bin",
289
+ "transformer.h.40.ln_mlp.bias": "pytorch_model-00012-of-00018.bin",
290
+ "transformer.h.40.ln_mlp.weight": "pytorch_model-00012-of-00018.bin",
291
+ "transformer.h.40.mlp.dense_4h_to_h.weight": "pytorch_model-00012-of-00018.bin",
292
+ "transformer.h.40.mlp.dense_h_to_4h.weight": "pytorch_model-00012-of-00018.bin",
293
+ "transformer.h.40.self_attention.dense.weight": "pytorch_model-00012-of-00018.bin",
294
+ "transformer.h.40.self_attention.query_key_value.weight": "pytorch_model-00012-of-00018.bin",
295
+ "transformer.h.41.ln_attn.bias": "pytorch_model-00012-of-00018.bin",
296
+ "transformer.h.41.ln_attn.weight": "pytorch_model-00012-of-00018.bin",
297
+ "transformer.h.41.ln_mlp.bias": "pytorch_model-00012-of-00018.bin",
298
+ "transformer.h.41.ln_mlp.weight": "pytorch_model-00012-of-00018.bin",
299
+ "transformer.h.41.mlp.dense_4h_to_h.weight": "pytorch_model-00013-of-00018.bin",
300
+ "transformer.h.41.mlp.dense_h_to_4h.weight": "pytorch_model-00013-of-00018.bin",
301
+ "transformer.h.41.self_attention.dense.weight": "pytorch_model-00012-of-00018.bin",
302
+ "transformer.h.41.self_attention.query_key_value.weight": "pytorch_model-00012-of-00018.bin",
303
+ "transformer.h.42.ln_attn.bias": "pytorch_model-00013-of-00018.bin",
304
+ "transformer.h.42.ln_attn.weight": "pytorch_model-00013-of-00018.bin",
305
+ "transformer.h.42.ln_mlp.bias": "pytorch_model-00013-of-00018.bin",
306
+ "transformer.h.42.ln_mlp.weight": "pytorch_model-00013-of-00018.bin",
307
+ "transformer.h.42.mlp.dense_4h_to_h.weight": "pytorch_model-00013-of-00018.bin",
308
+ "transformer.h.42.mlp.dense_h_to_4h.weight": "pytorch_model-00013-of-00018.bin",
309
+ "transformer.h.42.self_attention.dense.weight": "pytorch_model-00013-of-00018.bin",
310
+ "transformer.h.42.self_attention.query_key_value.weight": "pytorch_model-00013-of-00018.bin",
311
+ "transformer.h.43.ln_attn.bias": "pytorch_model-00013-of-00018.bin",
312
+ "transformer.h.43.ln_attn.weight": "pytorch_model-00013-of-00018.bin",
313
+ "transformer.h.43.ln_mlp.bias": "pytorch_model-00013-of-00018.bin",
314
+ "transformer.h.43.ln_mlp.weight": "pytorch_model-00013-of-00018.bin",
315
+ "transformer.h.43.mlp.dense_4h_to_h.weight": "pytorch_model-00013-of-00018.bin",
316
+ "transformer.h.43.mlp.dense_h_to_4h.weight": "pytorch_model-00013-of-00018.bin",
317
+ "transformer.h.43.self_attention.dense.weight": "pytorch_model-00013-of-00018.bin",
318
+ "transformer.h.43.self_attention.query_key_value.weight": "pytorch_model-00013-of-00018.bin",
319
+ "transformer.h.44.ln_attn.bias": "pytorch_model-00013-of-00018.bin",
320
+ "transformer.h.44.ln_attn.weight": "pytorch_model-00013-of-00018.bin",
321
+ "transformer.h.44.ln_mlp.bias": "pytorch_model-00013-of-00018.bin",
322
+ "transformer.h.44.ln_mlp.weight": "pytorch_model-00013-of-00018.bin",
323
+ "transformer.h.44.mlp.dense_4h_to_h.weight": "pytorch_model-00014-of-00018.bin",
324
+ "transformer.h.44.mlp.dense_h_to_4h.weight": "pytorch_model-00013-of-00018.bin",
325
+ "transformer.h.44.self_attention.dense.weight": "pytorch_model-00013-of-00018.bin",
326
+ "transformer.h.44.self_attention.query_key_value.weight": "pytorch_model-00013-of-00018.bin",
327
+ "transformer.h.45.ln_attn.bias": "pytorch_model-00014-of-00018.bin",
328
+ "transformer.h.45.ln_attn.weight": "pytorch_model-00014-of-00018.bin",
329
+ "transformer.h.45.ln_mlp.bias": "pytorch_model-00014-of-00018.bin",
330
+ "transformer.h.45.ln_mlp.weight": "pytorch_model-00014-of-00018.bin",
331
+ "transformer.h.45.mlp.dense_4h_to_h.weight": "pytorch_model-00014-of-00018.bin",
332
+ "transformer.h.45.mlp.dense_h_to_4h.weight": "pytorch_model-00014-of-00018.bin",
333
+ "transformer.h.45.self_attention.dense.weight": "pytorch_model-00014-of-00018.bin",
334
+ "transformer.h.45.self_attention.query_key_value.weight": "pytorch_model-00014-of-00018.bin",
335
+ "transformer.h.46.ln_attn.bias": "pytorch_model-00014-of-00018.bin",
336
+ "transformer.h.46.ln_attn.weight": "pytorch_model-00014-of-00018.bin",
337
+ "transformer.h.46.ln_mlp.bias": "pytorch_model-00014-of-00018.bin",
338
+ "transformer.h.46.ln_mlp.weight": "pytorch_model-00014-of-00018.bin",
339
+ "transformer.h.46.mlp.dense_4h_to_h.weight": "pytorch_model-00014-of-00018.bin",
340
+ "transformer.h.46.mlp.dense_h_to_4h.weight": "pytorch_model-00014-of-00018.bin",
341
+ "transformer.h.46.self_attention.dense.weight": "pytorch_model-00014-of-00018.bin",
342
+ "transformer.h.46.self_attention.query_key_value.weight": "pytorch_model-00014-of-00018.bin",
343
+ "transformer.h.47.ln_attn.bias": "pytorch_model-00014-of-00018.bin",
344
+ "transformer.h.47.ln_attn.weight": "pytorch_model-00014-of-00018.bin",
345
+ "transformer.h.47.ln_mlp.bias": "pytorch_model-00014-of-00018.bin",
346
+ "transformer.h.47.ln_mlp.weight": "pytorch_model-00014-of-00018.bin",
347
+ "transformer.h.47.mlp.dense_4h_to_h.weight": "pytorch_model-00014-of-00018.bin",
348
+ "transformer.h.47.mlp.dense_h_to_4h.weight": "pytorch_model-00014-of-00018.bin",
349
+ "transformer.h.47.self_attention.dense.weight": "pytorch_model-00014-of-00018.bin",
350
+ "transformer.h.47.self_attention.query_key_value.weight": "pytorch_model-00014-of-00018.bin",
351
+ "transformer.h.48.ln_attn.bias": "pytorch_model-00014-of-00018.bin",
352
+ "transformer.h.48.ln_attn.weight": "pytorch_model-00014-of-00018.bin",
353
+ "transformer.h.48.ln_mlp.bias": "pytorch_model-00014-of-00018.bin",
354
+ "transformer.h.48.ln_mlp.weight": "pytorch_model-00014-of-00018.bin",
355
+ "transformer.h.48.mlp.dense_4h_to_h.weight": "pytorch_model-00015-of-00018.bin",
356
+ "transformer.h.48.mlp.dense_h_to_4h.weight": "pytorch_model-00015-of-00018.bin",
357
+ "transformer.h.48.self_attention.dense.weight": "pytorch_model-00014-of-00018.bin",
358
+ "transformer.h.48.self_attention.query_key_value.weight": "pytorch_model-00014-of-00018.bin",
359
+ "transformer.h.49.ln_attn.bias": "pytorch_model-00015-of-00018.bin",
360
+ "transformer.h.49.ln_attn.weight": "pytorch_model-00015-of-00018.bin",
361
+ "transformer.h.49.ln_mlp.bias": "pytorch_model-00015-of-00018.bin",
362
+ "transformer.h.49.ln_mlp.weight": "pytorch_model-00015-of-00018.bin",
363
+ "transformer.h.49.mlp.dense_4h_to_h.weight": "pytorch_model-00015-of-00018.bin",
364
+ "transformer.h.49.mlp.dense_h_to_4h.weight": "pytorch_model-00015-of-00018.bin",
365
+ "transformer.h.49.self_attention.dense.weight": "pytorch_model-00015-of-00018.bin",
366
+ "transformer.h.49.self_attention.query_key_value.weight": "pytorch_model-00015-of-00018.bin",
367
+ "transformer.h.5.ln_attn.bias": "pytorch_model-00002-of-00018.bin",
368
+ "transformer.h.5.ln_attn.weight": "pytorch_model-00002-of-00018.bin",
369
+ "transformer.h.5.ln_mlp.bias": "pytorch_model-00002-of-00018.bin",
370
+ "transformer.h.5.ln_mlp.weight": "pytorch_model-00002-of-00018.bin",
371
+ "transformer.h.5.mlp.dense_4h_to_h.weight": "pytorch_model-00002-of-00018.bin",
372
+ "transformer.h.5.mlp.dense_h_to_4h.weight": "pytorch_model-00002-of-00018.bin",
373
+ "transformer.h.5.self_attention.dense.weight": "pytorch_model-00002-of-00018.bin",
374
+ "transformer.h.5.self_attention.query_key_value.weight": "pytorch_model-00002-of-00018.bin",
375
+ "transformer.h.50.ln_attn.bias": "pytorch_model-00015-of-00018.bin",
376
+ "transformer.h.50.ln_attn.weight": "pytorch_model-00015-of-00018.bin",
377
+ "transformer.h.50.ln_mlp.bias": "pytorch_model-00015-of-00018.bin",
378
+ "transformer.h.50.ln_mlp.weight": "pytorch_model-00015-of-00018.bin",
379
+ "transformer.h.50.mlp.dense_4h_to_h.weight": "pytorch_model-00015-of-00018.bin",
380
+ "transformer.h.50.mlp.dense_h_to_4h.weight": "pytorch_model-00015-of-00018.bin",
381
+ "transformer.h.50.self_attention.dense.weight": "pytorch_model-00015-of-00018.bin",
382
+ "transformer.h.50.self_attention.query_key_value.weight": "pytorch_model-00015-of-00018.bin",
383
+ "transformer.h.51.ln_attn.bias": "pytorch_model-00015-of-00018.bin",
384
+ "transformer.h.51.ln_attn.weight": "pytorch_model-00015-of-00018.bin",
385
+ "transformer.h.51.ln_mlp.bias": "pytorch_model-00015-of-00018.bin",
386
+ "transformer.h.51.ln_mlp.weight": "pytorch_model-00015-of-00018.bin",
387
+ "transformer.h.51.mlp.dense_4h_to_h.weight": "pytorch_model-00016-of-00018.bin",
388
+ "transformer.h.51.mlp.dense_h_to_4h.weight": "pytorch_model-00015-of-00018.bin",
389
+ "transformer.h.51.self_attention.dense.weight": "pytorch_model-00015-of-00018.bin",
390
+ "transformer.h.51.self_attention.query_key_value.weight": "pytorch_model-00015-of-00018.bin",
391
+ "transformer.h.52.ln_attn.bias": "pytorch_model-00016-of-00018.bin",
392
+ "transformer.h.52.ln_attn.weight": "pytorch_model-00016-of-00018.bin",
393
+ "transformer.h.52.ln_mlp.bias": "pytorch_model-00016-of-00018.bin",
394
+ "transformer.h.52.ln_mlp.weight": "pytorch_model-00016-of-00018.bin",
395
+ "transformer.h.52.mlp.dense_4h_to_h.weight": "pytorch_model-00016-of-00018.bin",
396
+ "transformer.h.52.mlp.dense_h_to_4h.weight": "pytorch_model-00016-of-00018.bin",
397
+ "transformer.h.52.self_attention.dense.weight": "pytorch_model-00016-of-00018.bin",
398
+ "transformer.h.52.self_attention.query_key_value.weight": "pytorch_model-00016-of-00018.bin",
399
+ "transformer.h.53.ln_attn.bias": "pytorch_model-00016-of-00018.bin",
400
+ "transformer.h.53.ln_attn.weight": "pytorch_model-00016-of-00018.bin",
401
+ "transformer.h.53.ln_mlp.bias": "pytorch_model-00016-of-00018.bin",
402
+ "transformer.h.53.ln_mlp.weight": "pytorch_model-00016-of-00018.bin",
403
+ "transformer.h.53.mlp.dense_4h_to_h.weight": "pytorch_model-00016-of-00018.bin",
404
+ "transformer.h.53.mlp.dense_h_to_4h.weight": "pytorch_model-00016-of-00018.bin",
405
+ "transformer.h.53.self_attention.dense.weight": "pytorch_model-00016-of-00018.bin",
406
+ "transformer.h.53.self_attention.query_key_value.weight": "pytorch_model-00016-of-00018.bin",
407
+ "transformer.h.54.ln_attn.bias": "pytorch_model-00016-of-00018.bin",
408
+ "transformer.h.54.ln_attn.weight": "pytorch_model-00016-of-00018.bin",
409
+ "transformer.h.54.ln_mlp.bias": "pytorch_model-00016-of-00018.bin",
410
+ "transformer.h.54.ln_mlp.weight": "pytorch_model-00016-of-00018.bin",
411
+ "transformer.h.54.mlp.dense_4h_to_h.weight": "pytorch_model-00016-of-00018.bin",
412
+ "transformer.h.54.mlp.dense_h_to_4h.weight": "pytorch_model-00016-of-00018.bin",
413
+ "transformer.h.54.self_attention.dense.weight": "pytorch_model-00016-of-00018.bin",
414
+ "transformer.h.54.self_attention.query_key_value.weight": "pytorch_model-00016-of-00018.bin",
415
+ "transformer.h.55.ln_attn.bias": "pytorch_model-00016-of-00018.bin",
416
+ "transformer.h.55.ln_attn.weight": "pytorch_model-00016-of-00018.bin",
417
+ "transformer.h.55.ln_mlp.bias": "pytorch_model-00016-of-00018.bin",
418
+ "transformer.h.55.ln_mlp.weight": "pytorch_model-00016-of-00018.bin",
419
+ "transformer.h.55.mlp.dense_4h_to_h.weight": "pytorch_model-00017-of-00018.bin",
420
+ "transformer.h.55.mlp.dense_h_to_4h.weight": "pytorch_model-00017-of-00018.bin",
421
+ "transformer.h.55.self_attention.dense.weight": "pytorch_model-00016-of-00018.bin",
422
+ "transformer.h.55.self_attention.query_key_value.weight": "pytorch_model-00016-of-00018.bin",
423
+ "transformer.h.56.ln_attn.bias": "pytorch_model-00017-of-00018.bin",
424
+ "transformer.h.56.ln_attn.weight": "pytorch_model-00017-of-00018.bin",
425
+ "transformer.h.56.ln_mlp.bias": "pytorch_model-00017-of-00018.bin",
426
+ "transformer.h.56.ln_mlp.weight": "pytorch_model-00017-of-00018.bin",
427
+ "transformer.h.56.mlp.dense_4h_to_h.weight": "pytorch_model-00017-of-00018.bin",
428
+ "transformer.h.56.mlp.dense_h_to_4h.weight": "pytorch_model-00017-of-00018.bin",
429
+ "transformer.h.56.self_attention.dense.weight": "pytorch_model-00017-of-00018.bin",
430
+ "transformer.h.56.self_attention.query_key_value.weight": "pytorch_model-00017-of-00018.bin",
431
+ "transformer.h.57.ln_attn.bias": "pytorch_model-00017-of-00018.bin",
432
+ "transformer.h.57.ln_attn.weight": "pytorch_model-00017-of-00018.bin",
433
+ "transformer.h.57.ln_mlp.bias": "pytorch_model-00017-of-00018.bin",
434
+ "transformer.h.57.ln_mlp.weight": "pytorch_model-00017-of-00018.bin",
435
+ "transformer.h.57.mlp.dense_4h_to_h.weight": "pytorch_model-00017-of-00018.bin",
436
+ "transformer.h.57.mlp.dense_h_to_4h.weight": "pytorch_model-00017-of-00018.bin",
437
+ "transformer.h.57.self_attention.dense.weight": "pytorch_model-00017-of-00018.bin",
438
+ "transformer.h.57.self_attention.query_key_value.weight": "pytorch_model-00017-of-00018.bin",
439
+ "transformer.h.58.ln_attn.bias": "pytorch_model-00017-of-00018.bin",
440
+ "transformer.h.58.ln_attn.weight": "pytorch_model-00017-of-00018.bin",
441
+ "transformer.h.58.ln_mlp.bias": "pytorch_model-00017-of-00018.bin",
442
+ "transformer.h.58.ln_mlp.weight": "pytorch_model-00017-of-00018.bin",
443
+ "transformer.h.58.mlp.dense_4h_to_h.weight": "pytorch_model-00018-of-00018.bin",
444
+ "transformer.h.58.mlp.dense_h_to_4h.weight": "pytorch_model-00017-of-00018.bin",
445
+ "transformer.h.58.self_attention.dense.weight": "pytorch_model-00017-of-00018.bin",
446
+ "transformer.h.58.self_attention.query_key_value.weight": "pytorch_model-00017-of-00018.bin",
447
+ "transformer.h.59.ln_attn.bias": "pytorch_model-00018-of-00018.bin",
448
+ "transformer.h.59.ln_attn.weight": "pytorch_model-00018-of-00018.bin",
449
+ "transformer.h.59.ln_mlp.bias": "pytorch_model-00018-of-00018.bin",
450
+ "transformer.h.59.ln_mlp.weight": "pytorch_model-00018-of-00018.bin",
451
+ "transformer.h.59.mlp.dense_4h_to_h.weight": "pytorch_model-00018-of-00018.bin",
452
+ "transformer.h.59.mlp.dense_h_to_4h.weight": "pytorch_model-00018-of-00018.bin",
453
+ "transformer.h.59.self_attention.dense.weight": "pytorch_model-00018-of-00018.bin",
454
+ "transformer.h.59.self_attention.query_key_value.weight": "pytorch_model-00018-of-00018.bin",
455
+ "transformer.h.6.ln_attn.bias": "pytorch_model-00002-of-00018.bin",
456
+ "transformer.h.6.ln_attn.weight": "pytorch_model-00002-of-00018.bin",
457
+ "transformer.h.6.ln_mlp.bias": "pytorch_model-00002-of-00018.bin",
458
+ "transformer.h.6.ln_mlp.weight": "pytorch_model-00002-of-00018.bin",
459
+ "transformer.h.6.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00018.bin",
460
+ "transformer.h.6.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00018.bin",
461
+ "transformer.h.6.self_attention.dense.weight": "pytorch_model-00002-of-00018.bin",
462
+ "transformer.h.6.self_attention.query_key_value.weight": "pytorch_model-00002-of-00018.bin",
463
+ "transformer.h.7.ln_attn.bias": "pytorch_model-00003-of-00018.bin",
464
+ "transformer.h.7.ln_attn.weight": "pytorch_model-00003-of-00018.bin",
465
+ "transformer.h.7.ln_mlp.bias": "pytorch_model-00003-of-00018.bin",
466
+ "transformer.h.7.ln_mlp.weight": "pytorch_model-00003-of-00018.bin",
467
+ "transformer.h.7.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00018.bin",
468
+ "transformer.h.7.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00018.bin",
469
+ "transformer.h.7.self_attention.dense.weight": "pytorch_model-00003-of-00018.bin",
470
+ "transformer.h.7.self_attention.query_key_value.weight": "pytorch_model-00003-of-00018.bin",
471
+ "transformer.h.8.ln_attn.bias": "pytorch_model-00003-of-00018.bin",
472
+ "transformer.h.8.ln_attn.weight": "pytorch_model-00003-of-00018.bin",
473
+ "transformer.h.8.ln_mlp.bias": "pytorch_model-00003-of-00018.bin",
474
+ "transformer.h.8.ln_mlp.weight": "pytorch_model-00003-of-00018.bin",
475
+ "transformer.h.8.mlp.dense_4h_to_h.weight": "pytorch_model-00003-of-00018.bin",
476
+ "transformer.h.8.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00018.bin",
477
+ "transformer.h.8.self_attention.dense.weight": "pytorch_model-00003-of-00018.bin",
478
+ "transformer.h.8.self_attention.query_key_value.weight": "pytorch_model-00003-of-00018.bin",
479
+ "transformer.h.9.ln_attn.bias": "pytorch_model-00003-of-00018.bin",
480
+ "transformer.h.9.ln_attn.weight": "pytorch_model-00003-of-00018.bin",
481
+ "transformer.h.9.ln_mlp.bias": "pytorch_model-00003-of-00018.bin",
482
+ "transformer.h.9.ln_mlp.weight": "pytorch_model-00003-of-00018.bin",
483
+ "transformer.h.9.mlp.dense_4h_to_h.weight": "pytorch_model-00004-of-00018.bin",
484
+ "transformer.h.9.mlp.dense_h_to_4h.weight": "pytorch_model-00003-of-00018.bin",
485
+ "transformer.h.9.self_attention.dense.weight": "pytorch_model-00003-of-00018.bin",
486
+ "transformer.h.9.self_attention.query_key_value.weight": "pytorch_model-00003-of-00018.bin",
487
+ "transformer.ln_f.bias": "pytorch_model-00018-of-00018.bin",
488
+ "transformer.ln_f.weight": "pytorch_model-00018-of-00018.bin",
489
+ "transformer.word_embeddings.weight": "pytorch_model-00001-of-00018.bin"
490
+ }
491
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ ">>TITLE<<",
4
+ ">>ABSTRACT<<",
5
+ ">>INTRODUCTION<<",
6
+ ">>SUMMARY<<",
7
+ ">>COMMENT<<",
8
+ ">>ANSWER<<",
9
+ ">>QUESTION<<",
10
+ ">>DOMAIN<<",
11
+ ">>PREFIX<<",
12
+ ">>SUFFIX<<",
13
+ ">>MIDDLE<<"
14
+ ],
15
+ "eos_token": "<|endoftext|>"
16
+ }
stopping.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import StoppingCriteria, StoppingCriteriaList
3
+
4
+ from prompter import PromptType
5
+
6
+
7
+ class StoppingCriteriaSub(StoppingCriteria):
8
+
9
+ def __init__(self, stops=[], encounters=[], device="cuda"):
10
+ super().__init__()
11
+ assert len(stops) % len(encounters) == 0, "Number of stops and encounters must match"
12
+ self.encounters = encounters
13
+ self.stops = [stop.to(device) for stop in stops]
14
+ self.num_stops = [0] * len(stops)
15
+
16
+ def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
17
+ for stopi, stop in enumerate(self.stops):
18
+ if torch.all((stop == input_ids[0][-len(stop):])).item():
19
+ self.num_stops[stopi] += 1
20
+ if self.num_stops[stopi] >= self.encounters[stopi % len(self.encounters)]:
21
+ # print("Stopped", flush=True)
22
+ return True
23
+ # print("Tokens: %s" % input_ids[0].cpu().numpy(), flush=True)
24
+ # print("Stop Tokens: %s" % [x.cpu().numpy() for x in self.stops], flush=True)
25
+ return False
26
+
27
+
28
+ def get_stopping(prompt_type, tokenizer, device, human='<human>:', bot="<bot>:"):
29
+ if prompt_type in [PromptType.human_bot.name, PromptType.instruct_vicuna.name, PromptType.instruct_with_end.name]:
30
+ if prompt_type == PromptType.human_bot.name:
31
+ # encounters = [prompt.count(human) + 1, prompt.count(bot) + 1]
32
+ # stopping only starts once output is beyond prompt
33
+ # 1 human is enough to trigger, but need 2 bots, because very first view back will be bot we added
34
+ stop_words = [human, bot, '\n' + human, '\n' + bot]
35
+ encounters = [1, 2]
36
+ elif prompt_type == PromptType.instruct_vicuna.name:
37
+ # even below is not enough, generic strings and many ways to encode
38
+ stop_words = [
39
+ '### Human:',
40
+ """
41
+ ### Human:""",
42
+ """
43
+ ### Human:
44
+ """,
45
+ '### Assistant:',
46
+ """
47
+ ### Assistant:""",
48
+ """
49
+ ### Assistant:
50
+ """,
51
+ ]
52
+ encounters = [1, 2]
53
+ else:
54
+ # some instruct prompts have this as end, doesn't hurt to stop on it since not common otherwise
55
+ stop_words = ['### End']
56
+ encounters = [1]
57
+ stop_words_ids = [
58
+ tokenizer(stop_word, return_tensors='pt')['input_ids'].squeeze() for stop_word in stop_words]
59
+ # handle single token case
60
+ stop_words_ids = [x if len(x.shape) > 0 else torch.tensor([x]) for x in stop_words_ids]
61
+ stop_words_ids = [x for x in stop_words_ids if x.shape[0] > 0]
62
+ # avoid padding in front of tokens
63
+ if tokenizer._pad_token: # use hidden variable to avoid annoying properly logger bug
64
+ stop_words_ids = [x[1:] if x[0] == tokenizer.pad_token_id and len(x) > 1 else x for x in stop_words_ids]
65
+ # handle fake \n added
66
+ stop_words_ids = [x[1:] if y[0] == '\n' else x for x, y in zip(stop_words_ids, stop_words)]
67
+ # build stopper
68
+ stopping_criteria = StoppingCriteriaList(
69
+ [StoppingCriteriaSub(stops=stop_words_ids, encounters=encounters, device=device)])
70
+ else:
71
+ stopping_criteria = StoppingCriteriaList()
72
+ return stopping_criteria
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "clean_up_tokenization_spaces": true,
4
+ "eos_token": "<|endoftext|>",
5
+ "model_max_length": 2048,
6
+ "tokenizer_class": "PreTrainedTokenizerFast"
7
+ }