upload model
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- chat_template.jinja +120 -0
- config.json +97 -0
- configuration_interns1.py +221 -0
- generation_config.json +6 -0
- merges.txt +0 -0
- model-00001-of-00097.safetensors +3 -0
- model-00002-of-00097.safetensors +3 -0
- model-00003-of-00097.safetensors +3 -0
- model-00004-of-00097.safetensors +3 -0
- model-00005-of-00097.safetensors +3 -0
- model-00006-of-00097.safetensors +3 -0
- model-00007-of-00097.safetensors +3 -0
- model-00008-of-00097.safetensors +3 -0
- model-00009-of-00097.safetensors +3 -0
- model-00010-of-00097.safetensors +3 -0
- model-00011-of-00097.safetensors +3 -0
- model-00012-of-00097.safetensors +3 -0
- model-00013-of-00097.safetensors +3 -0
- model-00014-of-00097.safetensors +3 -0
- model-00015-of-00097.safetensors +3 -0
- model-00016-of-00097.safetensors +3 -0
- model-00017-of-00097.safetensors +3 -0
- model-00018-of-00097.safetensors +3 -0
- model-00019-of-00097.safetensors +3 -0
- model-00020-of-00097.safetensors +3 -0
- model-00021-of-00097.safetensors +3 -0
- model-00022-of-00097.safetensors +3 -0
- model-00023-of-00097.safetensors +3 -0
- model-00024-of-00097.safetensors +3 -0
- model-00025-of-00097.safetensors +3 -0
- model-00026-of-00097.safetensors +3 -0
- model-00027-of-00097.safetensors +3 -0
- model-00028-of-00097.safetensors +3 -0
- model-00029-of-00097.safetensors +3 -0
- model-00030-of-00097.safetensors +3 -0
- model-00031-of-00097.safetensors +3 -0
- model-00032-of-00097.safetensors +3 -0
- model-00033-of-00097.safetensors +3 -0
- model-00034-of-00097.safetensors +3 -0
- model-00035-of-00097.safetensors +3 -0
- model-00036-of-00097.safetensors +3 -0
- model-00037-of-00097.safetensors +3 -0
- model-00038-of-00097.safetensors +3 -0
- model-00039-of-00097.safetensors +3 -0
- model-00040-of-00097.safetensors +3 -0
- model-00041-of-00097.safetensors +3 -0
- model-00042-of-00097.safetensors +3 -0
- model-00043-of-00097.safetensors +3 -0
- model-00044-of-00097.safetensors +3 -0
- model-00045-of-00097.safetensors +3 -0
chat_template.jinja
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{% set default_thinking_sys %}You are an expert reasoner with extensive experience in all areas. You approach problems through systematic thinking and rigorous reasoning. Your response should reflect deep understanding and precise logical thinking, making your solution path and reasoning clear to others. Please put your thinking process within <think>...</think> tags.{% endset %}
|
2 |
+
{%- set tool_instruction %}Your response should consist of a reasoning step (**thought**) followed immediately by a function call in valid JSON format. Wrap each function call using the `<|action_start|><|plugin|>` and `<|action_end|>` tags.
|
3 |
+
|
4 |
+
**Format example:**
|
5 |
+
|
6 |
+
```
|
7 |
+
(Your thought goes here...)
|
8 |
+
|
9 |
+
<|action_start|><|plugin|>
|
10 |
+
{
|
11 |
+
"name": "tool_name",
|
12 |
+
"parameters": {
|
13 |
+
"parameter1": "value1",
|
14 |
+
"parameter2": "value2"
|
15 |
+
}
|
16 |
+
}
|
17 |
+
<|action_end|>
|
18 |
+
```
|
19 |
+
|
20 |
+
# External Tools
|
21 |
+
You have access to these tools:
|
22 |
+
{% if tools %}{{ tools | tojson(indent=2) }}{% else %}[]{% endif %}{% endset %}
|
23 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
24 |
+
{%- for message in messages[::-1] %}
|
25 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
26 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
27 |
+
{%- set ns.multi_step_tool = false %}
|
28 |
+
{%- set ns.last_query_index = index %}
|
29 |
+
{%- endif %}
|
30 |
+
{%- endfor %}
|
31 |
+
{%- for message in messages %}
|
32 |
+
{%- set role = message.role if message.role != 'tool' else 'environment' %}
|
33 |
+
{%- set reasoning_content = '' %}
|
34 |
+
{%- set content = message.content %}
|
35 |
+
{%- set ns.tool_calls = '' %}
|
36 |
+
{%- if role == 'assistant' %}
|
37 |
+
{%- if message.reasoning_content is string %}
|
38 |
+
{%- set reasoning_content = message.reasoning_content %}
|
39 |
+
{%- elif '</think>' in content %}
|
40 |
+
{%- set reasoning_content = content.split('</think>')[0].strip().split('<think>')[-1].strip() %}
|
41 |
+
{%- set content = content.split('</think>')[-1].lstrip('
|
42 |
+
') %}
|
43 |
+
{%- endif %}
|
44 |
+
{%- if message.tool_calls %}
|
45 |
+
{%- for tool_call in message.tool_calls %}
|
46 |
+
{%- if not loop.first %}
|
47 |
+
{%- set ns.tool_calls = ns.tool_calls + '
|
48 |
+
' %}
|
49 |
+
{%- endif %}
|
50 |
+
{%- if tool_call.function %}
|
51 |
+
{%- set tool_call = tool_call.function %}
|
52 |
+
{%- endif %}
|
53 |
+
{%- set ns.tool_calls = ns.tool_calls + '<|action_start|><|plugin|>
|
54 |
+
{"name": "' + tool_call.name + '", "parameters": ' %}
|
55 |
+
{%- if tool_call.arguments is string %}
|
56 |
+
{%- set ns.tool_calls = ns.tool_calls + tool_call.arguments %}
|
57 |
+
{%- else %}
|
58 |
+
{%- set ns.tool_calls = ns.tool_calls + tool_call.arguments | tojson %}
|
59 |
+
{%- endif %}
|
60 |
+
{%- set ns.tool_calls = ns.tool_calls + '}
|
61 |
+
<|action_end|>' %}
|
62 |
+
{%- endfor %}
|
63 |
+
{%- endif %}
|
64 |
+
{%- set reasoning_content = '<think>
|
65 |
+
' + reasoning_content.strip('
|
66 |
+
') + '
|
67 |
+
</think>
|
68 |
+
' %}
|
69 |
+
{%- endif %}
|
70 |
+
{%- if not content is string %}
|
71 |
+
{%- set ns.content = '' %}
|
72 |
+
{%- for _content in message.content %}
|
73 |
+
{%- if _content.type == 'image' %}
|
74 |
+
{%- set ns.content = ns.content ~ '
|
75 |
+
<IMG_CONTEXT>' %}
|
76 |
+
{%- elif _content.type == 'video' %}
|
77 |
+
{%- set ns.content = ns.content ~ '
|
78 |
+
<video>' %}
|
79 |
+
{%- elif _content.type == 'text' %}
|
80 |
+
{%- set ns.content = ns.content ~ '
|
81 |
+
' ~ _content.text %}
|
82 |
+
{%- endif %}
|
83 |
+
{%- endfor %}
|
84 |
+
{%- set content = ns.content %}
|
85 |
+
{%- endif %}
|
86 |
+
{%- set content = content.lstrip('
|
87 |
+
') %}
|
88 |
+
{%- if ns.tool_calls %}
|
89 |
+
{%- set content = content + ns.tool_calls %}
|
90 |
+
{%- endif %}
|
91 |
+
{%- if loop.index0 == 0 %}
|
92 |
+
{%- set system_prompt = '' %}
|
93 |
+
{%- if role == 'system' %}
|
94 |
+
{%- set system_prompt = system_prompt + content %}
|
95 |
+
{%- elif enable_thinking is not defined or enable_thinking %}
|
96 |
+
{%- set system_prompt = system_prompt + default_thinking_sys %}
|
97 |
+
{%- endif %}
|
98 |
+
{%- if tools %}
|
99 |
+
{%- set system_prompt = system_prompt.rstrip('
|
100 |
+
') + '
|
101 |
+
|
102 |
+
' + tool_instruction %}
|
103 |
+
{%- endif %}
|
104 |
+
{%- set system_prompt = system_prompt.strip('
|
105 |
+
') %}
|
106 |
+
{%- endif %}
|
107 |
+
{%- if loop.index0 == 0 and system_prompt %}<|im_start|>system{% if tools %} name=<|plugin|>{% endif %}
|
108 |
+
|
109 |
+
{{ system_prompt }}<|im_end|>
|
110 |
+
{% endif %}
|
111 |
+
{%- if role != 'system' %}<|im_start|>{{ role }}{% if role == 'environment' or role == 'tool' %} name=<|plugin|>{% endif %}
|
112 |
+
|
113 |
+
{% if loop.index0 > ns.last_query_index and (loop.last or (not loop.last and reasoning_content)) %}{{ reasoning_content }}
|
114 |
+
{%- endif %}{{ content }}<|im_end|>
|
115 |
+
{% endif %}
|
116 |
+
{%- endfor %}
|
117 |
+
{%- if add_generation_prompt %}<|im_start|>assistant
|
118 |
+
{% if enable_thinking is not defined or enable_thinking %}
|
119 |
+
<think>{% endif %}
|
120 |
+
{% endif %}
|
config.json
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"architectures": [
|
3 |
+
"InternS1ForConditionalGeneration"
|
4 |
+
],
|
5 |
+
"auto_map": {
|
6 |
+
"AutoConfig": "configuration_interns1.InternS1Config",
|
7 |
+
"AutoModel": "modeling_interns1.InternS1Model",
|
8 |
+
"AutoModelForCausalLM": "modeling_interns1.InternS1ForConditionalGeneration"
|
9 |
+
},
|
10 |
+
"downsample_ratio": 0.5,
|
11 |
+
"image_seq_length": 256,
|
12 |
+
"image_token_id": 152957,
|
13 |
+
"model_type": "interns1",
|
14 |
+
"projector_hidden_act": "gelu",
|
15 |
+
"text_config": {
|
16 |
+
"architectures": [
|
17 |
+
"Qwen3MoeForCausalLM"
|
18 |
+
],
|
19 |
+
"attention_bias": false,
|
20 |
+
"attention_dropout": 0.0,
|
21 |
+
"bos_token_id": 151643,
|
22 |
+
"decoder_sparse_step": 1,
|
23 |
+
"eos_token_id": 151645,
|
24 |
+
"head_dim": 128,
|
25 |
+
"hidden_act": "silu",
|
26 |
+
"hidden_size": 4096,
|
27 |
+
"initializer_range": 0.02,
|
28 |
+
"intermediate_size": 8192,
|
29 |
+
"max_position_embeddings": 40960,
|
30 |
+
"max_window_layers": 94,
|
31 |
+
"mlp_only_layers": [],
|
32 |
+
"model_type": "qwen3_moe",
|
33 |
+
"moe_intermediate_size": 1536,
|
34 |
+
"norm_topk_prob": true,
|
35 |
+
"num_attention_heads": 64,
|
36 |
+
"num_experts": 128,
|
37 |
+
"num_experts_per_tok": 8,
|
38 |
+
"num_hidden_layers": 94,
|
39 |
+
"num_key_value_heads": 4,
|
40 |
+
"output_router_logits": false,
|
41 |
+
"rms_norm_eps": 1e-06,
|
42 |
+
"rope_scaling": null,
|
43 |
+
"rope_theta": 1000000.0,
|
44 |
+
"router_aux_loss_coef": 0.001,
|
45 |
+
"sliding_window": null,
|
46 |
+
"torch_dtype": "bfloat16",
|
47 |
+
"use_cache": true,
|
48 |
+
"use_sliding_window": false,
|
49 |
+
"vocab_size": 153216
|
50 |
+
},
|
51 |
+
"torch_dtype": "bfloat16",
|
52 |
+
"transformers_version": "4.53.0",
|
53 |
+
"vision_config": {
|
54 |
+
"architectures": [
|
55 |
+
"InternVisionModel"
|
56 |
+
],
|
57 |
+
"attention_bias": false,
|
58 |
+
"attention_dropout": 0.0,
|
59 |
+
"auto_map": {
|
60 |
+
"AutoConfig": "configuration_interns1.InternS1VisionConfig",
|
61 |
+
"AutoModel": "modeling_interns1.InternS1VisionModel"
|
62 |
+
},
|
63 |
+
"drop_path_rate": 0.1,
|
64 |
+
"dropout": 0.0,
|
65 |
+
"hidden_act": "gelu",
|
66 |
+
"hidden_dropout_prob": 0.0,
|
67 |
+
"hidden_size": 3200,
|
68 |
+
"image_size": [
|
69 |
+
448,
|
70 |
+
448
|
71 |
+
],
|
72 |
+
"initializer_factor": 0.1,
|
73 |
+
"initializer_range": 1e-10,
|
74 |
+
"intermediate_size": 12800,
|
75 |
+
"layer_norm_eps": 1e-06,
|
76 |
+
"layer_scale_init_value": 0.1,
|
77 |
+
"model_type": "interns1_vision",
|
78 |
+
"norm_type": "rms_norm",
|
79 |
+
"num_attention_heads": 25,
|
80 |
+
"num_channels": 3,
|
81 |
+
"num_hidden_layers": 45,
|
82 |
+
"patch_size": [
|
83 |
+
14,
|
84 |
+
14
|
85 |
+
],
|
86 |
+
"projection_dropout": 0.0,
|
87 |
+
"torch_dtype": "bfloat16",
|
88 |
+
"use_absolute_position_embeddings": true,
|
89 |
+
"use_bfloat16": true,
|
90 |
+
"use_flash_attn": true,
|
91 |
+
"use_mask_token": false,
|
92 |
+
"use_mean_pooling": true,
|
93 |
+
"use_qk_norm": true
|
94 |
+
},
|
95 |
+
"vision_feature_layer": -1,
|
96 |
+
"vision_feature_select_strategy": "default"
|
97 |
+
}
|
configuration_interns1.py
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2025 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 |
+
|
16 |
+
|
17 |
+
from transformers.configuration_utils import PretrainedConfig
|
18 |
+
from transformers import CONFIG_MAPPING, AutoConfig
|
19 |
+
|
20 |
+
|
21 |
+
class InternS1VisionConfig(PretrainedConfig):
|
22 |
+
r"""
|
23 |
+
This is the configuration class to store the configuration of a [`InternS1VisionModel`]. It is used to instantiate an InternS1VisionModel
|
24 |
+
model according to the specified arguments, defining the model architecture.
|
25 |
+
|
26 |
+
Args:
|
27 |
+
hidden_size (`int`, *optional*, defaults to 1024):
|
28 |
+
Dimensionality of the encoder layers and the pooler layer.
|
29 |
+
num_hidden_layers (`int`, *optional*, defaults to 24):
|
30 |
+
Number of hidden layers in the Transformer encoder.
|
31 |
+
num_attention_heads (`int`, *optional*, defaults to 16):
|
32 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
33 |
+
attention_bias (`bool`, *optional*, defaults to `False`):
|
34 |
+
Whether to add a bias to the queries, keys and values.
|
35 |
+
use_qk_norm (`bool`, *optional*, defaults to `False`):
|
36 |
+
Whether to apply normalization to the queries and keys before the attention operation.
|
37 |
+
intermediate_size (`int`, *optional*, defaults to 4096):
|
38 |
+
Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
|
39 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
|
40 |
+
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
|
41 |
+
`"relu"`, `"selu"` and `"gelu_new"` are supported.
|
42 |
+
hidden_dropout_prob (`float`, *optional*, defaults to 0.0):
|
43 |
+
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
|
44 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
45 |
+
Dropout probability for attention weights.
|
46 |
+
projection_dropout (`float`, *optional*, defaults to 0.0):
|
47 |
+
Dropout probability for the projection layer.
|
48 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
49 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
50 |
+
norm_type (`str`, *optional*, defaults to `"layer_norm"`):
|
51 |
+
The type of normalization to use in the encoder. Can be `"layer_norm"` or `"rms_norm"`.
|
52 |
+
layer_norm_eps (`float`, *optional*, defaults to 1e-06):
|
53 |
+
The epsilon used by the layer normalization layers.
|
54 |
+
image_size (`int` or `list[int]`, *optional*, defaults to `[448, 448]`):
|
55 |
+
The size (resolution) of each image.
|
56 |
+
patch_size (`int` or `list[int]`, *optional*, defaults to `[14, 14]`):
|
57 |
+
The size (resolution) of each patch.
|
58 |
+
num_channels (`int`, *optional*, defaults to 3):
|
59 |
+
The number of input channels.
|
60 |
+
use_mask_token (`bool`, *optional*, defaults to `False`):
|
61 |
+
Whether to use a mask token for masked image modeling.
|
62 |
+
use_absolute_position_embeddings (`bool`, *optional*, defaults to `True`):
|
63 |
+
Whether to use BERT-style absolute position embeddings.
|
64 |
+
layer_scale_init_value (`float`, *optional*, defaults to 0.1):
|
65 |
+
Scale to use in the self-attention layers. 0.1 for base, 1e-5 for large. Set 0 to disable layer scale.
|
66 |
+
use_mean_pooling (`bool`, *optional*, defaults to `True`):
|
67 |
+
Whether to mean pool the final hidden states of the patches instead of using the final hidden state of the
|
68 |
+
CLS token, before applying the classification head.
|
69 |
+
|
70 |
+
Example:
|
71 |
+
|
72 |
+
```python
|
73 |
+
>>> from transformers import InternS1VisionConfig, InternS1VisionModel
|
74 |
+
|
75 |
+
>>> # Initializing a InternS1VisionModel
|
76 |
+
>>> configuration = InternS1VisionConfig()
|
77 |
+
|
78 |
+
>>> # Initializing a model (with random weights) from configuration
|
79 |
+
>>> model = InternS1VisionModel(configuration)
|
80 |
+
|
81 |
+
>>> # Accessing the model configuration
|
82 |
+
>>> configuration = model.config
|
83 |
+
```"""
|
84 |
+
|
85 |
+
model_type = "interns1_vision"
|
86 |
+
base_config_key = "vision_config"
|
87 |
+
|
88 |
+
def __init__(
|
89 |
+
self,
|
90 |
+
hidden_size=1024,
|
91 |
+
num_hidden_layers=24,
|
92 |
+
num_attention_heads=16,
|
93 |
+
attention_bias=False,
|
94 |
+
use_qk_norm=False,
|
95 |
+
intermediate_size=4096,
|
96 |
+
hidden_act="gelu",
|
97 |
+
hidden_dropout_prob=0.0,
|
98 |
+
attention_dropout=0.0,
|
99 |
+
projection_dropout=0.0,
|
100 |
+
initializer_range=0.02,
|
101 |
+
norm_type="layer_norm",
|
102 |
+
layer_norm_eps=1e-06,
|
103 |
+
image_size=[448, 448],
|
104 |
+
patch_size=[14, 14],
|
105 |
+
num_channels=3,
|
106 |
+
use_mask_token=False,
|
107 |
+
use_absolute_position_embeddings=True,
|
108 |
+
layer_scale_init_value=0.1,
|
109 |
+
use_mean_pooling=True,
|
110 |
+
**kwargs,
|
111 |
+
):
|
112 |
+
super().__init__(**kwargs)
|
113 |
+
|
114 |
+
self.hidden_size = hidden_size
|
115 |
+
self.num_hidden_layers = num_hidden_layers
|
116 |
+
self.num_attention_heads = num_attention_heads
|
117 |
+
self.attention_bias = attention_bias
|
118 |
+
self.use_qk_norm = use_qk_norm
|
119 |
+
self.intermediate_size = intermediate_size
|
120 |
+
self.hidden_act = hidden_act
|
121 |
+
self.hidden_dropout_prob = hidden_dropout_prob
|
122 |
+
self.attention_dropout = attention_dropout
|
123 |
+
self.projection_dropout = projection_dropout
|
124 |
+
self.initializer_range = initializer_range
|
125 |
+
self.norm_type = norm_type
|
126 |
+
self.layer_norm_eps = layer_norm_eps
|
127 |
+
|
128 |
+
image_size = image_size if isinstance(image_size, (list, tuple)) else (image_size, image_size)
|
129 |
+
patch_size = patch_size if isinstance(patch_size, (list, tuple)) else (patch_size, patch_size)
|
130 |
+
self.image_size = image_size
|
131 |
+
self.patch_size = patch_size
|
132 |
+
|
133 |
+
self.num_channels = num_channels
|
134 |
+
self.use_mask_token = use_mask_token
|
135 |
+
self.use_absolute_position_embeddings = use_absolute_position_embeddings
|
136 |
+
self.layer_scale_init_value = layer_scale_init_value
|
137 |
+
self.use_mean_pooling = use_mean_pooling
|
138 |
+
|
139 |
+
|
140 |
+
class InternS1Config(PretrainedConfig):
|
141 |
+
r"""
|
142 |
+
This is the configuration class to store the configuration of a [`InternS1ForConditionalGeneration`]. It is used to instantiate a
|
143 |
+
InternS1 model according to the specified arguments, defining the model architecture.
|
144 |
+
|
145 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
146 |
+
documentation from [`PretrainedConfig`] for more information.
|
147 |
+
|
148 |
+
|
149 |
+
Args:
|
150 |
+
vision_config (`Union[AutoConfig, dict]`, *optional*, defaults to `InternVisonConfig`):
|
151 |
+
The config object or dictionary of the vision backbone.
|
152 |
+
text_config (`Union[AutoConfig, dict]`, *optional*, defaults to `Qwen2Config`):
|
153 |
+
The config object or dictionary of the text backbone.
|
154 |
+
image_token_id (`int`, *optional*, defaults to 151667):
|
155 |
+
The image token index to encode the image prompt.
|
156 |
+
image_seq_length (`int`, *optional*, defaults to 256):
|
157 |
+
Number of image tokens to use per image patch.
|
158 |
+
downsample_ratio (`float`, *optional*, defaults to 0.5):
|
159 |
+
Factor by which to downsample the image.
|
160 |
+
projector_hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
|
161 |
+
The non-linear activation function (function or string) in the projector.
|
162 |
+
vision_feature_layer (`int`, *optional*, defaults to -1):
|
163 |
+
The index of the layer to use as the image features.
|
164 |
+
vision_feature_select_strategy (`str`, *optional*, defaults to `"default"`):
|
165 |
+
The feature selection strategy used to select the vision feature from the vision backbone.
|
166 |
+
Can be one of `"default"` or `"full"`.
|
167 |
+
|
168 |
+
```python
|
169 |
+
>>> from transformers import InternS1ForConditionalGeneration, InternS1Config
|
170 |
+
|
171 |
+
>>> # Initializing a InternS1 style configuration
|
172 |
+
>>> configuration = InternS1Config()
|
173 |
+
|
174 |
+
>>> # Initializing a model (with random weights) from configuration
|
175 |
+
>>> model = InternS1ForConditionalGeneration(configuration)
|
176 |
+
|
177 |
+
>>> # Accessing the model configuration
|
178 |
+
>>> configuration = model.config
|
179 |
+
```"""
|
180 |
+
|
181 |
+
model_type = "interns1"
|
182 |
+
sub_configs = {"text_config": AutoConfig, "vision_config": InternS1VisionConfig}
|
183 |
+
|
184 |
+
def __init__(
|
185 |
+
self,
|
186 |
+
vision_config=None,
|
187 |
+
text_config=None,
|
188 |
+
image_token_id=151667,
|
189 |
+
image_seq_length=256,
|
190 |
+
downsample_ratio=0.5,
|
191 |
+
projector_hidden_act="gelu",
|
192 |
+
vision_feature_layer=-1,
|
193 |
+
vision_feature_select_strategy="default",
|
194 |
+
**kwargs,
|
195 |
+
):
|
196 |
+
self.image_token_id = image_token_id
|
197 |
+
self.image_seq_length = image_seq_length
|
198 |
+
self.downsample_ratio = downsample_ratio
|
199 |
+
self.projector_hidden_act = projector_hidden_act
|
200 |
+
self.vision_feature_layer = vision_feature_layer
|
201 |
+
self.vision_feature_select_strategy = vision_feature_select_strategy
|
202 |
+
|
203 |
+
if isinstance(vision_config, dict):
|
204 |
+
self.vision_config = InternS1VisionConfig(**vision_config)
|
205 |
+
elif isinstance(vision_config, InternS1VisionConfig):
|
206 |
+
self.vision_config = vision_config
|
207 |
+
elif vision_config is None:
|
208 |
+
self.vision_config = InternS1VisionConfig()
|
209 |
+
|
210 |
+
if isinstance(text_config, dict):
|
211 |
+
text_config["model_type"] = text_config["model_type"] if "model_type" in text_config else "qwen2" # todo
|
212 |
+
text_config = CONFIG_MAPPING[text_config["model_type"]](**text_config)
|
213 |
+
elif text_config is None:
|
214 |
+
text_config = CONFIG_MAPPING["qwen2"]() # todo
|
215 |
+
|
216 |
+
self.text_config = text_config
|
217 |
+
|
218 |
+
super().__init__(**kwargs)
|
219 |
+
|
220 |
+
|
221 |
+
__all__ = ["InternS1VisionConfig", "InternS1Config"]
|
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.54.0.dev0"
|
6 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model-00001-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fb7556c5aa2e0de7cba6aa8249db9c34b2334717e54329f98d96706f7cd9afdd
|
3 |
+
size 4988565184
|
model-00002-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a7b5f5826c046cfdac05af25e2eb35f28d6820fc5a38572a09ae17fcf961565d
|
3 |
+
size 4937275136
|
model-00003-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a44c4fdff473046498a3495a576f27593b5e104b6f851f0ff967932ee7f58ca6
|
3 |
+
size 4999804368
|
model-00004-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4089778ede9c8dcfff30fecba0f803813f15c381480fbd5697ef5e3f8922e947
|
3 |
+
size 4988147640
|
model-00005-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3a54b650296fbd365635da5035cd87671833387f72690415a3ba142cb2d061a5
|
3 |
+
size 4988147640
|
model-00006-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:22ef7e7fe1adbf8f43ebcbc81f21b7919f9b624afa503acb9739c9227317e388
|
3 |
+
size 4988147640
|
model-00007-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ddc214772c6d8d78378998e61d38a1b59b24d86efe1e7bc2a4785659dbef6972
|
3 |
+
size 4988147640
|
model-00008-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:db43fa079adfb95cfae516533d6e11368778951f98084b4ff380426159c83b6d
|
3 |
+
size 4988147640
|
model-00009-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c787bb4dd2cefbd411c097cd288377eaec71344625acc59a4210c6f11445d02b
|
3 |
+
size 4988147640
|
model-00010-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:46307a3db35d561cd056946fec515537228571cd07605fc9b86447847521a9b8
|
3 |
+
size 4988147640
|
model-00011-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:218d57f0b7d50c30d11af1183ccc16c071ea9e64b7f676277800d4a90240407c
|
3 |
+
size 4988147640
|
model-00012-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a2b0306dfb8a37b16226f3d7ab659fa08811db1d76ab72ad8846fe9d16b97d0b
|
3 |
+
size 4988147640
|
model-00013-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f39e33bceb7826be6001eb48bc71d28043b4cf8833a79658dd5fde0958d320e1
|
3 |
+
size 4988147848
|
model-00014-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7499d982e217118b33870f664f13a0f58f53e18736eff62418a471ed56deb6d0
|
3 |
+
size 4988148032
|
model-00015-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d0529e3da8b7cfeba09c08f0627a57306aca329e8addb9ba9444efd0282eb02a
|
3 |
+
size 4988148032
|
model-00016-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:10643f14a0ea8481632106bb55e4b45e27d0f9ed535e6264dad674b639a15fa8
|
3 |
+
size 4988148032
|
model-00017-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9e6460056988cf53e49f95cda37d439a9dd1f67082d26678956c45828261b531
|
3 |
+
size 4988148032
|
model-00018-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:87660581e7218883900b8ea168a89681dd11ac1d07532b681529200ef0a8825f
|
3 |
+
size 4988148032
|
model-00019-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:dcf1e0bd8c8171748929749557a7beeeeb311d1935949065b9f815e024d756d7
|
3 |
+
size 4988148032
|
model-00020-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:777e63306ba2ae471abf59146c30d8dfa8504632c20b7c746f93b8a7c010cff3
|
3 |
+
size 4988148032
|
model-00021-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:929724173576c56f61f321314a216a00ad3ed00c242398ef407649d6c3483c3d
|
3 |
+
size 4988148032
|
model-00022-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7d93af2e15449e104033f7a301b32775e51358e930df57804afe78acd2f5fbb7
|
3 |
+
size 4988148032
|
model-00023-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:030c388405355180401d0d9ab697aa726e5d0ee6bce4f7cab644773cb77a7219
|
3 |
+
size 4988148032
|
model-00024-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7d3b40a00fd903d3c38f77a5892f9169d8b04e238e228a04b9398a053e6e1ece
|
3 |
+
size 4988148032
|
model-00025-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1d549aabfae510d696ac0ad420bc457827a835dc46beca5e785693c425f7849e
|
3 |
+
size 4988148032
|
model-00026-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6e75c716ead6f0e3113d5ef238f96480126863f85e3a02861afccfc1d5cfaa70
|
3 |
+
size 4988148032
|
model-00027-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7db465dafb24eab7acb5b77423c3b1eb4483538b4244fca8d683e211ed21beba
|
3 |
+
size 4988148032
|
model-00028-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5500645f5ce99870de5a9209491e5de666e13050a38e9aad8d397aab73a1ca56
|
3 |
+
size 4988148032
|
model-00029-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e315a4919d511f43e630b695aed3ae93535a9262f113c00adb0dfb4830d7f862
|
3 |
+
size 4988148032
|
model-00030-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bb12ae2cb5a2d2c92e8c096b517b8ee2f5b4eee56a443cc280189ae803d95b8a
|
3 |
+
size 4988148032
|
model-00031-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:78ab9e26b78b3d2ad1eb7bb5473c7b887c0c6cff455b76fadc512c91e75ff2e2
|
3 |
+
size 4988148032
|
model-00032-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:774d17f436088df12d142de2b79620cc6c7ec815505e332c40a281c42fac564b
|
3 |
+
size 4988148032
|
model-00033-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4e7e04c97ce6ee7467bb1c9ddd8e41c015f6a0d06c441199b93cdd1ded81d1f6
|
3 |
+
size 4988148032
|
model-00034-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f1f38b2955a6ece772ae7f27e30e34522128903c43740df931397c63fc8d7252
|
3 |
+
size 4988148032
|
model-00035-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:826eba94b4f66b32e30d1e78cb2c94b68425fb76abc416b270121030bcba3801
|
3 |
+
size 4988148032
|
model-00036-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f2ae9fc9e307f4c8d69710d99466d33e4940cd7c81913a90fa0d3a6633e2cc4c
|
3 |
+
size 4988148032
|
model-00037-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:88244a23eb68cd7389fb56b8686cdb8bc60e5e4b499e9c71fcc1864e4be5aac9
|
3 |
+
size 4988148032
|
model-00038-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:11e9c1974cb673e5998af4307a03d2453973f7deaae059f7bdddeae88d88e87f
|
3 |
+
size 4988148032
|
model-00039-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9d76b174634a2870ff97fe7d062211d80b4eb741badab5f18d22d67870f9911d
|
3 |
+
size 4988148032
|
model-00040-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:04bcc5b3122083919ba6097d3c01c5cd0e6ca977fb8b6cca3c688535e0abb964
|
3 |
+
size 4988148032
|
model-00041-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2e5a58b3e7ddfafd74347b4292d45f022ecd4556d6ddd49313842df196e184bb
|
3 |
+
size 4988148032
|
model-00042-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b9b9fd4414eba2cf80d701e07ce020b10341f868ef375983ab7491af5bea0f5f
|
3 |
+
size 4988148032
|
model-00043-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:04c7a39ed81ec9802463249b10d0a9cd916816c4539163810b7fcbfff1b9b5fd
|
3 |
+
size 4988148032
|
model-00044-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2bf8ddeef81b5f16f3e5bc21449b089ff4f9da41c83ebd2e3b88f79a25061519
|
3 |
+
size 4988148032
|
model-00045-of-00097.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7cfae484da119d77cd85c38198795415bb646709cd4c45796677ddcac91830f3
|
3 |
+
size 4988148032
|