freedomking commited on
Commit
32cafd3
·
verified ·
1 Parent(s): dff851a

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,3 +1,120 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OpenSpark-13B-Chat
2
+
3
+ [**中文**](./README_zh.md) | **English**
4
+
5
+ This is a Hugging Face compatible version of the iFlytek Spark model, converted from Megatron-DeepSpeed weights by the community. It has been optimized for the `transformers` ecosystem.
6
+
7
+ ## Requirements
8
+
9
+ ```bash
10
+ pip install torch transformers sentencepiece
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ You can load this model using the `transformers` library. Ensure you have `trust_remote_code=True` set to load the model and tokenizer logic.
16
+
17
+ ### Basic Usage
18
+
19
+ ```python
20
+ from transformers import AutoModelForCausalLM, AutoTokenizer
21
+ import torch
22
+
23
+ model_path = "freedomking/OpenSpark-13B-Chat"
24
+
25
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
26
+ model = AutoModelForCausalLM.from_pretrained(
27
+ model_path,
28
+ torch_dtype=torch.bfloat16,
29
+ device_map="auto",
30
+ trust_remote_code=True
31
+ )
32
+
33
+ prompt = "<User> 你好,请自我介绍一下。<end><Bot>"
34
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
35
+
36
+ outputs = model.generate(**inputs, max_new_tokens=512)
37
+ print(tokenizer.decode(outputs[0], skip_special_tokens=False))
38
+ ```
39
+
40
+ ### Using `apply_chat_template` (Recommended)
41
+
42
+ For multi-turn conversations, use the built-in chat template:
43
+
44
+ ```python
45
+ messages = [
46
+ {"role": "user", "content": "你好,请自我介绍一下。"}
47
+ ]
48
+
49
+ inputs = tokenizer.apply_chat_template(
50
+ messages,
51
+ tokenize=True,
52
+ return_tensors="pt",
53
+ add_generation_prompt=True
54
+ ).to(model.device)
55
+
56
+ outputs = model.generate(
57
+ inputs,
58
+ max_new_tokens=8192,
59
+ temperature=0.7,
60
+ top_k=1,
61
+ do_sample=True,
62
+ repetition_penalty=1.02,
63
+ )
64
+ print(tokenizer.decode(outputs[0], skip_special_tokens=False))
65
+ ```
66
+
67
+ ### Multi-turn Conversation
68
+
69
+ ```python
70
+ messages = [
71
+ {"role": "user", "content": "什么是人工智能?"},
72
+ {"role": "assistant", "content": "人工智能是一种模拟人类智能的技术..."},
73
+ {"role": "user", "content": "它有哪些应用场景?"}
74
+ ]
75
+
76
+ inputs = tokenizer.apply_chat_template(
77
+ messages,
78
+ tokenize=True,
79
+ return_tensors="pt",
80
+ add_generation_prompt=True
81
+ ).to(model.device)
82
+
83
+ outputs = model.generate(inputs, max_new_tokens=512)
84
+ print(tokenizer.decode(outputs[0], skip_special_tokens=False))
85
+ ```
86
+
87
+ ## Model Details
88
+
89
+ | Parameter | Value |
90
+ |---|---|
91
+ | Architecture | Transformer Decoder (Spark) |
92
+ | Parameters | ~13B |
93
+ | Hidden Size | 5120 |
94
+ | Layers | 40 |
95
+ | Attention Heads | 40 |
96
+ | Vocab Size | 60,000 |
97
+ | Context Length | 32K |
98
+ | RoPE Base (Theta) | 1,000,000 |
99
+ | Activation | GeLU |
100
+
101
+ ## Generation Parameters
102
+
103
+ | Parameter | Recommended Value |
104
+ |---|---|
105
+ | `max_new_tokens` | 8192 |
106
+ | `temperature` | 0.7 |
107
+ | `top_k` | 1 |
108
+ | `do_sample` | True |
109
+ | `repetition_penalty` | 1.02 |
110
+
111
+ ## Features
112
+
113
+ - **Chat Template**: Supports `apply_chat_template` for multi-turn dialogues (`<User>...<end><Bot>...` format).
114
+ - **Standardized Naming**: Consistent with mainstream models like Qwen and Llama.
115
+ - **Custom Tokenizer**: Handles Chinese punctuation, tab formatting, and special tokens (`<ret>`, `<end>`).
116
+ - **BFloat16 Support**: Optimized for modern GPUs with BF16 precision.
117
+
118
+ ## License
119
+
120
+ Please refer to iFlytek's official license agreement for usage terms.
README_zh.md ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OpenSpark-13B-Chat
2
+
3
+ **中文** | [**English**](./README.md)
4
+
5
+ 这是由社区将讯飞星火(iFlytek Spark)模型的 Megatron-DeepSpeed 权重转换为 Hugging Face 格式的版本。该版本已针对 `transformers` 生态进行了深度优化。
6
+
7
+ ## 环境要求
8
+
9
+ ```bash
10
+ pip install torch transformers sentencepiece
11
+ ```
12
+
13
+ ## 使用方法
14
+
15
+ 你可以使用 `transformers` 库直接加载。请确保设置 `trust_remote_code=True` 以加载模型和 Tokenizer 的逻辑代码。
16
+
17
+ ### 基本用法
18
+
19
+ ```python
20
+ from transformers import AutoModelForCausalLM, AutoTokenizer
21
+ import torch
22
+
23
+ model_path = "freedomking/OpenSpark-13B-Chat"
24
+
25
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
26
+ model = AutoModelForCausalLM.from_pretrained(
27
+ model_path,
28
+ torch_dtype=torch.bfloat16,
29
+ device_map="auto",
30
+ trust_remote_code=True
31
+ )
32
+
33
+ prompt = "<User> 你好,请自我介绍一下。<end><Bot>"
34
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
35
+
36
+ outputs = model.generate(**inputs, max_new_tokens=512)
37
+ print(tokenizer.decode(outputs[0], skip_special_tokens=False))
38
+ ```
39
+
40
+ ### 使用 `apply_chat_template` (推荐)
41
+
42
+ 对于多轮对话,请使用内置的对话模板:
43
+
44
+ ```python
45
+ messages = [
46
+ {"role": "user", "content": "你好,请自我介绍一下。"}
47
+ ]
48
+
49
+ inputs = tokenizer.apply_chat_template(
50
+ messages,
51
+ tokenize=True,
52
+ return_tensors="pt",
53
+ add_generation_prompt=True
54
+ ).to(model.device)
55
+
56
+ outputs = model.generate(
57
+ inputs,
58
+ max_new_tokens=8192,
59
+ temperature=0.7,
60
+ top_k=1,
61
+ do_sample=True,
62
+ repetition_penalty=1.02,
63
+ )
64
+ print(tokenizer.decode(outputs[0], skip_special_tokens=False))
65
+ ```
66
+
67
+ ### 多轮对话
68
+
69
+ ```python
70
+ messages = [
71
+ {"role": "user", "content": "什么是人工智能?"},
72
+ {"role": "assistant", "content": "人工智能是一种模拟人类智能的技术..."},
73
+ {"role": "user", "content": "它有哪些应用场景?"}
74
+ ]
75
+
76
+ inputs = tokenizer.apply_chat_template(
77
+ messages,
78
+ tokenize=True,
79
+ return_tensors="pt",
80
+ add_generation_prompt=True
81
+ ).to(model.device)
82
+
83
+ outputs = model.generate(inputs, max_new_tokens=512)
84
+ print(tokenizer.decode(outputs[0], skip_special_tokens=False))
85
+ ```
86
+
87
+ ## 模型详情
88
+
89
+ | 参数 | 值 |
90
+ |---|---|
91
+ | 架构 | Transformer Decoder (Spark) |
92
+ | 参数量 | 约 13B |
93
+ | 隐藏层维度 | 5120 |
94
+ | 层数 | 40 |
95
+ | 注意力头数 | 40 |
96
+ | 词表大小 | 60,000 |
97
+ | 上下文长度 | 32K |
98
+ | RoPE 基数 (Theta) | 1,000,000 |
99
+ | 激活函数 | GeLU |
100
+
101
+ ## 推荐生成参数
102
+
103
+ | 参数 | 推荐值 |
104
+ |---|---|
105
+ | `max_new_tokens` | 8192 |
106
+ | `temperature` | 0.7 |
107
+ | `top_k` | 1 |
108
+ | `do_sample` | True |
109
+ | `repetition_penalty` | 1.02 |
110
+
111
+ ## 核心特性
112
+
113
+ - **对话模板**: 支持 `apply_chat_template` 进行多轮对话 (`<User>...<end><Bot>...` 格式)。
114
+ - **标准化命名**: 与 Qwen、Llama 等主流模型命名规范保持一致。
115
+ - **自定义 Tokenizer**: 完整支持中文标点处理、制表符格式化以及特殊 Token(`<ret>`, `<end>`)。
116
+ - **BFloat16 支持**: 针对现代 GPU 优化,使用 BF16 精度。
117
+
118
+ ## 许可证
119
+
120
+ 使用条款请参考讯飞官方的许可协议。
chat_template.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {% if messages[0]['role'] == 'system' %}{% set system_message = messages[0]['content'] %}{% endif %}{% if system_message is defined %}{{ '<System> ' + system_message + '<end>' }}{% endif %}{% for message in messages %}{% if message['role'] == 'user' %}{{ '<User> ' + message['content'] + '<end><Bot> ' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + '<end>' }}{% endif %}{% endfor %}
config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "SparkForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_spark.SparkConfig",
9
+ "AutoModelForCausalLM": "modeling_spark.SparkForCausalLM",
10
+ "AutoTokenizer": [
11
+ "tokenization_spark.SparkTokenizer",
12
+ null
13
+ ]
14
+ },
15
+ "bos_token_id": 1,
16
+ "dropout_rate": 0.0,
17
+ "dtype": "bfloat16",
18
+ "eos_token_id": 5,
19
+ "ffn_hidden_size": 14336,
20
+ "hidden_act": "gelu",
21
+ "hidden_size": 5120,
22
+ "init_std": 0.014,
23
+ "initializer_range": 0.02,
24
+ "intermediate_size": 14336,
25
+ "layernorm_epsilon": 1e-05,
26
+ "max_position_embeddings": 32768,
27
+ "model_type": "spark",
28
+ "num_attention_heads": 40,
29
+ "num_heads": 40,
30
+ "num_hidden_layers": 40,
31
+ "num_key_value_heads": 40,
32
+ "num_layers": 40,
33
+ "pad_token_id": 0,
34
+ "rms_norm_eps": 1e-06,
35
+ "rope_scaling": null,
36
+ "rope_theta": 1000000.0,
37
+ "tie_word_embeddings": true,
38
+ "transformers_version": "4.56.1",
39
+ "use_bias": true,
40
+ "use_cache": true,
41
+ "vocab_size": 60000,
42
+ "torch_dtype": "bfloat16"
43
+ }
configuration_spark.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import PretrainedConfig
2
+
3
+ class SparkConfig(PretrainedConfig):
4
+ model_type = "spark"
5
+
6
+ # 定义需要从 kwargs 中过滤掉的父类 property 属性
7
+ # 这些在新版 transformers 中是只读的,不能通过 setattr 设置
8
+ _keys_to_ignore_on_load = [
9
+ "use_return_dict",
10
+ "output_attentions",
11
+ "output_hidden_states",
12
+ ]
13
+
14
+ def __init__(
15
+ self,
16
+ vocab_size=60000,
17
+ hidden_size=5120,
18
+ intermediate_size=14336,
19
+ num_hidden_layers=40,
20
+ num_attention_heads=40,
21
+ num_key_value_heads=40,
22
+ hidden_act="gelu",
23
+ max_position_embeddings=32768,
24
+ initializer_range=0.02,
25
+ rms_norm_eps=1e-6,
26
+ pad_token_id=0,
27
+ bos_token_id=1,
28
+ eos_token_id=5,
29
+ tie_word_embeddings=False,
30
+ rope_theta=1000000.0,
31
+ ffn_hidden_size=14336,
32
+ use_bias=True,
33
+ layernorm_epsilon=1e-5,
34
+ init_std=0.014,
35
+ **kwargs,
36
+ ):
37
+ # 过滤掉父类中只读的 property 属性,避免 AttributeError
38
+ for key in self._keys_to_ignore_on_load:
39
+ kwargs.pop(key, None)
40
+
41
+ self.vocab_size = vocab_size
42
+ self.hidden_size = hidden_size
43
+ self.intermediate_size = intermediate_size
44
+ self.num_hidden_layers = num_hidden_layers
45
+ self.num_layers = num_hidden_layers
46
+ self.num_attention_heads = num_attention_heads
47
+ self.num_heads = num_attention_heads
48
+ self.num_key_value_heads = num_key_value_heads
49
+ self.hidden_act = hidden_act
50
+ self.max_position_embeddings = max_position_embeddings
51
+ self.initializer_range = initializer_range
52
+ self.rms_norm_eps = rms_norm_eps
53
+ self.rope_theta = rope_theta
54
+ self.ffn_hidden_size = ffn_hidden_size
55
+ self.use_bias = use_bias
56
+ self.layernorm_epsilon = layernorm_epsilon
57
+ self.init_std = init_std
58
+
59
+ super().__init__(
60
+ pad_token_id=pad_token_id,
61
+ bos_token_id=bos_token_id,
62
+ eos_token_id=eos_token_id,
63
+ tie_word_embeddings=tie_word_embeddings,
64
+ **kwargs,
65
+ )
generation_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "do_sample": true,
5
+ "eos_token_id": 5,
6
+ "max_new_tokens": 8192,
7
+ "pad_token_id": 0,
8
+ "repetition_penalty": 1.02,
9
+ "temperature": 0.7,
10
+ "top_k": 1,
11
+ "transformers_version": "4.56.1"
12
+ }
model-00001-of-00006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61aef5c2b57b96eab835267db22974392d0c4ab18c027f52180e145dd572e317
3
+ size 4725806264
model-00002-of-00006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c56f96b2c6d512a54d31ddfeb1132f136d3fcc504021fe27181451de75c096f5
3
+ size 4992366800
model-00003-of-00006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0bed3d6d147d4987f6f68cc8e3ddf35bf99ff6068b1a50631a44a868c0bc63de
3
+ size 4761653544
model-00004-of-00006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34169b4b9313a6ee265543cb9ca85bcc1648bca2f7d2b02388f73f25511d5c6f
3
+ size 4992366856
model-00005-of-00006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:347c71dc0c78f8827d4bf9d712eea30d6d270e92a2f905552a5b7f7b48c98ebd
3
+ size 4761653544
model-00006-of-00006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6a13af9e345df90cbe80ac39171a936a6eff6c169fa7a20dd518c5b4f8ca192
3
+ size 2391294704
model.safetensors.index.json ADDED
@@ -0,0 +1,491 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_parameters": 13312542720,
4
+ "total_size": 26625085440
5
+ },
6
+ "weight_map": {
7
+ "model.embed_tokens.weight": "model-00001-of-00006.safetensors",
8
+ "model.layers.0.input_layernorm.bias": "model-00001-of-00006.safetensors",
9
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00006.safetensors",
10
+ "model.layers.0.mlp.dense_4h_to_h.bias": "model-00001-of-00006.safetensors",
11
+ "model.layers.0.mlp.dense_4h_to_h.weight": "model-00001-of-00006.safetensors",
12
+ "model.layers.0.mlp.dense_h_to_4h.bias": "model-00001-of-00006.safetensors",
13
+ "model.layers.0.mlp.dense_h_to_4h.weight": "model-00001-of-00006.safetensors",
14
+ "model.layers.0.post_attention_layernorm.bias": "model-00001-of-00006.safetensors",
15
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
16
+ "model.layers.0.self_attn.dense.bias": "model-00001-of-00006.safetensors",
17
+ "model.layers.0.self_attn.dense.weight": "model-00001-of-00006.safetensors",
18
+ "model.layers.0.self_attn.query_key_value.bias": "model-00001-of-00006.safetensors",
19
+ "model.layers.0.self_attn.query_key_value.weight": "model-00001-of-00006.safetensors",
20
+ "model.layers.1.input_layernorm.bias": "model-00001-of-00006.safetensors",
21
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00006.safetensors",
22
+ "model.layers.1.mlp.dense_4h_to_h.bias": "model-00001-of-00006.safetensors",
23
+ "model.layers.1.mlp.dense_4h_to_h.weight": "model-00001-of-00006.safetensors",
24
+ "model.layers.1.mlp.dense_h_to_4h.bias": "model-00001-of-00006.safetensors",
25
+ "model.layers.1.mlp.dense_h_to_4h.weight": "model-00001-of-00006.safetensors",
26
+ "model.layers.1.post_attention_layernorm.bias": "model-00001-of-00006.safetensors",
27
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
28
+ "model.layers.1.self_attn.dense.bias": "model-00001-of-00006.safetensors",
29
+ "model.layers.1.self_attn.dense.weight": "model-00001-of-00006.safetensors",
30
+ "model.layers.1.self_attn.query_key_value.bias": "model-00001-of-00006.safetensors",
31
+ "model.layers.1.self_attn.query_key_value.weight": "model-00001-of-00006.safetensors",
32
+ "model.layers.10.input_layernorm.bias": "model-00002-of-00006.safetensors",
33
+ "model.layers.10.input_layernorm.weight": "model-00002-of-00006.safetensors",
34
+ "model.layers.10.mlp.dense_4h_to_h.bias": "model-00002-of-00006.safetensors",
35
+ "model.layers.10.mlp.dense_4h_to_h.weight": "model-00002-of-00006.safetensors",
36
+ "model.layers.10.mlp.dense_h_to_4h.bias": "model-00002-of-00006.safetensors",
37
+ "model.layers.10.mlp.dense_h_to_4h.weight": "model-00002-of-00006.safetensors",
38
+ "model.layers.10.post_attention_layernorm.bias": "model-00002-of-00006.safetensors",
39
+ "model.layers.10.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
40
+ "model.layers.10.self_attn.dense.bias": "model-00002-of-00006.safetensors",
41
+ "model.layers.10.self_attn.dense.weight": "model-00002-of-00006.safetensors",
42
+ "model.layers.10.self_attn.query_key_value.bias": "model-00002-of-00006.safetensors",
43
+ "model.layers.10.self_attn.query_key_value.weight": "model-00002-of-00006.safetensors",
44
+ "model.layers.11.input_layernorm.bias": "model-00002-of-00006.safetensors",
45
+ "model.layers.11.input_layernorm.weight": "model-00002-of-00006.safetensors",
46
+ "model.layers.11.mlp.dense_4h_to_h.bias": "model-00002-of-00006.safetensors",
47
+ "model.layers.11.mlp.dense_4h_to_h.weight": "model-00002-of-00006.safetensors",
48
+ "model.layers.11.mlp.dense_h_to_4h.bias": "model-00002-of-00006.safetensors",
49
+ "model.layers.11.mlp.dense_h_to_4h.weight": "model-00002-of-00006.safetensors",
50
+ "model.layers.11.post_attention_layernorm.bias": "model-00002-of-00006.safetensors",
51
+ "model.layers.11.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
52
+ "model.layers.11.self_attn.dense.bias": "model-00002-of-00006.safetensors",
53
+ "model.layers.11.self_attn.dense.weight": "model-00002-of-00006.safetensors",
54
+ "model.layers.11.self_attn.query_key_value.bias": "model-00002-of-00006.safetensors",
55
+ "model.layers.11.self_attn.query_key_value.weight": "model-00002-of-00006.safetensors",
56
+ "model.layers.12.input_layernorm.bias": "model-00002-of-00006.safetensors",
57
+ "model.layers.12.input_layernorm.weight": "model-00002-of-00006.safetensors",
58
+ "model.layers.12.mlp.dense_4h_to_h.bias": "model-00002-of-00006.safetensors",
59
+ "model.layers.12.mlp.dense_4h_to_h.weight": "model-00002-of-00006.safetensors",
60
+ "model.layers.12.mlp.dense_h_to_4h.bias": "model-00002-of-00006.safetensors",
61
+ "model.layers.12.mlp.dense_h_to_4h.weight": "model-00002-of-00006.safetensors",
62
+ "model.layers.12.post_attention_layernorm.bias": "model-00002-of-00006.safetensors",
63
+ "model.layers.12.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
64
+ "model.layers.12.self_attn.dense.bias": "model-00002-of-00006.safetensors",
65
+ "model.layers.12.self_attn.dense.weight": "model-00002-of-00006.safetensors",
66
+ "model.layers.12.self_attn.query_key_value.bias": "model-00002-of-00006.safetensors",
67
+ "model.layers.12.self_attn.query_key_value.weight": "model-00002-of-00006.safetensors",
68
+ "model.layers.13.input_layernorm.bias": "model-00002-of-00006.safetensors",
69
+ "model.layers.13.input_layernorm.weight": "model-00002-of-00006.safetensors",
70
+ "model.layers.13.mlp.dense_4h_to_h.bias": "model-00002-of-00006.safetensors",
71
+ "model.layers.13.mlp.dense_4h_to_h.weight": "model-00002-of-00006.safetensors",
72
+ "model.layers.13.mlp.dense_h_to_4h.bias": "model-00002-of-00006.safetensors",
73
+ "model.layers.13.mlp.dense_h_to_4h.weight": "model-00002-of-00006.safetensors",
74
+ "model.layers.13.post_attention_layernorm.bias": "model-00002-of-00006.safetensors",
75
+ "model.layers.13.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
76
+ "model.layers.13.self_attn.dense.bias": "model-00002-of-00006.safetensors",
77
+ "model.layers.13.self_attn.dense.weight": "model-00002-of-00006.safetensors",
78
+ "model.layers.13.self_attn.query_key_value.bias": "model-00002-of-00006.safetensors",
79
+ "model.layers.13.self_attn.query_key_value.weight": "model-00002-of-00006.safetensors",
80
+ "model.layers.14.input_layernorm.bias": "model-00002-of-00006.safetensors",
81
+ "model.layers.14.input_layernorm.weight": "model-00002-of-00006.safetensors",
82
+ "model.layers.14.mlp.dense_4h_to_h.bias": "model-00003-of-00006.safetensors",
83
+ "model.layers.14.mlp.dense_4h_to_h.weight": "model-00003-of-00006.safetensors",
84
+ "model.layers.14.mlp.dense_h_to_4h.bias": "model-00003-of-00006.safetensors",
85
+ "model.layers.14.mlp.dense_h_to_4h.weight": "model-00003-of-00006.safetensors",
86
+ "model.layers.14.post_attention_layernorm.bias": "model-00003-of-00006.safetensors",
87
+ "model.layers.14.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
88
+ "model.layers.14.self_attn.dense.bias": "model-00003-of-00006.safetensors",
89
+ "model.layers.14.self_attn.dense.weight": "model-00003-of-00006.safetensors",
90
+ "model.layers.14.self_attn.query_key_value.bias": "model-00003-of-00006.safetensors",
91
+ "model.layers.14.self_attn.query_key_value.weight": "model-00003-of-00006.safetensors",
92
+ "model.layers.15.input_layernorm.bias": "model-00003-of-00006.safetensors",
93
+ "model.layers.15.input_layernorm.weight": "model-00003-of-00006.safetensors",
94
+ "model.layers.15.mlp.dense_4h_to_h.bias": "model-00003-of-00006.safetensors",
95
+ "model.layers.15.mlp.dense_4h_to_h.weight": "model-00003-of-00006.safetensors",
96
+ "model.layers.15.mlp.dense_h_to_4h.bias": "model-00003-of-00006.safetensors",
97
+ "model.layers.15.mlp.dense_h_to_4h.weight": "model-00003-of-00006.safetensors",
98
+ "model.layers.15.post_attention_layernorm.bias": "model-00003-of-00006.safetensors",
99
+ "model.layers.15.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
100
+ "model.layers.15.self_attn.dense.bias": "model-00003-of-00006.safetensors",
101
+ "model.layers.15.self_attn.dense.weight": "model-00003-of-00006.safetensors",
102
+ "model.layers.15.self_attn.query_key_value.bias": "model-00003-of-00006.safetensors",
103
+ "model.layers.15.self_attn.query_key_value.weight": "model-00003-of-00006.safetensors",
104
+ "model.layers.16.input_layernorm.bias": "model-00003-of-00006.safetensors",
105
+ "model.layers.16.input_layernorm.weight": "model-00003-of-00006.safetensors",
106
+ "model.layers.16.mlp.dense_4h_to_h.bias": "model-00003-of-00006.safetensors",
107
+ "model.layers.16.mlp.dense_4h_to_h.weight": "model-00003-of-00006.safetensors",
108
+ "model.layers.16.mlp.dense_h_to_4h.bias": "model-00003-of-00006.safetensors",
109
+ "model.layers.16.mlp.dense_h_to_4h.weight": "model-00003-of-00006.safetensors",
110
+ "model.layers.16.post_attention_layernorm.bias": "model-00003-of-00006.safetensors",
111
+ "model.layers.16.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
112
+ "model.layers.16.self_attn.dense.bias": "model-00003-of-00006.safetensors",
113
+ "model.layers.16.self_attn.dense.weight": "model-00003-of-00006.safetensors",
114
+ "model.layers.16.self_attn.query_key_value.bias": "model-00003-of-00006.safetensors",
115
+ "model.layers.16.self_attn.query_key_value.weight": "model-00003-of-00006.safetensors",
116
+ "model.layers.17.input_layernorm.bias": "model-00003-of-00006.safetensors",
117
+ "model.layers.17.input_layernorm.weight": "model-00003-of-00006.safetensors",
118
+ "model.layers.17.mlp.dense_4h_to_h.bias": "model-00003-of-00006.safetensors",
119
+ "model.layers.17.mlp.dense_4h_to_h.weight": "model-00003-of-00006.safetensors",
120
+ "model.layers.17.mlp.dense_h_to_4h.bias": "model-00003-of-00006.safetensors",
121
+ "model.layers.17.mlp.dense_h_to_4h.weight": "model-00003-of-00006.safetensors",
122
+ "model.layers.17.post_attention_layernorm.bias": "model-00003-of-00006.safetensors",
123
+ "model.layers.17.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
124
+ "model.layers.17.self_attn.dense.bias": "model-00003-of-00006.safetensors",
125
+ "model.layers.17.self_attn.dense.weight": "model-00003-of-00006.safetensors",
126
+ "model.layers.17.self_attn.query_key_value.bias": "model-00003-of-00006.safetensors",
127
+ "model.layers.17.self_attn.query_key_value.weight": "model-00003-of-00006.safetensors",
128
+ "model.layers.18.input_layernorm.bias": "model-00003-of-00006.safetensors",
129
+ "model.layers.18.input_layernorm.weight": "model-00003-of-00006.safetensors",
130
+ "model.layers.18.mlp.dense_4h_to_h.bias": "model-00003-of-00006.safetensors",
131
+ "model.layers.18.mlp.dense_4h_to_h.weight": "model-00003-of-00006.safetensors",
132
+ "model.layers.18.mlp.dense_h_to_4h.bias": "model-00003-of-00006.safetensors",
133
+ "model.layers.18.mlp.dense_h_to_4h.weight": "model-00003-of-00006.safetensors",
134
+ "model.layers.18.post_attention_layernorm.bias": "model-00003-of-00006.safetensors",
135
+ "model.layers.18.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
136
+ "model.layers.18.self_attn.dense.bias": "model-00003-of-00006.safetensors",
137
+ "model.layers.18.self_attn.dense.weight": "model-00003-of-00006.safetensors",
138
+ "model.layers.18.self_attn.query_key_value.bias": "model-00003-of-00006.safetensors",
139
+ "model.layers.18.self_attn.query_key_value.weight": "model-00003-of-00006.safetensors",
140
+ "model.layers.19.input_layernorm.bias": "model-00003-of-00006.safetensors",
141
+ "model.layers.19.input_layernorm.weight": "model-00003-of-00006.safetensors",
142
+ "model.layers.19.mlp.dense_4h_to_h.bias": "model-00003-of-00006.safetensors",
143
+ "model.layers.19.mlp.dense_4h_to_h.weight": "model-00003-of-00006.safetensors",
144
+ "model.layers.19.mlp.dense_h_to_4h.bias": "model-00003-of-00006.safetensors",
145
+ "model.layers.19.mlp.dense_h_to_4h.weight": "model-00003-of-00006.safetensors",
146
+ "model.layers.19.post_attention_layernorm.bias": "model-00003-of-00006.safetensors",
147
+ "model.layers.19.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
148
+ "model.layers.19.self_attn.dense.bias": "model-00003-of-00006.safetensors",
149
+ "model.layers.19.self_attn.dense.weight": "model-00003-of-00006.safetensors",
150
+ "model.layers.19.self_attn.query_key_value.bias": "model-00003-of-00006.safetensors",
151
+ "model.layers.19.self_attn.query_key_value.weight": "model-00003-of-00006.safetensors",
152
+ "model.layers.2.input_layernorm.bias": "model-00001-of-00006.safetensors",
153
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00006.safetensors",
154
+ "model.layers.2.mlp.dense_4h_to_h.bias": "model-00001-of-00006.safetensors",
155
+ "model.layers.2.mlp.dense_4h_to_h.weight": "model-00001-of-00006.safetensors",
156
+ "model.layers.2.mlp.dense_h_to_4h.bias": "model-00001-of-00006.safetensors",
157
+ "model.layers.2.mlp.dense_h_to_4h.weight": "model-00001-of-00006.safetensors",
158
+ "model.layers.2.post_attention_layernorm.bias": "model-00001-of-00006.safetensors",
159
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
160
+ "model.layers.2.self_attn.dense.bias": "model-00001-of-00006.safetensors",
161
+ "model.layers.2.self_attn.dense.weight": "model-00001-of-00006.safetensors",
162
+ "model.layers.2.self_attn.query_key_value.bias": "model-00001-of-00006.safetensors",
163
+ "model.layers.2.self_attn.query_key_value.weight": "model-00001-of-00006.safetensors",
164
+ "model.layers.20.input_layernorm.bias": "model-00003-of-00006.safetensors",
165
+ "model.layers.20.input_layernorm.weight": "model-00003-of-00006.safetensors",
166
+ "model.layers.20.mlp.dense_4h_to_h.bias": "model-00003-of-00006.safetensors",
167
+ "model.layers.20.mlp.dense_4h_to_h.weight": "model-00003-of-00006.safetensors",
168
+ "model.layers.20.mlp.dense_h_to_4h.bias": "model-00003-of-00006.safetensors",
169
+ "model.layers.20.mlp.dense_h_to_4h.weight": "model-00003-of-00006.safetensors",
170
+ "model.layers.20.post_attention_layernorm.bias": "model-00003-of-00006.safetensors",
171
+ "model.layers.20.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
172
+ "model.layers.20.self_attn.dense.bias": "model-00003-of-00006.safetensors",
173
+ "model.layers.20.self_attn.dense.weight": "model-00003-of-00006.safetensors",
174
+ "model.layers.20.self_attn.query_key_value.bias": "model-00003-of-00006.safetensors",
175
+ "model.layers.20.self_attn.query_key_value.weight": "model-00003-of-00006.safetensors",
176
+ "model.layers.21.input_layernorm.bias": "model-00003-of-00006.safetensors",
177
+ "model.layers.21.input_layernorm.weight": "model-00003-of-00006.safetensors",
178
+ "model.layers.21.mlp.dense_4h_to_h.bias": "model-00004-of-00006.safetensors",
179
+ "model.layers.21.mlp.dense_4h_to_h.weight": "model-00004-of-00006.safetensors",
180
+ "model.layers.21.mlp.dense_h_to_4h.bias": "model-00004-of-00006.safetensors",
181
+ "model.layers.21.mlp.dense_h_to_4h.weight": "model-00004-of-00006.safetensors",
182
+ "model.layers.21.post_attention_layernorm.bias": "model-00003-of-00006.safetensors",
183
+ "model.layers.21.post_attention_layernorm.weight": "model-00003-of-00006.safetensors",
184
+ "model.layers.21.self_attn.dense.bias": "model-00003-of-00006.safetensors",
185
+ "model.layers.21.self_attn.dense.weight": "model-00003-of-00006.safetensors",
186
+ "model.layers.21.self_attn.query_key_value.bias": "model-00003-of-00006.safetensors",
187
+ "model.layers.21.self_attn.query_key_value.weight": "model-00003-of-00006.safetensors",
188
+ "model.layers.22.input_layernorm.bias": "model-00004-of-00006.safetensors",
189
+ "model.layers.22.input_layernorm.weight": "model-00004-of-00006.safetensors",
190
+ "model.layers.22.mlp.dense_4h_to_h.bias": "model-00004-of-00006.safetensors",
191
+ "model.layers.22.mlp.dense_4h_to_h.weight": "model-00004-of-00006.safetensors",
192
+ "model.layers.22.mlp.dense_h_to_4h.bias": "model-00004-of-00006.safetensors",
193
+ "model.layers.22.mlp.dense_h_to_4h.weight": "model-00004-of-00006.safetensors",
194
+ "model.layers.22.post_attention_layernorm.bias": "model-00004-of-00006.safetensors",
195
+ "model.layers.22.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
196
+ "model.layers.22.self_attn.dense.bias": "model-00004-of-00006.safetensors",
197
+ "model.layers.22.self_attn.dense.weight": "model-00004-of-00006.safetensors",
198
+ "model.layers.22.self_attn.query_key_value.bias": "model-00004-of-00006.safetensors",
199
+ "model.layers.22.self_attn.query_key_value.weight": "model-00004-of-00006.safetensors",
200
+ "model.layers.23.input_layernorm.bias": "model-00004-of-00006.safetensors",
201
+ "model.layers.23.input_layernorm.weight": "model-00004-of-00006.safetensors",
202
+ "model.layers.23.mlp.dense_4h_to_h.bias": "model-00004-of-00006.safetensors",
203
+ "model.layers.23.mlp.dense_4h_to_h.weight": "model-00004-of-00006.safetensors",
204
+ "model.layers.23.mlp.dense_h_to_4h.bias": "model-00004-of-00006.safetensors",
205
+ "model.layers.23.mlp.dense_h_to_4h.weight": "model-00004-of-00006.safetensors",
206
+ "model.layers.23.post_attention_layernorm.bias": "model-00004-of-00006.safetensors",
207
+ "model.layers.23.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
208
+ "model.layers.23.self_attn.dense.bias": "model-00004-of-00006.safetensors",
209
+ "model.layers.23.self_attn.dense.weight": "model-00004-of-00006.safetensors",
210
+ "model.layers.23.self_attn.query_key_value.bias": "model-00004-of-00006.safetensors",
211
+ "model.layers.23.self_attn.query_key_value.weight": "model-00004-of-00006.safetensors",
212
+ "model.layers.24.input_layernorm.bias": "model-00004-of-00006.safetensors",
213
+ "model.layers.24.input_layernorm.weight": "model-00004-of-00006.safetensors",
214
+ "model.layers.24.mlp.dense_4h_to_h.bias": "model-00004-of-00006.safetensors",
215
+ "model.layers.24.mlp.dense_4h_to_h.weight": "model-00004-of-00006.safetensors",
216
+ "model.layers.24.mlp.dense_h_to_4h.bias": "model-00004-of-00006.safetensors",
217
+ "model.layers.24.mlp.dense_h_to_4h.weight": "model-00004-of-00006.safetensors",
218
+ "model.layers.24.post_attention_layernorm.bias": "model-00004-of-00006.safetensors",
219
+ "model.layers.24.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
220
+ "model.layers.24.self_attn.dense.bias": "model-00004-of-00006.safetensors",
221
+ "model.layers.24.self_attn.dense.weight": "model-00004-of-00006.safetensors",
222
+ "model.layers.24.self_attn.query_key_value.bias": "model-00004-of-00006.safetensors",
223
+ "model.layers.24.self_attn.query_key_value.weight": "model-00004-of-00006.safetensors",
224
+ "model.layers.25.input_layernorm.bias": "model-00004-of-00006.safetensors",
225
+ "model.layers.25.input_layernorm.weight": "model-00004-of-00006.safetensors",
226
+ "model.layers.25.mlp.dense_4h_to_h.bias": "model-00004-of-00006.safetensors",
227
+ "model.layers.25.mlp.dense_4h_to_h.weight": "model-00004-of-00006.safetensors",
228
+ "model.layers.25.mlp.dense_h_to_4h.bias": "model-00004-of-00006.safetensors",
229
+ "model.layers.25.mlp.dense_h_to_4h.weight": "model-00004-of-00006.safetensors",
230
+ "model.layers.25.post_attention_layernorm.bias": "model-00004-of-00006.safetensors",
231
+ "model.layers.25.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
232
+ "model.layers.25.self_attn.dense.bias": "model-00004-of-00006.safetensors",
233
+ "model.layers.25.self_attn.dense.weight": "model-00004-of-00006.safetensors",
234
+ "model.layers.25.self_attn.query_key_value.bias": "model-00004-of-00006.safetensors",
235
+ "model.layers.25.self_attn.query_key_value.weight": "model-00004-of-00006.safetensors",
236
+ "model.layers.26.input_layernorm.bias": "model-00004-of-00006.safetensors",
237
+ "model.layers.26.input_layernorm.weight": "model-00004-of-00006.safetensors",
238
+ "model.layers.26.mlp.dense_4h_to_h.bias": "model-00004-of-00006.safetensors",
239
+ "model.layers.26.mlp.dense_4h_to_h.weight": "model-00004-of-00006.safetensors",
240
+ "model.layers.26.mlp.dense_h_to_4h.bias": "model-00004-of-00006.safetensors",
241
+ "model.layers.26.mlp.dense_h_to_4h.weight": "model-00004-of-00006.safetensors",
242
+ "model.layers.26.post_attention_layernorm.bias": "model-00004-of-00006.safetensors",
243
+ "model.layers.26.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
244
+ "model.layers.26.self_attn.dense.bias": "model-00004-of-00006.safetensors",
245
+ "model.layers.26.self_attn.dense.weight": "model-00004-of-00006.safetensors",
246
+ "model.layers.26.self_attn.query_key_value.bias": "model-00004-of-00006.safetensors",
247
+ "model.layers.26.self_attn.query_key_value.weight": "model-00004-of-00006.safetensors",
248
+ "model.layers.27.input_layernorm.bias": "model-00004-of-00006.safetensors",
249
+ "model.layers.27.input_layernorm.weight": "model-00004-of-00006.safetensors",
250
+ "model.layers.27.mlp.dense_4h_to_h.bias": "model-00004-of-00006.safetensors",
251
+ "model.layers.27.mlp.dense_4h_to_h.weight": "model-00004-of-00006.safetensors",
252
+ "model.layers.27.mlp.dense_h_to_4h.bias": "model-00004-of-00006.safetensors",
253
+ "model.layers.27.mlp.dense_h_to_4h.weight": "model-00004-of-00006.safetensors",
254
+ "model.layers.27.post_attention_layernorm.bias": "model-00004-of-00006.safetensors",
255
+ "model.layers.27.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
256
+ "model.layers.27.self_attn.dense.bias": "model-00004-of-00006.safetensors",
257
+ "model.layers.27.self_attn.dense.weight": "model-00004-of-00006.safetensors",
258
+ "model.layers.27.self_attn.query_key_value.bias": "model-00004-of-00006.safetensors",
259
+ "model.layers.27.self_attn.query_key_value.weight": "model-00004-of-00006.safetensors",
260
+ "model.layers.28.input_layernorm.bias": "model-00004-of-00006.safetensors",
261
+ "model.layers.28.input_layernorm.weight": "model-00004-of-00006.safetensors",
262
+ "model.layers.28.mlp.dense_4h_to_h.bias": "model-00004-of-00006.safetensors",
263
+ "model.layers.28.mlp.dense_4h_to_h.weight": "model-00004-of-00006.safetensors",
264
+ "model.layers.28.mlp.dense_h_to_4h.bias": "model-00004-of-00006.safetensors",
265
+ "model.layers.28.mlp.dense_h_to_4h.weight": "model-00004-of-00006.safetensors",
266
+ "model.layers.28.post_attention_layernorm.bias": "model-00004-of-00006.safetensors",
267
+ "model.layers.28.post_attention_layernorm.weight": "model-00004-of-00006.safetensors",
268
+ "model.layers.28.self_attn.dense.bias": "model-00004-of-00006.safetensors",
269
+ "model.layers.28.self_attn.dense.weight": "model-00004-of-00006.safetensors",
270
+ "model.layers.28.self_attn.query_key_value.bias": "model-00004-of-00006.safetensors",
271
+ "model.layers.28.self_attn.query_key_value.weight": "model-00004-of-00006.safetensors",
272
+ "model.layers.29.input_layernorm.bias": "model-00004-of-00006.safetensors",
273
+ "model.layers.29.input_layernorm.weight": "model-00004-of-00006.safetensors",
274
+ "model.layers.29.mlp.dense_4h_to_h.bias": "model-00005-of-00006.safetensors",
275
+ "model.layers.29.mlp.dense_4h_to_h.weight": "model-00005-of-00006.safetensors",
276
+ "model.layers.29.mlp.dense_h_to_4h.bias": "model-00005-of-00006.safetensors",
277
+ "model.layers.29.mlp.dense_h_to_4h.weight": "model-00005-of-00006.safetensors",
278
+ "model.layers.29.post_attention_layernorm.bias": "model-00005-of-00006.safetensors",
279
+ "model.layers.29.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
280
+ "model.layers.29.self_attn.dense.bias": "model-00005-of-00006.safetensors",
281
+ "model.layers.29.self_attn.dense.weight": "model-00005-of-00006.safetensors",
282
+ "model.layers.29.self_attn.query_key_value.bias": "model-00005-of-00006.safetensors",
283
+ "model.layers.29.self_attn.query_key_value.weight": "model-00005-of-00006.safetensors",
284
+ "model.layers.3.input_layernorm.bias": "model-00001-of-00006.safetensors",
285
+ "model.layers.3.input_layernorm.weight": "model-00001-of-00006.safetensors",
286
+ "model.layers.3.mlp.dense_4h_to_h.bias": "model-00001-of-00006.safetensors",
287
+ "model.layers.3.mlp.dense_4h_to_h.weight": "model-00001-of-00006.safetensors",
288
+ "model.layers.3.mlp.dense_h_to_4h.bias": "model-00001-of-00006.safetensors",
289
+ "model.layers.3.mlp.dense_h_to_4h.weight": "model-00001-of-00006.safetensors",
290
+ "model.layers.3.post_attention_layernorm.bias": "model-00001-of-00006.safetensors",
291
+ "model.layers.3.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
292
+ "model.layers.3.self_attn.dense.bias": "model-00001-of-00006.safetensors",
293
+ "model.layers.3.self_attn.dense.weight": "model-00001-of-00006.safetensors",
294
+ "model.layers.3.self_attn.query_key_value.bias": "model-00001-of-00006.safetensors",
295
+ "model.layers.3.self_attn.query_key_value.weight": "model-00001-of-00006.safetensors",
296
+ "model.layers.30.input_layernorm.bias": "model-00005-of-00006.safetensors",
297
+ "model.layers.30.input_layernorm.weight": "model-00005-of-00006.safetensors",
298
+ "model.layers.30.mlp.dense_4h_to_h.bias": "model-00005-of-00006.safetensors",
299
+ "model.layers.30.mlp.dense_4h_to_h.weight": "model-00005-of-00006.safetensors",
300
+ "model.layers.30.mlp.dense_h_to_4h.bias": "model-00005-of-00006.safetensors",
301
+ "model.layers.30.mlp.dense_h_to_4h.weight": "model-00005-of-00006.safetensors",
302
+ "model.layers.30.post_attention_layernorm.bias": "model-00005-of-00006.safetensors",
303
+ "model.layers.30.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
304
+ "model.layers.30.self_attn.dense.bias": "model-00005-of-00006.safetensors",
305
+ "model.layers.30.self_attn.dense.weight": "model-00005-of-00006.safetensors",
306
+ "model.layers.30.self_attn.query_key_value.bias": "model-00005-of-00006.safetensors",
307
+ "model.layers.30.self_attn.query_key_value.weight": "model-00005-of-00006.safetensors",
308
+ "model.layers.31.input_layernorm.bias": "model-00005-of-00006.safetensors",
309
+ "model.layers.31.input_layernorm.weight": "model-00005-of-00006.safetensors",
310
+ "model.layers.31.mlp.dense_4h_to_h.bias": "model-00005-of-00006.safetensors",
311
+ "model.layers.31.mlp.dense_4h_to_h.weight": "model-00005-of-00006.safetensors",
312
+ "model.layers.31.mlp.dense_h_to_4h.bias": "model-00005-of-00006.safetensors",
313
+ "model.layers.31.mlp.dense_h_to_4h.weight": "model-00005-of-00006.safetensors",
314
+ "model.layers.31.post_attention_layernorm.bias": "model-00005-of-00006.safetensors",
315
+ "model.layers.31.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
316
+ "model.layers.31.self_attn.dense.bias": "model-00005-of-00006.safetensors",
317
+ "model.layers.31.self_attn.dense.weight": "model-00005-of-00006.safetensors",
318
+ "model.layers.31.self_attn.query_key_value.bias": "model-00005-of-00006.safetensors",
319
+ "model.layers.31.self_attn.query_key_value.weight": "model-00005-of-00006.safetensors",
320
+ "model.layers.32.input_layernorm.bias": "model-00005-of-00006.safetensors",
321
+ "model.layers.32.input_layernorm.weight": "model-00005-of-00006.safetensors",
322
+ "model.layers.32.mlp.dense_4h_to_h.bias": "model-00005-of-00006.safetensors",
323
+ "model.layers.32.mlp.dense_4h_to_h.weight": "model-00005-of-00006.safetensors",
324
+ "model.layers.32.mlp.dense_h_to_4h.bias": "model-00005-of-00006.safetensors",
325
+ "model.layers.32.mlp.dense_h_to_4h.weight": "model-00005-of-00006.safetensors",
326
+ "model.layers.32.post_attention_layernorm.bias": "model-00005-of-00006.safetensors",
327
+ "model.layers.32.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
328
+ "model.layers.32.self_attn.dense.bias": "model-00005-of-00006.safetensors",
329
+ "model.layers.32.self_attn.dense.weight": "model-00005-of-00006.safetensors",
330
+ "model.layers.32.self_attn.query_key_value.bias": "model-00005-of-00006.safetensors",
331
+ "model.layers.32.self_attn.query_key_value.weight": "model-00005-of-00006.safetensors",
332
+ "model.layers.33.input_layernorm.bias": "model-00005-of-00006.safetensors",
333
+ "model.layers.33.input_layernorm.weight": "model-00005-of-00006.safetensors",
334
+ "model.layers.33.mlp.dense_4h_to_h.bias": "model-00005-of-00006.safetensors",
335
+ "model.layers.33.mlp.dense_4h_to_h.weight": "model-00005-of-00006.safetensors",
336
+ "model.layers.33.mlp.dense_h_to_4h.bias": "model-00005-of-00006.safetensors",
337
+ "model.layers.33.mlp.dense_h_to_4h.weight": "model-00005-of-00006.safetensors",
338
+ "model.layers.33.post_attention_layernorm.bias": "model-00005-of-00006.safetensors",
339
+ "model.layers.33.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
340
+ "model.layers.33.self_attn.dense.bias": "model-00005-of-00006.safetensors",
341
+ "model.layers.33.self_attn.dense.weight": "model-00005-of-00006.safetensors",
342
+ "model.layers.33.self_attn.query_key_value.bias": "model-00005-of-00006.safetensors",
343
+ "model.layers.33.self_attn.query_key_value.weight": "model-00005-of-00006.safetensors",
344
+ "model.layers.34.input_layernorm.bias": "model-00005-of-00006.safetensors",
345
+ "model.layers.34.input_layernorm.weight": "model-00005-of-00006.safetensors",
346
+ "model.layers.34.mlp.dense_4h_to_h.bias": "model-00005-of-00006.safetensors",
347
+ "model.layers.34.mlp.dense_4h_to_h.weight": "model-00005-of-00006.safetensors",
348
+ "model.layers.34.mlp.dense_h_to_4h.bias": "model-00005-of-00006.safetensors",
349
+ "model.layers.34.mlp.dense_h_to_4h.weight": "model-00005-of-00006.safetensors",
350
+ "model.layers.34.post_attention_layernorm.bias": "model-00005-of-00006.safetensors",
351
+ "model.layers.34.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
352
+ "model.layers.34.self_attn.dense.bias": "model-00005-of-00006.safetensors",
353
+ "model.layers.34.self_attn.dense.weight": "model-00005-of-00006.safetensors",
354
+ "model.layers.34.self_attn.query_key_value.bias": "model-00005-of-00006.safetensors",
355
+ "model.layers.34.self_attn.query_key_value.weight": "model-00005-of-00006.safetensors",
356
+ "model.layers.35.input_layernorm.bias": "model-00005-of-00006.safetensors",
357
+ "model.layers.35.input_layernorm.weight": "model-00005-of-00006.safetensors",
358
+ "model.layers.35.mlp.dense_4h_to_h.bias": "model-00005-of-00006.safetensors",
359
+ "model.layers.35.mlp.dense_4h_to_h.weight": "model-00005-of-00006.safetensors",
360
+ "model.layers.35.mlp.dense_h_to_4h.bias": "model-00005-of-00006.safetensors",
361
+ "model.layers.35.mlp.dense_h_to_4h.weight": "model-00005-of-00006.safetensors",
362
+ "model.layers.35.post_attention_layernorm.bias": "model-00005-of-00006.safetensors",
363
+ "model.layers.35.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
364
+ "model.layers.35.self_attn.dense.bias": "model-00005-of-00006.safetensors",
365
+ "model.layers.35.self_attn.dense.weight": "model-00005-of-00006.safetensors",
366
+ "model.layers.35.self_attn.query_key_value.bias": "model-00005-of-00006.safetensors",
367
+ "model.layers.35.self_attn.query_key_value.weight": "model-00005-of-00006.safetensors",
368
+ "model.layers.36.input_layernorm.bias": "model-00005-of-00006.safetensors",
369
+ "model.layers.36.input_layernorm.weight": "model-00005-of-00006.safetensors",
370
+ "model.layers.36.mlp.dense_4h_to_h.bias": "model-00006-of-00006.safetensors",
371
+ "model.layers.36.mlp.dense_4h_to_h.weight": "model-00006-of-00006.safetensors",
372
+ "model.layers.36.mlp.dense_h_to_4h.bias": "model-00006-of-00006.safetensors",
373
+ "model.layers.36.mlp.dense_h_to_4h.weight": "model-00006-of-00006.safetensors",
374
+ "model.layers.36.post_attention_layernorm.bias": "model-00005-of-00006.safetensors",
375
+ "model.layers.36.post_attention_layernorm.weight": "model-00005-of-00006.safetensors",
376
+ "model.layers.36.self_attn.dense.bias": "model-00005-of-00006.safetensors",
377
+ "model.layers.36.self_attn.dense.weight": "model-00005-of-00006.safetensors",
378
+ "model.layers.36.self_attn.query_key_value.bias": "model-00005-of-00006.safetensors",
379
+ "model.layers.36.self_attn.query_key_value.weight": "model-00005-of-00006.safetensors",
380
+ "model.layers.37.input_layernorm.bias": "model-00006-of-00006.safetensors",
381
+ "model.layers.37.input_layernorm.weight": "model-00006-of-00006.safetensors",
382
+ "model.layers.37.mlp.dense_4h_to_h.bias": "model-00006-of-00006.safetensors",
383
+ "model.layers.37.mlp.dense_4h_to_h.weight": "model-00006-of-00006.safetensors",
384
+ "model.layers.37.mlp.dense_h_to_4h.bias": "model-00006-of-00006.safetensors",
385
+ "model.layers.37.mlp.dense_h_to_4h.weight": "model-00006-of-00006.safetensors",
386
+ "model.layers.37.post_attention_layernorm.bias": "model-00006-of-00006.safetensors",
387
+ "model.layers.37.post_attention_layernorm.weight": "model-00006-of-00006.safetensors",
388
+ "model.layers.37.self_attn.dense.bias": "model-00006-of-00006.safetensors",
389
+ "model.layers.37.self_attn.dense.weight": "model-00006-of-00006.safetensors",
390
+ "model.layers.37.self_attn.query_key_value.bias": "model-00006-of-00006.safetensors",
391
+ "model.layers.37.self_attn.query_key_value.weight": "model-00006-of-00006.safetensors",
392
+ "model.layers.38.input_layernorm.bias": "model-00006-of-00006.safetensors",
393
+ "model.layers.38.input_layernorm.weight": "model-00006-of-00006.safetensors",
394
+ "model.layers.38.mlp.dense_4h_to_h.bias": "model-00006-of-00006.safetensors",
395
+ "model.layers.38.mlp.dense_4h_to_h.weight": "model-00006-of-00006.safetensors",
396
+ "model.layers.38.mlp.dense_h_to_4h.bias": "model-00006-of-00006.safetensors",
397
+ "model.layers.38.mlp.dense_h_to_4h.weight": "model-00006-of-00006.safetensors",
398
+ "model.layers.38.post_attention_layernorm.bias": "model-00006-of-00006.safetensors",
399
+ "model.layers.38.post_attention_layernorm.weight": "model-00006-of-00006.safetensors",
400
+ "model.layers.38.self_attn.dense.bias": "model-00006-of-00006.safetensors",
401
+ "model.layers.38.self_attn.dense.weight": "model-00006-of-00006.safetensors",
402
+ "model.layers.38.self_attn.query_key_value.bias": "model-00006-of-00006.safetensors",
403
+ "model.layers.38.self_attn.query_key_value.weight": "model-00006-of-00006.safetensors",
404
+ "model.layers.39.input_layernorm.bias": "model-00006-of-00006.safetensors",
405
+ "model.layers.39.input_layernorm.weight": "model-00006-of-00006.safetensors",
406
+ "model.layers.39.mlp.dense_4h_to_h.bias": "model-00006-of-00006.safetensors",
407
+ "model.layers.39.mlp.dense_4h_to_h.weight": "model-00006-of-00006.safetensors",
408
+ "model.layers.39.mlp.dense_h_to_4h.bias": "model-00006-of-00006.safetensors",
409
+ "model.layers.39.mlp.dense_h_to_4h.weight": "model-00006-of-00006.safetensors",
410
+ "model.layers.39.post_attention_layernorm.bias": "model-00006-of-00006.safetensors",
411
+ "model.layers.39.post_attention_layernorm.weight": "model-00006-of-00006.safetensors",
412
+ "model.layers.39.self_attn.dense.bias": "model-00006-of-00006.safetensors",
413
+ "model.layers.39.self_attn.dense.weight": "model-00006-of-00006.safetensors",
414
+ "model.layers.39.self_attn.query_key_value.bias": "model-00006-of-00006.safetensors",
415
+ "model.layers.39.self_attn.query_key_value.weight": "model-00006-of-00006.safetensors",
416
+ "model.layers.4.input_layernorm.bias": "model-00001-of-00006.safetensors",
417
+ "model.layers.4.input_layernorm.weight": "model-00001-of-00006.safetensors",
418
+ "model.layers.4.mlp.dense_4h_to_h.bias": "model-00001-of-00006.safetensors",
419
+ "model.layers.4.mlp.dense_4h_to_h.weight": "model-00001-of-00006.safetensors",
420
+ "model.layers.4.mlp.dense_h_to_4h.bias": "model-00001-of-00006.safetensors",
421
+ "model.layers.4.mlp.dense_h_to_4h.weight": "model-00001-of-00006.safetensors",
422
+ "model.layers.4.post_attention_layernorm.bias": "model-00001-of-00006.safetensors",
423
+ "model.layers.4.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
424
+ "model.layers.4.self_attn.dense.bias": "model-00001-of-00006.safetensors",
425
+ "model.layers.4.self_attn.dense.weight": "model-00001-of-00006.safetensors",
426
+ "model.layers.4.self_attn.query_key_value.bias": "model-00001-of-00006.safetensors",
427
+ "model.layers.4.self_attn.query_key_value.weight": "model-00001-of-00006.safetensors",
428
+ "model.layers.5.input_layernorm.bias": "model-00001-of-00006.safetensors",
429
+ "model.layers.5.input_layernorm.weight": "model-00001-of-00006.safetensors",
430
+ "model.layers.5.mlp.dense_4h_to_h.bias": "model-00001-of-00006.safetensors",
431
+ "model.layers.5.mlp.dense_4h_to_h.weight": "model-00001-of-00006.safetensors",
432
+ "model.layers.5.mlp.dense_h_to_4h.bias": "model-00001-of-00006.safetensors",
433
+ "model.layers.5.mlp.dense_h_to_4h.weight": "model-00001-of-00006.safetensors",
434
+ "model.layers.5.post_attention_layernorm.bias": "model-00001-of-00006.safetensors",
435
+ "model.layers.5.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
436
+ "model.layers.5.self_attn.dense.bias": "model-00001-of-00006.safetensors",
437
+ "model.layers.5.self_attn.dense.weight": "model-00001-of-00006.safetensors",
438
+ "model.layers.5.self_attn.query_key_value.bias": "model-00001-of-00006.safetensors",
439
+ "model.layers.5.self_attn.query_key_value.weight": "model-00001-of-00006.safetensors",
440
+ "model.layers.6.input_layernorm.bias": "model-00001-of-00006.safetensors",
441
+ "model.layers.6.input_layernorm.weight": "model-00001-of-00006.safetensors",
442
+ "model.layers.6.mlp.dense_4h_to_h.bias": "model-00002-of-00006.safetensors",
443
+ "model.layers.6.mlp.dense_4h_to_h.weight": "model-00002-of-00006.safetensors",
444
+ "model.layers.6.mlp.dense_h_to_4h.bias": "model-00002-of-00006.safetensors",
445
+ "model.layers.6.mlp.dense_h_to_4h.weight": "model-00002-of-00006.safetensors",
446
+ "model.layers.6.post_attention_layernorm.bias": "model-00001-of-00006.safetensors",
447
+ "model.layers.6.post_attention_layernorm.weight": "model-00001-of-00006.safetensors",
448
+ "model.layers.6.self_attn.dense.bias": "model-00001-of-00006.safetensors",
449
+ "model.layers.6.self_attn.dense.weight": "model-00001-of-00006.safetensors",
450
+ "model.layers.6.self_attn.query_key_value.bias": "model-00001-of-00006.safetensors",
451
+ "model.layers.6.self_attn.query_key_value.weight": "model-00001-of-00006.safetensors",
452
+ "model.layers.7.input_layernorm.bias": "model-00002-of-00006.safetensors",
453
+ "model.layers.7.input_layernorm.weight": "model-00002-of-00006.safetensors",
454
+ "model.layers.7.mlp.dense_4h_to_h.bias": "model-00002-of-00006.safetensors",
455
+ "model.layers.7.mlp.dense_4h_to_h.weight": "model-00002-of-00006.safetensors",
456
+ "model.layers.7.mlp.dense_h_to_4h.bias": "model-00002-of-00006.safetensors",
457
+ "model.layers.7.mlp.dense_h_to_4h.weight": "model-00002-of-00006.safetensors",
458
+ "model.layers.7.post_attention_layernorm.bias": "model-00002-of-00006.safetensors",
459
+ "model.layers.7.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
460
+ "model.layers.7.self_attn.dense.bias": "model-00002-of-00006.safetensors",
461
+ "model.layers.7.self_attn.dense.weight": "model-00002-of-00006.safetensors",
462
+ "model.layers.7.self_attn.query_key_value.bias": "model-00002-of-00006.safetensors",
463
+ "model.layers.7.self_attn.query_key_value.weight": "model-00002-of-00006.safetensors",
464
+ "model.layers.8.input_layernorm.bias": "model-00002-of-00006.safetensors",
465
+ "model.layers.8.input_layernorm.weight": "model-00002-of-00006.safetensors",
466
+ "model.layers.8.mlp.dense_4h_to_h.bias": "model-00002-of-00006.safetensors",
467
+ "model.layers.8.mlp.dense_4h_to_h.weight": "model-00002-of-00006.safetensors",
468
+ "model.layers.8.mlp.dense_h_to_4h.bias": "model-00002-of-00006.safetensors",
469
+ "model.layers.8.mlp.dense_h_to_4h.weight": "model-00002-of-00006.safetensors",
470
+ "model.layers.8.post_attention_layernorm.bias": "model-00002-of-00006.safetensors",
471
+ "model.layers.8.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
472
+ "model.layers.8.self_attn.dense.bias": "model-00002-of-00006.safetensors",
473
+ "model.layers.8.self_attn.dense.weight": "model-00002-of-00006.safetensors",
474
+ "model.layers.8.self_attn.query_key_value.bias": "model-00002-of-00006.safetensors",
475
+ "model.layers.8.self_attn.query_key_value.weight": "model-00002-of-00006.safetensors",
476
+ "model.layers.9.input_layernorm.bias": "model-00002-of-00006.safetensors",
477
+ "model.layers.9.input_layernorm.weight": "model-00002-of-00006.safetensors",
478
+ "model.layers.9.mlp.dense_4h_to_h.bias": "model-00002-of-00006.safetensors",
479
+ "model.layers.9.mlp.dense_4h_to_h.weight": "model-00002-of-00006.safetensors",
480
+ "model.layers.9.mlp.dense_h_to_4h.bias": "model-00002-of-00006.safetensors",
481
+ "model.layers.9.mlp.dense_h_to_4h.weight": "model-00002-of-00006.safetensors",
482
+ "model.layers.9.post_attention_layernorm.bias": "model-00002-of-00006.safetensors",
483
+ "model.layers.9.post_attention_layernorm.weight": "model-00002-of-00006.safetensors",
484
+ "model.layers.9.self_attn.dense.bias": "model-00002-of-00006.safetensors",
485
+ "model.layers.9.self_attn.dense.weight": "model-00002-of-00006.safetensors",
486
+ "model.layers.9.self_attn.query_key_value.bias": "model-00002-of-00006.safetensors",
487
+ "model.layers.9.self_attn.query_key_value.weight": "model-00002-of-00006.safetensors",
488
+ "model.norm.bias": "model-00006-of-00006.safetensors",
489
+ "model.norm.weight": "model-00006-of-00006.safetensors"
490
+ }
491
+ }
modeling_spark.py ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import torch
3
+ import torch.nn as nn
4
+ import torch.nn.functional as F
5
+ from typing import Optional, Tuple, Union, List
6
+ from transformers import PreTrainedModel
7
+ from transformers.modeling_outputs import (
8
+ CausalLMOutputWithPast,
9
+ BaseModelOutputWithPast,
10
+ )
11
+ from transformers.cache_utils import Cache, DynamicCache
12
+ from transformers.modeling_attn_mask_utils import (
13
+ _prepare_4d_causal_attention_mask,
14
+ )
15
+ from .configuration_spark import SparkConfig
16
+
17
+ def rotate_half(x):
18
+ x1 = x[..., : x.shape[-1] // 2]
19
+ x2 = x[..., x.shape[-1] // 2 :]
20
+ return torch.cat((-x2, x1), dim=-1)
21
+
22
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
23
+ cos = cos.unsqueeze(unsqueeze_dim)
24
+ sin = sin.unsqueeze(unsqueeze_dim)
25
+ q_embed = (q * cos) + (rotate_half(q) * sin)
26
+ k_embed = (k * cos) + (rotate_half(k) * sin)
27
+ return q_embed, k_embed
28
+
29
+ class SparkLayerNorm(nn.Module):
30
+ def __init__(self, hidden_size, eps=1e-6, use_bias=True):
31
+ super().__init__()
32
+ self.weight = nn.Parameter(torch.ones(hidden_size))
33
+ self.use_bias = use_bias
34
+ if use_bias:
35
+ self.bias = nn.Parameter(torch.zeros(hidden_size))
36
+ else:
37
+ self.register_parameter('bias', None)
38
+ self.eps = eps
39
+ self.normalized_shape = (hidden_size,)
40
+
41
+ def forward(self, hidden_states):
42
+ return F.layer_norm(hidden_states, self.normalized_shape, self.weight, self.bias, self.eps)
43
+
44
+ class SparkMLP(nn.Module):
45
+ def __init__(self, config):
46
+ super().__init__()
47
+ self.config = config
48
+ self.hidden_size = config.hidden_size
49
+ self.ffn_hidden_size = config.ffn_hidden_size
50
+ self.dense_h_to_4h = nn.Linear(self.hidden_size, self.ffn_hidden_size * 2, bias=True)
51
+ self.dense_4h_to_h = nn.Linear(self.ffn_hidden_size, self.hidden_size, bias=True)
52
+
53
+ if config.hidden_act == "fast_gelu":
54
+ self.activation_func = lambda x: F.gelu(x, approximate="tanh")
55
+ else:
56
+ self.activation_func = F.gelu
57
+
58
+ def forward(self, hidden_states):
59
+ intermediate = self.dense_h_to_4h(hidden_states)
60
+ hshape = intermediate.shape[:-1]
61
+ intermediate = intermediate.view(hshape + (-1, 2))
62
+ intermediate_parallel1, intermediate_parallel2 = torch.chunk(intermediate, 2, dim=-1)
63
+ intermediate_parallel1 = intermediate_parallel1.squeeze(-1)
64
+ intermediate_parallel2 = intermediate_parallel2.squeeze(-1)
65
+ intermediate_parallel1 = self.activation_func(intermediate_parallel1)
66
+ intermediate = intermediate_parallel1 * intermediate_parallel2
67
+ output = self.dense_4h_to_h(intermediate)
68
+ return output
69
+
70
+ class SparkAttention(nn.Module):
71
+ def __init__(self, config: SparkConfig, layer_idx: int):
72
+ super().__init__()
73
+ self.config = config
74
+ self.layer_idx = layer_idx
75
+ self.hidden_size = config.hidden_size
76
+ self.num_heads = config.num_heads
77
+ self.num_key_value_heads = config.num_key_value_heads
78
+ self.num_key_value_groups = self.num_heads // self.num_key_value_heads
79
+ self.head_dim = self.hidden_size // self.num_heads
80
+ self.use_bias = config.use_bias
81
+
82
+ self.query_key_value = nn.Linear(
83
+ self.hidden_size,
84
+ self.num_heads * self.head_dim + 2 * self.num_key_value_heads * self.head_dim,
85
+ bias=self.use_bias
86
+ )
87
+ self.dense = nn.Linear(self.num_heads * self.head_dim, self.hidden_size, bias=self.use_bias)
88
+ self.attention_dropout = config.attention_dropout
89
+
90
+ def forward(self, hidden_states, attention_mask=None, position_ids=None, past_key_value=None,
91
+ output_attentions=False, use_cache=False, cache_position=None, position_embeddings=None):
92
+ bsz, q_len, _ = hidden_states.size()
93
+ qkv = self.query_key_value(hidden_states)
94
+ query_pos = self.num_heads * self.head_dim
95
+ key_value_pos = query_pos + self.num_key_value_heads * self.head_dim
96
+ query_states = qkv[..., :query_pos]
97
+ key_states = qkv[..., query_pos:key_value_pos]
98
+ value_states = qkv[..., key_value_pos:]
99
+
100
+ query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
101
+ key_states = key_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
102
+ value_states = value_states.view(bsz, q_len, self.num_key_value_heads, self.head_dim).transpose(1, 2)
103
+
104
+ cos, sin = position_embeddings
105
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
106
+
107
+ if past_key_value is not None:
108
+ if isinstance(past_key_value, Cache):
109
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
110
+ key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
111
+ else:
112
+ past_key, past_value = past_key_value
113
+ key_states = torch.cat([past_key, key_states], dim=2)
114
+ value_states = torch.cat([past_value, value_states], dim=2)
115
+
116
+ if past_key_value is None or not isinstance(past_key_value, Cache):
117
+ cached_key_states = key_states
118
+ cached_value_states = value_states
119
+ else:
120
+ cached_key_states = None
121
+ cached_value_states = None
122
+
123
+ key_states = self.repeat_kv(key_states, self.num_key_value_groups)
124
+ value_states = self.repeat_kv(value_states, self.num_key_value_groups)
125
+
126
+ attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) / math.sqrt(self.head_dim)
127
+ if attention_mask is not None:
128
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
129
+ attn_weights = attn_weights + causal_mask
130
+
131
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
132
+ attn_weights = nn.functional.dropout(attn_weights, p=self.attention_dropout, training=self.training)
133
+ attn_output = torch.matmul(attn_weights, value_states)
134
+
135
+ attn_output = attn_output.transpose(1, 2).contiguous()
136
+ attn_output = attn_output.reshape(bsz, q_len, self.hidden_size)
137
+ attn_output = self.dense(attn_output)
138
+
139
+ if use_cache:
140
+ present_key_value = past_key_value if isinstance(past_key_value, Cache) else (cached_key_states, cached_value_states)
141
+ else:
142
+ present_key_value = None
143
+
144
+ return attn_output, attn_weights if output_attentions else None, present_key_value
145
+
146
+ def repeat_kv(self, hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
147
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
148
+ if n_rep == 1: return hidden_states
149
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
150
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
151
+
152
+ class SparkDecoderLayer(nn.Module):
153
+ def __init__(self, config: SparkConfig, layer_idx: int):
154
+ super().__init__()
155
+ self.input_layernorm = SparkLayerNorm(config.hidden_size, eps=config.layernorm_epsilon)
156
+ self.self_attn = SparkAttention(config, layer_idx)
157
+ self.post_attention_layernorm = SparkLayerNorm(config.hidden_size, eps=config.layernorm_epsilon)
158
+ self.mlp = SparkMLP(config)
159
+
160
+ def forward(self, hidden_states, attention_mask=None, position_ids=None, past_key_value=None,
161
+ output_attentions=False, use_cache=False, cache_position=None, position_embeddings=None):
162
+ residual = hidden_states
163
+ hidden_states = self.input_layernorm(hidden_states)
164
+ hidden_states, self_attn_weights, present_key_value = self.self_attn(
165
+ hidden_states=hidden_states, attention_mask=attention_mask, position_ids=position_ids,
166
+ past_key_value=past_key_value, output_attentions=output_attentions, use_cache=use_cache,
167
+ cache_position=cache_position, position_embeddings=position_embeddings,
168
+ )
169
+ hidden_states = residual + hidden_states
170
+ residual = hidden_states
171
+ hidden_states = self.post_attention_layernorm(hidden_states)
172
+ hidden_states = self.mlp(hidden_states)
173
+ hidden_states = residual + hidden_states
174
+
175
+ outputs = (hidden_states,)
176
+ if output_attentions: outputs += (self_attn_weights,)
177
+ if use_cache: outputs += (present_key_value,)
178
+ return outputs
179
+
180
+ class SparkPreTrainedModel(PreTrainedModel):
181
+ config_class = SparkConfig
182
+ base_model_prefix = "model"
183
+ supports_gradient_checkpointing = True
184
+ _no_split_modules = ["SparkDecoderLayer"]
185
+ _skip_keys_device_placement = "past_key_values"
186
+ _supports_flash_attn_2 = True
187
+ _supports_sdpa = True
188
+ _supports_cache_class = True
189
+
190
+ def _init_weights(self, module):
191
+ std = self.config.init_std if hasattr(self.config, "init_std") else 0.02
192
+ if isinstance(module, nn.Linear):
193
+ module.weight.data.normal_(mean=0.0, std=std)
194
+ if module.bias is not None: module.bias.data.zero_()
195
+ elif isinstance(module, nn.Embedding):
196
+ module.weight.data.normal_(mean=0.0, std=std)
197
+ if module.padding_idx is not None: module.weight.data[module.padding_idx].zero_()
198
+
199
+ class SparkModel(SparkPreTrainedModel):
200
+ def __init__(self, config: SparkConfig):
201
+ super().__init__(config)
202
+ self.padding_idx = config.pad_token_id
203
+ self.vocab_size = config.vocab_size
204
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
205
+ self.layers = nn.ModuleList([SparkDecoderLayer(config, layer_idx) for layer_idx in range(config.num_layers)])
206
+ self.norm = SparkLayerNorm(config.hidden_size, eps=config.layernorm_epsilon)
207
+ self.rope_theta = config.rope_theta
208
+ self.rotary_emb = SparkRotaryEmbedding(
209
+ config.hidden_size // config.num_heads,
210
+ max_position_embeddings=config.max_position_embeddings,
211
+ base=self.rope_theta,
212
+ )
213
+ self.post_init()
214
+
215
+ def get_input_embeddings(self):
216
+ return self.embed_tokens
217
+
218
+ def set_input_embeddings(self, value):
219
+ self.embed_tokens = value
220
+
221
+
222
+ def forward(self, input_ids=None, attention_mask=None, position_ids=None, past_key_values=None,
223
+ inputs_embeds=None, use_cache=None, output_attentions=None, output_hidden_states=None,
224
+ return_dict=None, cache_position=None):
225
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
226
+ output_hidden_states = output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
227
+ use_cache = use_cache if use_cache is not None else self.config.use_cache
228
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
229
+
230
+ if input_ids is not None:
231
+ batch_size, seq_length = input_ids.shape
232
+ else:
233
+ batch_size, seq_length, _ = inputs_embeds.shape
234
+
235
+ if inputs_embeds is None:
236
+ inputs_embeds = self.embed_tokens(input_ids)
237
+
238
+ past_key_values_length = 0
239
+ if past_key_values is not None:
240
+ past_key_values_length = cache_position[0] if cache_position is not None else past_key_values.get_seq_length()
241
+
242
+ if cache_position is None:
243
+ cache_position = torch.arange(past_key_values_length, past_key_values_length + seq_length, device=inputs_embeds.device)
244
+ if position_ids is None:
245
+ position_ids = cache_position.unsqueeze(0)
246
+
247
+ causal_mask = _prepare_4d_causal_attention_mask(attention_mask, (batch_size, seq_length), inputs_embeds, past_key_values_length)
248
+ hidden_states = inputs_embeds
249
+ all_hidden_states = () if output_hidden_states else None
250
+ all_self_attns = () if output_attentions else None
251
+ next_decoder_cache = None
252
+
253
+ position_embeddings = self.rotary_emb(hidden_states, position_ids=position_ids)
254
+
255
+ for layer_idx, decoder_layer in enumerate(self.layers):
256
+ if output_hidden_states: all_hidden_states += (hidden_states,)
257
+ layer_past_key_value = past_key_values if isinstance(past_key_values, Cache) else (past_key_values[layer_idx] if past_key_values is not None else None)
258
+
259
+ layer_outputs = decoder_layer(
260
+ hidden_states, attention_mask=causal_mask, position_ids=position_ids, past_key_value=layer_past_key_value,
261
+ output_attentions=output_attentions, use_cache=use_cache, cache_position=cache_position, position_embeddings=position_embeddings,
262
+ )
263
+ hidden_states = layer_outputs[0]
264
+ if use_cache:
265
+ layer_present_key_value = layer_outputs[2 if output_attentions else 1]
266
+ if next_decoder_cache is None:
267
+ next_decoder_cache = layer_present_key_value if isinstance(layer_present_key_value, Cache) else []
268
+ if not isinstance(next_decoder_cache, Cache): next_decoder_cache.append(layer_present_key_value)
269
+ if output_attentions: all_self_attns += (layer_outputs[1],)
270
+
271
+ hidden_states = self.norm(hidden_states)
272
+ if output_hidden_states: all_hidden_states += (hidden_states,)
273
+
274
+ next_cache = next_decoder_cache.to_legacy_cache() if isinstance(next_decoder_cache, Cache) else next_decoder_cache
275
+ if not return_dict:
276
+ return tuple(v for v in [hidden_states, next_cache, all_hidden_states, all_self_attns] if v is not None)
277
+
278
+ return BaseModelOutputWithPast(last_hidden_state=hidden_states, past_key_values=next_cache, hidden_states=all_hidden_states, attentions=all_self_attns)
279
+
280
+ class SparkForCausalLM(SparkPreTrainedModel):
281
+ _tied_weights_keys = ["lm_head.weight"]
282
+ def __init__(self, config):
283
+ super().__init__(config)
284
+ self.model = SparkModel(config)
285
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
286
+ self.post_init()
287
+
288
+ def get_input_embeddings(self):
289
+ return self.model.embed_tokens
290
+
291
+ def set_input_embeddings(self, value):
292
+ self.model.embed_tokens = value
293
+
294
+ def get_output_embeddings(self):
295
+ return self.lm_head
296
+
297
+ def set_output_embeddings(self, new_embeddings):
298
+ self.lm_head = new_embeddings
299
+
300
+
301
+ def forward(self, input_ids=None, attention_mask=None, position_ids=None, past_key_values=None,
302
+ inputs_embeds=None, labels=None, use_cache=None, output_attentions=None, output_hidden_states=None,
303
+ return_dict=None, cache_position=None):
304
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
305
+ outputs = self.model(input_ids, attention_mask, position_ids, past_key_values, inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict, cache_position)
306
+ hidden_states = outputs[0]
307
+ logits = self.lm_head(hidden_states).float()
308
+ loss = None
309
+ if labels is not None:
310
+ shift_logits = logits[..., :-1, :].contiguous().view(-1, self.config.vocab_size)
311
+ shift_labels = labels[..., 1:].contiguous().view(-1).to(shift_logits.device)
312
+ loss = nn.CrossEntropyLoss()(shift_logits, shift_labels)
313
+ if not return_dict:
314
+ output = (logits,) + outputs[1:]
315
+ return (loss,) + output if loss is not None else output
316
+ return CausalLMOutputWithPast(loss=loss, logits=logits, past_key_values=outputs.past_key_values, hidden_states=outputs.hidden_states, attentions=outputs.attentions)
317
+
318
+ def prepare_inputs_for_generation(self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, **kwargs):
319
+ if input_ids is not None: input_ids = input_ids.long()
320
+ if attention_mask is not None: attention_mask = attention_mask.long()
321
+ cache_position = kwargs.get("cache_position", None)
322
+ if past_key_values is not None:
323
+ if isinstance(past_key_values, Cache):
324
+ if hasattr(past_key_values, 'cache_position') and past_key_values.cache_position is not None and past_key_values.cache_position.numel() > 0:
325
+ past_length = past_key_values.cache_position.max().item() + 1
326
+ else: past_length = getattr(past_key_values, 'seen_tokens', 0)
327
+ else: past_length = past_key_values[0][0].shape[2]
328
+ else: past_length = 0
329
+ if past_key_values is not None and input_ids is not None:
330
+ if cache_position is not None:
331
+ cache_position = cache_position.long()
332
+ input_ids = input_ids[:, cache_position] if cache_position.max() < input_ids.shape[1] else input_ids[:, past_length:]
333
+ else: input_ids = input_ids[:, past_length:]
334
+ position_ids = kwargs.get("position_ids", None)
335
+ if attention_mask is not None and position_ids is None:
336
+ position_ids = attention_mask.long().cumsum(-1) - 1
337
+ position_ids.masked_fill_(attention_mask == 0, 1)
338
+ if past_key_values is not None and past_length > 0: position_ids = position_ids[:, past_length:]
339
+ if cache_position is None and input_ids is not None:
340
+ cache_position = torch.arange(past_length, past_length + input_ids.shape[1], device=input_ids.device, dtype=torch.long)
341
+ model_inputs = {"use_cache": kwargs.get("use_cache", True)}
342
+ if inputs_embeds is not None and past_key_values is None: model_inputs["inputs_embeds"] = inputs_embeds
343
+ elif input_ids is not None: model_inputs["input_ids"] = input_ids
344
+ if position_ids is not None: model_inputs["position_ids"] = position_ids
345
+ if cache_position is not None: model_inputs["cache_position"] = cache_position
346
+ if past_key_values is not None: model_inputs["past_key_values"] = past_key_values
347
+ if attention_mask is not None: model_inputs["attention_mask"] = attention_mask
348
+ return model_inputs
349
+
350
+ class SparkRotaryEmbedding(nn.Module):
351
+ def __init__(self, dim, max_position_embeddings=32768, base=1000000.0, device=None):
352
+ super().__init__()
353
+ self.dim, self.max_position_embeddings, self.base = dim, max_position_embeddings, base
354
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2, dtype=torch.int64).float() / self.dim))
355
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
356
+ self._set_cos_sin_cache(seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype())
357
+
358
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
359
+ self.max_seq_len_cached = seq_len
360
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.int64).type_as(self.inv_freq)
361
+ freqs = torch.outer(t, self.inv_freq)
362
+ emb = torch.cat((freqs, freqs), dim=-1)
363
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
364
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
365
+
366
+ def forward(self, x, position_ids=None, seq_len=None):
367
+ if position_ids is not None:
368
+ max_position = position_ids.max().item() + 1
369
+ actual_seq_len = max(max_position, position_ids.shape[-1])
370
+ else: actual_seq_len = seq_len if isinstance(seq_len, int) else (seq_len.item() if seq_len is not None else x.shape[2])
371
+ if actual_seq_len > self.max_seq_len_cached:
372
+ self._set_cos_sin_cache(seq_len=actual_seq_len, device=x.device, dtype=x.dtype)
373
+ cos = self.cos_cached[:actual_seq_len].to(dtype=x.dtype)
374
+ sin = self.sin_cached[:actual_seq_len].to(dtype=x.dtype)
375
+ if position_ids is not None:
376
+ cos, sin = cos[position_ids], sin[position_ids]
377
+ return cos, sin
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch>=2.0.0
2
+ transformers>=4.40.0
3
+ sentencepiece
4
+ safetensors
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "eos_token": {
3
+ "content": "<end>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "pad_token": {
10
+ "content": "<pad>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "unk_token": {
17
+ "content": "<unk>",
18
+ "lstrip": false,
19
+ "normalized": true,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenization_spark.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+ from typing import List, Optional, Sequence, Union, Tuple
4
+ from transformers.tokenization_utils import PreTrainedTokenizer
5
+ import sentencepiece as spm
6
+
7
+ class SparkTokenizer(PreTrainedTokenizer):
8
+ vocab_files_names = {"vocab_file": "tokenizer.model"}
9
+ model_input_names = ["input_ids", "attention_mask"]
10
+
11
+ def __init__(
12
+ self,
13
+ vocab_file,
14
+ clean_up_tokenization_spaces=False,
15
+ split=True,
16
+ **kwargs
17
+ ):
18
+ self.vocab_file = vocab_file
19
+ self.split = split
20
+
21
+ # Load SentencePiece model
22
+ self.sp = spm.SentencePieceProcessor(model_file=vocab_file)
23
+
24
+ # Build encoder/decoder from sp model for compatibility
25
+ self.encoder = {}
26
+ self.decoder = {}
27
+ for i in range(self.sp.get_piece_size()):
28
+ piece = self.sp.id_to_piece(i)
29
+ self.encoder[piece] = i
30
+ self.decoder[i] = piece
31
+
32
+ super().__init__(
33
+ clean_up_tokenization_spaces=clean_up_tokenization_spaces,
34
+ **kwargs
35
+ )
36
+
37
+ # Standard special tokens
38
+ self.sep_id = self.encoder.get('<s>', None)
39
+ self.eod_id = self.encoder.get('<end>', None)
40
+ self.pad_id = self.encoder.get('<pad>', 0)
41
+ self.unk_id = self.encoder.get('<unk>', None)
42
+
43
+ @property
44
+ def vocab_size(self) -> int:
45
+ return self.sp.get_piece_size()
46
+
47
+ def get_vocab(self):
48
+ return self.encoder
49
+
50
+ def _tokenize(self, text: str) -> List[str]:
51
+ # --- Megatron 兼容预处理 ---
52
+ text = re.sub("(,|。|!|?) *", r"\1 ", text)
53
+ text = text.replace("\n", "<ret>")
54
+ text = text.replace("\t", " " * 4)
55
+
56
+ if self.split:
57
+ # Custom splitting logic for special tokens
58
+ text_list = re.split(r'(<ret>|<end>|<s>)', text)
59
+ pieces = []
60
+ for each in text_list:
61
+ if each in ['<ret>', '<end>', '<s>']:
62
+ pieces.append(each)
63
+ else:
64
+ pieces.extend(self.sp.encode_as_pieces(each))
65
+ return pieces
66
+ return self.sp.encode_as_pieces(text)
67
+
68
+ def _convert_token_to_id(self, token):
69
+ return self.encoder.get(token, self.unk_id)
70
+
71
+ def _convert_id_to_token(self, index):
72
+ return self.decoder.get(index, "<unk>")
73
+
74
+ def convert_tokens_to_string(self, tokens: List[str]) -> str:
75
+ return self.sp.decode_pieces(tokens)
76
+
77
+ def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
78
+ if not os.path.isdir(save_directory):
79
+ os.makedirs(save_directory)
80
+
81
+ vocab_file = os.path.join(save_directory, (filename_prefix + "-" if filename_prefix else "") + "tokenizer.model")
82
+
83
+ with open(vocab_file, "wb") as f:
84
+ f.write(self.sp.serialized_model_proto())
85
+
86
+ return (vocab_file,)
tokenizer.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd1128a6daa7783da8217a8d011a16a6257d1e7e0d7120df05279999f787dae3
3
+ size 933296
tokenizer_config.json ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<pad>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "3": {
12
+ "content": "<unk>",
13
+ "lstrip": false,
14
+ "normalized": true,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "5": {
20
+ "content": "<end>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ }
27
+ },
28
+ "bos_token": null,
29
+ "clean_up_tokenization_spaces": false,
30
+ "chat_template": "{% if messages[0]['role'] == 'system' %}{% set system_message = messages[0]['content'] %}{% endif %}{% if system_message is defined %}{{ '<System> ' + system_message + '<end>' }}{% endif %}{% for message in messages %}{% if message['role'] == 'user' %}{{ '<User> ' + message['content'] + '<end><Bot> ' }}{% elif message['role'] == 'assistant' %}{{ message['content'] + '<end>' }}{% endif %}{% endfor %}",
31
+ "do_lower_case": false,
32
+ "eos_token": "<end>",
33
+ "model_max_length": 32768,
34
+ "pad_token": "<pad>",
35
+ "sp_model_kwargs": {},
36
+ "split_by_punct": false,
37
+ "tokenizer_class": "SparkTokenizer",
38
+ "unk_token": "<unk>",
39
+ "auto_map": {
40
+ "AutoTokenizer": [
41
+ "tokenization_spark.SparkTokenizer",
42
+ null
43
+ ]
44
+ }
45
+ }