jonathanjordan21
commited on
Commit
•
2377071
1
Parent(s):
8ccc5df
Upload Qwen2ForCausalLM
Browse files- README.md +199 -0
- config.json +32 -0
- configuration_qwen2.py +185 -0
- generation_config.json +6 -0
- model.safetensors +3 -0
- modeling_qwen2_nomic_vision.py +0 -0
README.md
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
tags: []
|
4 |
+
---
|
5 |
+
|
6 |
+
# Model Card for Model ID
|
7 |
+
|
8 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
## Model Details
|
13 |
+
|
14 |
+
### Model Description
|
15 |
+
|
16 |
+
<!-- Provide a longer summary of what this model is. -->
|
17 |
+
|
18 |
+
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
19 |
+
|
20 |
+
- **Developed by:** [More Information Needed]
|
21 |
+
- **Funded by [optional]:** [More Information Needed]
|
22 |
+
- **Shared by [optional]:** [More Information Needed]
|
23 |
+
- **Model type:** [More Information Needed]
|
24 |
+
- **Language(s) (NLP):** [More Information Needed]
|
25 |
+
- **License:** [More Information Needed]
|
26 |
+
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
+
|
28 |
+
### Model Sources [optional]
|
29 |
+
|
30 |
+
<!-- Provide the basic links for the model. -->
|
31 |
+
|
32 |
+
- **Repository:** [More Information Needed]
|
33 |
+
- **Paper [optional]:** [More Information Needed]
|
34 |
+
- **Demo [optional]:** [More Information Needed]
|
35 |
+
|
36 |
+
## Uses
|
37 |
+
|
38 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
+
|
40 |
+
### Direct Use
|
41 |
+
|
42 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
+
|
44 |
+
[More Information Needed]
|
45 |
+
|
46 |
+
### Downstream Use [optional]
|
47 |
+
|
48 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
+
|
50 |
+
[More Information Needed]
|
51 |
+
|
52 |
+
### Out-of-Scope Use
|
53 |
+
|
54 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
+
|
56 |
+
[More Information Needed]
|
57 |
+
|
58 |
+
## Bias, Risks, and Limitations
|
59 |
+
|
60 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
+
|
62 |
+
[More Information Needed]
|
63 |
+
|
64 |
+
### Recommendations
|
65 |
+
|
66 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
+
|
68 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
+
|
70 |
+
## How to Get Started with the Model
|
71 |
+
|
72 |
+
Use the code below to get started with the model.
|
73 |
+
|
74 |
+
[More Information Needed]
|
75 |
+
|
76 |
+
## Training Details
|
77 |
+
|
78 |
+
### Training Data
|
79 |
+
|
80 |
+
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
+
|
82 |
+
[More Information Needed]
|
83 |
+
|
84 |
+
### Training Procedure
|
85 |
+
|
86 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
+
|
88 |
+
#### Preprocessing [optional]
|
89 |
+
|
90 |
+
[More Information Needed]
|
91 |
+
|
92 |
+
|
93 |
+
#### Training Hyperparameters
|
94 |
+
|
95 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
+
|
97 |
+
#### Speeds, Sizes, Times [optional]
|
98 |
+
|
99 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
+
|
101 |
+
[More Information Needed]
|
102 |
+
|
103 |
+
## Evaluation
|
104 |
+
|
105 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
+
|
107 |
+
### Testing Data, Factors & Metrics
|
108 |
+
|
109 |
+
#### Testing Data
|
110 |
+
|
111 |
+
<!-- This should link to a Dataset Card if possible. -->
|
112 |
+
|
113 |
+
[More Information Needed]
|
114 |
+
|
115 |
+
#### Factors
|
116 |
+
|
117 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
+
|
119 |
+
[More Information Needed]
|
120 |
+
|
121 |
+
#### Metrics
|
122 |
+
|
123 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
+
|
125 |
+
[More Information Needed]
|
126 |
+
|
127 |
+
### Results
|
128 |
+
|
129 |
+
[More Information Needed]
|
130 |
+
|
131 |
+
#### Summary
|
132 |
+
|
133 |
+
|
134 |
+
|
135 |
+
## Model Examination [optional]
|
136 |
+
|
137 |
+
<!-- Relevant interpretability work for the model goes here -->
|
138 |
+
|
139 |
+
[More Information Needed]
|
140 |
+
|
141 |
+
## Environmental Impact
|
142 |
+
|
143 |
+
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
+
|
145 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
+
|
147 |
+
- **Hardware Type:** [More Information Needed]
|
148 |
+
- **Hours used:** [More Information Needed]
|
149 |
+
- **Cloud Provider:** [More Information Needed]
|
150 |
+
- **Compute Region:** [More Information Needed]
|
151 |
+
- **Carbon Emitted:** [More Information Needed]
|
152 |
+
|
153 |
+
## Technical Specifications [optional]
|
154 |
+
|
155 |
+
### Model Architecture and Objective
|
156 |
+
|
157 |
+
[More Information Needed]
|
158 |
+
|
159 |
+
### Compute Infrastructure
|
160 |
+
|
161 |
+
[More Information Needed]
|
162 |
+
|
163 |
+
#### Hardware
|
164 |
+
|
165 |
+
[More Information Needed]
|
166 |
+
|
167 |
+
#### Software
|
168 |
+
|
169 |
+
[More Information Needed]
|
170 |
+
|
171 |
+
## Citation [optional]
|
172 |
+
|
173 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
+
|
175 |
+
**BibTeX:**
|
176 |
+
|
177 |
+
[More Information Needed]
|
178 |
+
|
179 |
+
**APA:**
|
180 |
+
|
181 |
+
[More Information Needed]
|
182 |
+
|
183 |
+
## Glossary [optional]
|
184 |
+
|
185 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
+
|
187 |
+
[More Information Needed]
|
188 |
+
|
189 |
+
## More Information [optional]
|
190 |
+
|
191 |
+
[More Information Needed]
|
192 |
+
|
193 |
+
## Model Card Authors [optional]
|
194 |
+
|
195 |
+
[More Information Needed]
|
196 |
+
|
197 |
+
## Model Card Contact
|
198 |
+
|
199 |
+
[More Information Needed]
|
config.json
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"Qwen2ForCausalLM"
|
4 |
+
],
|
5 |
+
"attention_dropout": 0.0,
|
6 |
+
"auto_map": {
|
7 |
+
"AutoConfig": "configuration_qwen2.Qwen2Config",
|
8 |
+
"AutoModelForCausalLM": "modeling_qwen2_nomic_vision.Qwen2ForCausalLM"
|
9 |
+
},
|
10 |
+
"bos_token_id": 151643,
|
11 |
+
"eos_token_id": 151645,
|
12 |
+
"hidden_act": "silu",
|
13 |
+
"hidden_size": 896,
|
14 |
+
"initializer_range": 0.02,
|
15 |
+
"intermediate_size": 4864,
|
16 |
+
"max_position_embeddings": 32768,
|
17 |
+
"max_window_layers": 21,
|
18 |
+
"model_type": "qwen2",
|
19 |
+
"num_attention_heads": 14,
|
20 |
+
"num_hidden_layers": 24,
|
21 |
+
"num_key_value_heads": 2,
|
22 |
+
"rms_norm_eps": 1e-06,
|
23 |
+
"rope_scaling": null,
|
24 |
+
"rope_theta": 1000000.0,
|
25 |
+
"sliding_window": null,
|
26 |
+
"tie_word_embeddings": true,
|
27 |
+
"torch_dtype": "float32",
|
28 |
+
"transformers_version": "4.46.2",
|
29 |
+
"use_cache": true,
|
30 |
+
"use_sliding_window": false,
|
31 |
+
"vocab_size": 151936
|
32 |
+
}
|
configuration_qwen2.py
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2024 The Qwen team, Alibaba Group 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 |
+
"""Qwen2 model configuration"""
|
16 |
+
|
17 |
+
from transformers.configuration_utils import PretrainedConfig
|
18 |
+
from transformers.modeling_rope_utils import rope_config_validation
|
19 |
+
from transformers.utils import logging
|
20 |
+
|
21 |
+
|
22 |
+
logger = logging.get_logger(__name__)
|
23 |
+
|
24 |
+
|
25 |
+
class Qwen2Config(PretrainedConfig):
|
26 |
+
r"""
|
27 |
+
This is the configuration class to store the configuration of a [`Qwen2Model`]. It is used to instantiate a
|
28 |
+
Qwen2 model according to the specified arguments, defining the model architecture. Instantiating a configuration
|
29 |
+
with the defaults will yield a similar configuration to that of
|
30 |
+
Qwen2-7B-beta [Qwen/Qwen2-7B-beta](https://huggingface.co/Qwen/Qwen2-7B-beta).
|
31 |
+
|
32 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
33 |
+
documentation from [`PretrainedConfig`] for more information.
|
34 |
+
|
35 |
+
|
36 |
+
Args:
|
37 |
+
vocab_size (`int`, *optional*, defaults to 151936):
|
38 |
+
Vocabulary size of the Qwen2 model. Defines the number of different tokens that can be represented by the
|
39 |
+
`inputs_ids` passed when calling [`Qwen2Model`]
|
40 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
41 |
+
Dimension of the hidden representations.
|
42 |
+
intermediate_size (`int`, *optional*, defaults to 22016):
|
43 |
+
Dimension of the MLP representations.
|
44 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
45 |
+
Number of hidden layers in the Transformer encoder.
|
46 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
47 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
48 |
+
num_key_value_heads (`int`, *optional*, defaults to 32):
|
49 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
50 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
51 |
+
`num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
52 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
53 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
54 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `32`.
|
55 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
56 |
+
The non-linear activation function (function or string) in the decoder.
|
57 |
+
max_position_embeddings (`int`, *optional*, defaults to 32768):
|
58 |
+
The maximum sequence length that this model might ever be used with.
|
59 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
60 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
61 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
62 |
+
The epsilon used by the rms normalization layers.
|
63 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
64 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
65 |
+
relevant if `config.is_decoder=True`.
|
66 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
67 |
+
Whether the model's input and output word embeddings should be tied.
|
68 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
69 |
+
The base period of the RoPE embeddings.
|
70 |
+
rope_scaling (`Dict`, *optional*):
|
71 |
+
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
|
72 |
+
and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
|
73 |
+
accordingly.
|
74 |
+
Expected contents:
|
75 |
+
`rope_type` (`str`):
|
76 |
+
The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
|
77 |
+
'llama3'], with 'default' being the original RoPE implementation.
|
78 |
+
`factor` (`float`, *optional*):
|
79 |
+
Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
|
80 |
+
most scaling types, a `factor` of x will enable the model to handle sequences of length x *
|
81 |
+
original maximum pre-trained length.
|
82 |
+
`original_max_position_embeddings` (`int`, *optional*):
|
83 |
+
Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
|
84 |
+
pretraining.
|
85 |
+
`attention_factor` (`float`, *optional*):
|
86 |
+
Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
|
87 |
+
computation. If unspecified, it defaults to value recommended by the implementation, using the
|
88 |
+
`factor` field to infer the suggested value.
|
89 |
+
`beta_fast` (`float`, *optional*):
|
90 |
+
Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
|
91 |
+
ramp function. If unspecified, it defaults to 32.
|
92 |
+
`beta_slow` (`float`, *optional*):
|
93 |
+
Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
|
94 |
+
ramp function. If unspecified, it defaults to 1.
|
95 |
+
`short_factor` (`List[float]`, *optional*):
|
96 |
+
Only used with 'longrope'. The scaling factor to be applied to short contexts (<
|
97 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
98 |
+
size divided by the number of attention heads divided by 2
|
99 |
+
`long_factor` (`List[float]`, *optional*):
|
100 |
+
Only used with 'longrope'. The scaling factor to be applied to long contexts (<
|
101 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
102 |
+
size divided by the number of attention heads divided by 2
|
103 |
+
`low_freq_factor` (`float`, *optional*):
|
104 |
+
Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
|
105 |
+
`high_freq_factor` (`float`, *optional*):
|
106 |
+
Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
|
107 |
+
use_sliding_window (`bool`, *optional*, defaults to `False`):
|
108 |
+
Whether to use sliding window attention.
|
109 |
+
sliding_window (`int`, *optional*, defaults to 4096):
|
110 |
+
Sliding window attention (SWA) window size. If not specified, will default to `4096`.
|
111 |
+
max_window_layers (`int`, *optional*, defaults to 28):
|
112 |
+
The number of layers that use SWA (Sliding Window Attention). The bottom layers use SWA while the top use full attention.
|
113 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
114 |
+
The dropout ratio for the attention probabilities.
|
115 |
+
|
116 |
+
```python
|
117 |
+
>>> from transformers import Qwen2Model, Qwen2Config
|
118 |
+
|
119 |
+
>>> # Initializing a Qwen2 style configuration
|
120 |
+
>>> configuration = Qwen2Config()
|
121 |
+
|
122 |
+
>>> # Initializing a model from the Qwen2-7B style configuration
|
123 |
+
>>> model = Qwen2Model(configuration)
|
124 |
+
|
125 |
+
>>> # Accessing the model configuration
|
126 |
+
>>> configuration = model.config
|
127 |
+
```"""
|
128 |
+
|
129 |
+
model_type = "qwen2"
|
130 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
131 |
+
|
132 |
+
def __init__(
|
133 |
+
self,
|
134 |
+
vocab_size=151936,
|
135 |
+
hidden_size=4096,
|
136 |
+
intermediate_size=22016,
|
137 |
+
num_hidden_layers=32,
|
138 |
+
num_attention_heads=32,
|
139 |
+
num_key_value_heads=32,
|
140 |
+
hidden_act="silu",
|
141 |
+
max_position_embeddings=32768,
|
142 |
+
initializer_range=0.02,
|
143 |
+
rms_norm_eps=1e-6,
|
144 |
+
use_cache=True,
|
145 |
+
tie_word_embeddings=False,
|
146 |
+
rope_theta=10000.0,
|
147 |
+
rope_scaling=None,
|
148 |
+
use_sliding_window=False,
|
149 |
+
sliding_window=4096,
|
150 |
+
max_window_layers=28,
|
151 |
+
attention_dropout=0.0,
|
152 |
+
**kwargs,
|
153 |
+
):
|
154 |
+
self.vocab_size = vocab_size
|
155 |
+
self.max_position_embeddings = max_position_embeddings
|
156 |
+
self.hidden_size = hidden_size
|
157 |
+
self.intermediate_size = intermediate_size
|
158 |
+
self.num_hidden_layers = num_hidden_layers
|
159 |
+
self.num_attention_heads = num_attention_heads
|
160 |
+
self.use_sliding_window = use_sliding_window
|
161 |
+
self.sliding_window = sliding_window if use_sliding_window else None
|
162 |
+
self.max_window_layers = max_window_layers
|
163 |
+
|
164 |
+
# for backward compatibility
|
165 |
+
if num_key_value_heads is None:
|
166 |
+
num_key_value_heads = num_attention_heads
|
167 |
+
|
168 |
+
self.num_key_value_heads = num_key_value_heads
|
169 |
+
self.hidden_act = hidden_act
|
170 |
+
self.initializer_range = initializer_range
|
171 |
+
self.rms_norm_eps = rms_norm_eps
|
172 |
+
self.use_cache = use_cache
|
173 |
+
self.rope_theta = rope_theta
|
174 |
+
self.rope_scaling = rope_scaling
|
175 |
+
self.attention_dropout = attention_dropout
|
176 |
+
# Validate the correctness of rotary position embeddings parameters
|
177 |
+
# BC: if there is a 'type' field, move it to 'rope_type'.
|
178 |
+
if self.rope_scaling is not None and "type" in self.rope_scaling:
|
179 |
+
self.rope_scaling["rope_type"] = self.rope_scaling["type"]
|
180 |
+
rope_config_validation(self)
|
181 |
+
|
182 |
+
super().__init__(
|
183 |
+
tie_word_embeddings=tie_word_embeddings,
|
184 |
+
**kwargs,
|
185 |
+
)
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 151643,
|
4 |
+
"eos_token_id": 151645,
|
5 |
+
"transformers_version": "4.46.2"
|
6 |
+
}
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56fbe28753f2f0d578d74bbd14693b045a9f82052e6c36c1cd29e29d558a47e0
|
3 |
+
size 2350730960
|
modeling_qwen2_nomic_vision.py
CHANGED
The diff for this file is too large to render.
See raw diff
|
|