Yixin Song
commited on
Commit
•
eacf2c5
1
Parent(s):
7306795
add weight
Browse files- .gitattributes +6 -0
- config.json +31 -0
- configuration_bamboo.py +144 -0
- generation_config.json +6 -0
- model-00001-of-00004.safetensors +3 -0
- model-00002-of-00004.safetensors +3 -0
- model-00003-of-00004.safetensors +3 -0
- model-00004-of-00004.safetensors +3 -0
- model.safetensors.index.json +3 -0
- modeling_bamboo.py +3 -0
- scheduler.pt +3 -0
- special_tokens_map.json +33 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +64 -0
- trainer_state.json +0 -0
- training_args.bin +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
model-00001-of-00004.safetensors filter=lfs diff=lfs merge=lfs -text
|
37 |
+
model-00002-of-00004.safetensors filter=lfs diff=lfs merge=lfs -text
|
38 |
+
model-00003-of-00004.safetensors filter=lfs diff=lfs merge=lfs -text
|
39 |
+
model-00004-of-00004.safetensors filter=lfs diff=lfs merge=lfs -text
|
40 |
+
modeling_bamboo.py filter=lfs diff=lfs merge=lfs -text
|
41 |
+
model.safetensors.index.json filter=lfs diff=lfs merge=lfs -text
|
config.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "/mnt/scratch/syx/checkpoint-500/checkpoint-500_bak",
|
3 |
+
"architectures": [
|
4 |
+
"BambooForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"auto_map": {
|
8 |
+
"AutoConfig": "configuration_bamboo.BambooConfig",
|
9 |
+
"AutoModel": "modeling_bamboo.BambooForCausalLM",
|
10 |
+
"AutoModelForCausalLM": "modeling_bamboo.BambooForCausalLM"
|
11 |
+
},
|
12 |
+
"bos_token_id": 1,
|
13 |
+
"eos_token_id": 2,
|
14 |
+
"hidden_act": "relu",
|
15 |
+
"hidden_size": 4096,
|
16 |
+
"initializer_range": 0.02,
|
17 |
+
"intermediate_size": 14336,
|
18 |
+
"max_position_embeddings": 32768,
|
19 |
+
"model_type": "bamboo",
|
20 |
+
"num_attention_heads": 32,
|
21 |
+
"num_hidden_layers": 32,
|
22 |
+
"num_key_value_heads": 8,
|
23 |
+
"rms_norm_eps": 1e-05,
|
24 |
+
"rope_theta": 10000.0,
|
25 |
+
"sliding_window": 4096,
|
26 |
+
"tie_word_embeddings": false,
|
27 |
+
"torch_dtype": "bfloat16",
|
28 |
+
"transformers_version": "4.41.0",
|
29 |
+
"use_cache": false,
|
30 |
+
"vocab_size": 32064
|
31 |
+
}
|
configuration_bamboo.py
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2023 Mistral AI and the HuggingFace Inc. team. All rights reserved.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
+
""" This model config is from Mistral config """
|
16 |
+
""" Viola model configuration"""
|
17 |
+
|
18 |
+
from transformers.configuration_utils import PretrainedConfig
|
19 |
+
from transformers.utils import logging
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
logger = logging.get_logger(__name__)
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
class BambooConfig(PretrainedConfig):
|
28 |
+
r"""
|
29 |
+
|
30 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
31 |
+
documentation from [`PretrainedConfig`] for more information.
|
32 |
+
|
33 |
+
|
34 |
+
Args:
|
35 |
+
vocab_size (`int`, *optional*, defaults to 32000):
|
36 |
+
Vocabulary size of the Mistral model. Defines the number of different tokens that can be represented by the
|
37 |
+
`inputs_ids` passed when calling [`MistralModel`]
|
38 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
39 |
+
Dimension of the hidden representations.
|
40 |
+
intermediate_size (`int`, *optional*, defaults to 14336):
|
41 |
+
Dimension of the MLP representations.
|
42 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
43 |
+
Number of hidden layers in the Transformer encoder.
|
44 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
45 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
46 |
+
num_key_value_heads (`int`, *optional*, defaults to 8):
|
47 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
48 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
49 |
+
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
50 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
51 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
52 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `8`.
|
53 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
54 |
+
The non-linear activation function (function or string) in the decoder.
|
55 |
+
max_position_embeddings (`int`, *optional*, defaults to `4096*32`):
|
56 |
+
The maximum sequence length that this model might ever be used with. Mistral's sliding window attention
|
57 |
+
allows sequence of up to 4096*32 tokens.
|
58 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
59 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
60 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
61 |
+
The epsilon used by the rms normalization layers.
|
62 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
63 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
64 |
+
relevant if `config.is_decoder=True`.
|
65 |
+
pad_token_id (`int`, *optional*):
|
66 |
+
The id of the padding token.
|
67 |
+
bos_token_id (`int`, *optional*, defaults to 1):
|
68 |
+
The id of the "beginning-of-sequence" token.
|
69 |
+
eos_token_id (`int`, *optional*, defaults to 2):
|
70 |
+
The id of the "end-of-sequence" token.
|
71 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
72 |
+
Whether the model's input and output word embeddings should be tied.
|
73 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
74 |
+
The base period of the RoPE embeddings.
|
75 |
+
sliding_window (`int`, *optional*, defaults to 4096):
|
76 |
+
Sliding window attention window size. If not specified, will default to `4096`.
|
77 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
78 |
+
The dropout ratio for the attention probabilities.
|
79 |
+
|
80 |
+
```python
|
81 |
+
>>> from transformers import MistralModel, MistralConfig
|
82 |
+
|
83 |
+
>>> # Initializing a Mistral 7B style configuration
|
84 |
+
>>> configuration = MistralConfig()
|
85 |
+
|
86 |
+
>>> # Initializing a model from the Mistral 7B style configuration
|
87 |
+
>>> model = MistralModel(configuration)
|
88 |
+
|
89 |
+
>>> # Accessing the model configuration
|
90 |
+
>>> configuration = model.config
|
91 |
+
```"""
|
92 |
+
|
93 |
+
model_type = "bamboo"
|
94 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
95 |
+
|
96 |
+
def __init__(
|
97 |
+
self,
|
98 |
+
vocab_size=32000,
|
99 |
+
hidden_size=4096,
|
100 |
+
intermediate_size=14336,
|
101 |
+
num_hidden_layers=32,
|
102 |
+
num_attention_heads=32,
|
103 |
+
num_key_value_heads=8,
|
104 |
+
hidden_act="silu",
|
105 |
+
max_position_embeddings=4096 * 32,
|
106 |
+
initializer_range=0.02,
|
107 |
+
rms_norm_eps=1e-6,
|
108 |
+
use_cache=True,
|
109 |
+
pad_token_id=None,
|
110 |
+
bos_token_id=1,
|
111 |
+
eos_token_id=2,
|
112 |
+
tie_word_embeddings=False,
|
113 |
+
rope_theta=10000.0,
|
114 |
+
sliding_window=4096,
|
115 |
+
attention_dropout=0.0,
|
116 |
+
**kwargs,
|
117 |
+
):
|
118 |
+
self.vocab_size = vocab_size
|
119 |
+
self.max_position_embeddings = max_position_embeddings
|
120 |
+
self.hidden_size = hidden_size
|
121 |
+
self.intermediate_size = intermediate_size
|
122 |
+
self.num_hidden_layers = num_hidden_layers
|
123 |
+
self.num_attention_heads = num_attention_heads
|
124 |
+
self.sliding_window = sliding_window
|
125 |
+
|
126 |
+
# for backward compatibility
|
127 |
+
if num_key_value_heads is None:
|
128 |
+
num_key_value_heads = num_attention_heads
|
129 |
+
|
130 |
+
self.num_key_value_heads = num_key_value_heads
|
131 |
+
self.hidden_act = hidden_act
|
132 |
+
self.initializer_range = initializer_range
|
133 |
+
self.rms_norm_eps = rms_norm_eps
|
134 |
+
self.use_cache = use_cache
|
135 |
+
self.rope_theta = rope_theta
|
136 |
+
self.attention_dropout = attention_dropout
|
137 |
+
|
138 |
+
super().__init__(
|
139 |
+
pad_token_id=pad_token_id,
|
140 |
+
bos_token_id=bos_token_id,
|
141 |
+
eos_token_id=eos_token_id,
|
142 |
+
tie_word_embeddings=tie_word_embeddings,
|
143 |
+
**kwargs,
|
144 |
+
)
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"do_sample": true,
|
3 |
+
"max_new_tokens": 4096,
|
4 |
+
"temperature": 0.0,
|
5 |
+
"transformers_version": "4.41.0"
|
6 |
+
}
|
model-00001-of-00004.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ed5829114f85d25d7d5ceb85b207bb5eae3dbb92828013127130f39b0d63442e
|
3 |
+
size 4991906048
|
model-00002-of-00004.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b7b3e0d4b62489a65600ee0923ca6b6c84bda999a63198f66d7c14150549cc0a
|
3 |
+
size 4890752392
|
model-00003-of-00004.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:effd03df115777676eecd2cd004050b56729bec9b117a6dce5ec786643b0af3b
|
3 |
+
size 4914328152
|
model-00004-of-00004.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3a91329113220f97352df3616c7b2ef035da1172a8b74c3e90b6f5b243e4bc6a
|
3 |
+
size 1173924096
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:323e96f23791fe336c7bb6b626ff79e35a7e1df43adbb2735e7bd57786c16027
|
3 |
+
size 29306
|
modeling_bamboo.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:74f554cc42fd2079953a3800b60929be2d7acc780ca7cb92665846b02fb75651
|
3 |
+
size 86637
|
scheduler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3312acf094e8cec25eb711179ac16f0f5b35f7c62efe46d09c27e5b0ecd72bb7
|
3 |
+
size 1064
|
special_tokens_map.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"additional_special_tokens": [
|
3 |
+
"<|im_start|>"
|
4 |
+
],
|
5 |
+
"bos_token": {
|
6 |
+
"content": "<s>",
|
7 |
+
"lstrip": false,
|
8 |
+
"normalized": false,
|
9 |
+
"rstrip": false,
|
10 |
+
"single_word": false
|
11 |
+
},
|
12 |
+
"eos_token": {
|
13 |
+
"content": "<|im_end|>",
|
14 |
+
"lstrip": false,
|
15 |
+
"normalized": false,
|
16 |
+
"rstrip": false,
|
17 |
+
"single_word": false
|
18 |
+
},
|
19 |
+
"pad_token": {
|
20 |
+
"content": "<unk>",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false
|
25 |
+
},
|
26 |
+
"unk_token": {
|
27 |
+
"content": "<unk>",
|
28 |
+
"lstrip": false,
|
29 |
+
"normalized": false,
|
30 |
+
"rstrip": false,
|
31 |
+
"single_word": false
|
32 |
+
}
|
33 |
+
}
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055
|
3 |
+
size 493443
|
tokenizer_config.json
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"add_bos_token": true,
|
3 |
+
"add_eos_token": false,
|
4 |
+
"add_prefix_space": true,
|
5 |
+
"added_tokens_decoder": {
|
6 |
+
"0": {
|
7 |
+
"content": "<unk>",
|
8 |
+
"lstrip": false,
|
9 |
+
"normalized": false,
|
10 |
+
"rstrip": false,
|
11 |
+
"single_word": false,
|
12 |
+
"special": true
|
13 |
+
},
|
14 |
+
"1": {
|
15 |
+
"content": "<s>",
|
16 |
+
"lstrip": false,
|
17 |
+
"normalized": false,
|
18 |
+
"rstrip": false,
|
19 |
+
"single_word": false,
|
20 |
+
"special": true
|
21 |
+
},
|
22 |
+
"2": {
|
23 |
+
"content": "</s>",
|
24 |
+
"lstrip": false,
|
25 |
+
"normalized": false,
|
26 |
+
"rstrip": false,
|
27 |
+
"single_word": false,
|
28 |
+
"special": true
|
29 |
+
},
|
30 |
+
"32000": {
|
31 |
+
"content": "<|im_end|>",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": false,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false,
|
36 |
+
"special": true
|
37 |
+
},
|
38 |
+
"32001": {
|
39 |
+
"content": "<|im_start|>",
|
40 |
+
"lstrip": false,
|
41 |
+
"normalized": false,
|
42 |
+
"rstrip": false,
|
43 |
+
"single_word": false,
|
44 |
+
"special": true
|
45 |
+
}
|
46 |
+
},
|
47 |
+
"additional_special_tokens": [
|
48 |
+
"<|im_start|>"
|
49 |
+
],
|
50 |
+
"bos_token": "<s>",
|
51 |
+
"chat_template": "{% if messages[0]['role'] == 'system' %}{% set system_message = messages[0]['content'] %}{% endif %}{% if system_message is defined %}{{ '<|im_start|>system\\n' + system_message + '<|im_end|>\\n' }}{% endif %}{% for message in messages %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '<|im_start|>user\\n' + content + '<|im_end|>\\n<|im_start|>assistant\\n' }}{% elif message['role'] == 'assistant' %}{{ content + '<|im_end|>' + '\\n' }}{% endif %}{% endfor %}",
|
52 |
+
"clean_up_tokenization_spaces": false,
|
53 |
+
"eos_token": "<|im_end|>",
|
54 |
+
"legacy": true,
|
55 |
+
"model_max_length": 32768,
|
56 |
+
"pad_token": "<unk>",
|
57 |
+
"padding_side": "right",
|
58 |
+
"sp_model_kwargs": {},
|
59 |
+
"spaces_between_special_tokens": false,
|
60 |
+
"split_special_tokens": false,
|
61 |
+
"tokenizer_class": "LlamaTokenizer",
|
62 |
+
"unk_token": "<unk>",
|
63 |
+
"use_default_system_prompt": false
|
64 |
+
}
|
trainer_state.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b0d6c980b1b1cc661fff618c91906ca799367765860b35f534d96bc82158e84d
|
3 |
+
size 6840
|