Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- Constant_154_attr__value +0 -0
- Constant_161_attr__value +0 -0
- config.json +31 -0
- configuration_stablelm_epoch.py +114 -0
- generation_config.json +6 -0
- model.onnx +3 -0
- model.onnx_data +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ 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.onnx_data filter=lfs diff=lfs merge=lfs -text
|
Constant_154_attr__value
ADDED
Binary file (328 kB). View file
|
|
Constant_161_attr__value
ADDED
Binary file (328 kB). View file
|
|
config.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "stabilityai/stablelm-zephyr-3b",
|
3 |
+
"architectures": [
|
4 |
+
"StableLMEpochForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"auto_map": {
|
8 |
+
"AutoConfig": "configuration_stablelm_epoch.StableLMEpochConfig",
|
9 |
+
"AutoModelForCausalLM": "stabilityai/stablelm-zephyr-3b--modeling_stablelm_epoch.StableLMEpochForCausalLM"
|
10 |
+
},
|
11 |
+
"bos_token_id": 0,
|
12 |
+
"eos_token_id": 0,
|
13 |
+
"hidden_act": "silu",
|
14 |
+
"hidden_size": 2560,
|
15 |
+
"initializer_range": 0.02,
|
16 |
+
"intermediate_size": 6912,
|
17 |
+
"max_position_embeddings": 4096,
|
18 |
+
"model_type": "stablelm_epoch",
|
19 |
+
"norm_eps": 1e-05,
|
20 |
+
"num_attention_heads": 32,
|
21 |
+
"num_heads": 32,
|
22 |
+
"num_hidden_layers": 32,
|
23 |
+
"num_key_value_heads": 32,
|
24 |
+
"rope_pct": 0.25,
|
25 |
+
"rope_theta": 10000,
|
26 |
+
"rotary_scaling_factor": 1.0,
|
27 |
+
"tie_word_embeddings": false,
|
28 |
+
"transformers_version": "4.37.0",
|
29 |
+
"use_cache": true,
|
30 |
+
"vocab_size": 50304
|
31 |
+
}
|
configuration_stablelm_epoch.py
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2023 Stability 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 |
+
""" StableLM Epoch model configuration"""
|
16 |
+
from transformers import PretrainedConfig
|
17 |
+
from transformers.utils import logging
|
18 |
+
|
19 |
+
|
20 |
+
logger = logging.get_logger(__name__)
|
21 |
+
|
22 |
+
|
23 |
+
class StableLMEpochConfig(PretrainedConfig):
|
24 |
+
r"""
|
25 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
26 |
+
documentation from [`PretrainedConfig`] for more information.
|
27 |
+
|
28 |
+
Args:
|
29 |
+
vocab_size (`int`, *optional*, defaults to 50_304):
|
30 |
+
Vocabulary size of the StableLM model. Defines the number of different tokens that
|
31 |
+
can be represented by the `inputs_ids` passed when calling [`StableLMEpochModel`].
|
32 |
+
intermediate_size (`int`, *optional*, defaults to 6912):
|
33 |
+
Dimension of the MLP representations.
|
34 |
+
hidden_size (`int`, *optional*, defaults to 2560):
|
35 |
+
Dimension of the decoder layers and the pooler layer.
|
36 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
37 |
+
Number of hidden layers in the Transformer decoder.
|
38 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
39 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
40 |
+
num_key_value_heads (`int`, *optional*):
|
41 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
42 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
43 |
+
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
44 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
45 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
46 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
|
47 |
+
`num_attention_heads`.
|
48 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
49 |
+
The non-linear activation function (function or string).
|
50 |
+
rope_pct (`float`, *optional*, defaults to 1.0):
|
51 |
+
Percentage of hidden dimensions to allocate to rotary embeddings.
|
52 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
53 |
+
The base period of the RoPE embeddings.
|
54 |
+
max_position_embeddings (`int`, *optional*, defaults to 2048):
|
55 |
+
The maximum sequence length that this model might ever be used with.
|
56 |
+
Typically set this to something large just in case (e.g., 512 or 1024 or 2048).
|
57 |
+
initializer_range (`float`, *optional*, defaults to 1e-5):
|
58 |
+
The standard deviation of the truncated_normal_initializer for initializing
|
59 |
+
all weight matrices.
|
60 |
+
norm_eps (`float`, *optional*, defaults to 1e-8):
|
61 |
+
The epsilon used by the normalization layers.
|
62 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
63 |
+
Whether or not the model should return the last key/values attentions
|
64 |
+
(not used by all models). Only relevant if `config.is_decoder=True`.
|
65 |
+
tie_word_embeddings(`bool`, *optional*, defaults to `False`):
|
66 |
+
Whether to tie weight embeddings
|
67 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
68 |
+
The dropout ratio for the attention probabilities.
|
69 |
+
"""
|
70 |
+
model_type = "stablelm_epoch"
|
71 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
72 |
+
|
73 |
+
def __init__(
|
74 |
+
self,
|
75 |
+
vocab_size=50_304,
|
76 |
+
intermediate_size=6912,
|
77 |
+
hidden_size=2560,
|
78 |
+
num_hidden_layers=32,
|
79 |
+
num_attention_heads=32,
|
80 |
+
num_key_value_heads=32,
|
81 |
+
hidden_act="silu",
|
82 |
+
rope_pct=0.25,
|
83 |
+
rope_theta=10_000,
|
84 |
+
max_position_embeddings=4096,
|
85 |
+
initializer_range=0.02,
|
86 |
+
norm_eps=1.0e-5,
|
87 |
+
use_cache=True,
|
88 |
+
bos_token_id=0,
|
89 |
+
eos_token_id=2,
|
90 |
+
tie_word_embeddings=False,
|
91 |
+
attention_dropout: float = 0.0,
|
92 |
+
**kwargs,
|
93 |
+
):
|
94 |
+
self.vocab_size = vocab_size
|
95 |
+
self.max_position_embeddings = max_position_embeddings
|
96 |
+
self.intermediate_size = intermediate_size
|
97 |
+
self.hidden_size = hidden_size
|
98 |
+
self.num_hidden_layers = num_hidden_layers
|
99 |
+
self.num_attention_heads = num_attention_heads
|
100 |
+
self.num_key_value_heads = num_key_value_heads
|
101 |
+
self.hidden_act = hidden_act
|
102 |
+
self.rope_pct = rope_pct
|
103 |
+
self.rope_theta = rope_theta
|
104 |
+
self.initializer_range = initializer_range
|
105 |
+
self.norm_eps = norm_eps
|
106 |
+
self.use_cache = use_cache
|
107 |
+
self.tie_word_embeddings = tie_word_embeddings
|
108 |
+
self.attention_dropout = attention_dropout
|
109 |
+
super().__init__(
|
110 |
+
bos_token_id=bos_token_id,
|
111 |
+
eos_token_id=eos_token_id,
|
112 |
+
tie_word_embeddings=tie_word_embeddings,
|
113 |
+
**kwargs,
|
114 |
+
)
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 0,
|
4 |
+
"eos_token_id": 0,
|
5 |
+
"transformers_version": "4.37.0"
|
6 |
+
}
|
model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:80b1ef3c4a7297482c655342c06268626497cbb07b55170f11784356f5269b67
|
3 |
+
size 1664721
|
model.onnx_data
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5f8c60a3725c5b616eb51db885792daf2d02dc0e1668176845ea91bd469bdd32
|
3 |
+
size 11181772800
|