czczup commited on
Commit
6fd2e7d
1 Parent(s): 3499cc3

Upload folder using huggingface_hub

Browse files
config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "InternVisionModel"
4
+ ],
5
+ "auto_map": {
6
+ "AutoConfig": "configuration_intern_vit.InternVisionConfig",
7
+ "AutoModel": "modeling_intern_vit.InternVisionModel"
8
+ },
9
+ "attention_dropout": 0.0,
10
+ "drop_path_rate": 0.0,
11
+ "dropout": 0.0,
12
+ "hidden_act": "gelu",
13
+ "hidden_size": 3200,
14
+ "image_size": 448,
15
+ "initializer_factor": 0.1,
16
+ "initializer_range": 1e-10,
17
+ "intermediate_size": 12800,
18
+ "layer_norm_eps": 1e-06,
19
+ "model_type": "intern_vit_6b",
20
+ "num_attention_heads": 25,
21
+ "num_channels": 3,
22
+ "num_hidden_layers": 45,
23
+ "patch_size": 14,
24
+ "qk_normalization": true,
25
+ "qkv_bias": false,
26
+ "torch_dtype": "bfloat16",
27
+ "transformers_version": "4.36.2",
28
+ "use_bfloat16": true,
29
+ "use_flash_attn": true
30
+ }
configuration_intern_vit.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --------------------------------------------------------
2
+ # InternVL
3
+ # Copyright (c) 2023 OpenGVLab
4
+ # Licensed under The MIT License [see LICENSE for details]
5
+ # --------------------------------------------------------
6
+ import os
7
+ from typing import Union
8
+
9
+ from transformers.configuration_utils import PretrainedConfig
10
+ from transformers.utils import logging
11
+
12
+ logger = logging.get_logger(__name__)
13
+
14
+
15
+ class InternVisionConfig(PretrainedConfig):
16
+ r"""
17
+ This is the configuration class to store the configuration of a [`InternVisionModel`]. It is used to
18
+ instantiate a vision encoder according to the specified arguments, defining the model architecture.
19
+
20
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
21
+ documentation from [`PretrainedConfig`] for more information.
22
+
23
+ Args:
24
+ num_channels (`int`, *optional*, defaults to 3):
25
+ Number of color channels in the input images (e.g., 3 for RGB).
26
+ patch_size (`int`, *optional*, defaults to 14):
27
+ The size (resolution) of each patch.
28
+ image_size (`int`, *optional*, defaults to 224):
29
+ The size (resolution) of each image.
30
+ qkv_bias (`bool`, *optional*, defaults to `False`):
31
+ Whether to add a bias to the queries and values in the self-attention layers.
32
+ hidden_size (`int`, *optional*, defaults to 3200):
33
+ Dimensionality of the encoder layers and the pooler layer.
34
+ num_attention_heads (`int`, *optional*, defaults to 25):
35
+ Number of attention heads for each attention layer in the Transformer encoder.
36
+ intermediate_size (`int`, *optional*, defaults to 12800):
37
+ Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
38
+ qk_normalization (`bool`, *optional*, defaults to `True`):
39
+ Whether to normalize the queries and keys in the self-attention layers.
40
+ num_hidden_layers (`int`, *optional*, defaults to 48):
41
+ Number of hidden layers in the Transformer encoder.
42
+ use_flash_attn (`bool`, *optional*, defaults to `True`):
43
+ Whether to use flash attention mechanism.
44
+ hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
45
+ The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
46
+ `"relu"`, `"selu"` and `"gelu_new"` ``"gelu"` are supported.
47
+ layer_norm_eps (`float`, *optional*, defaults to 1e-6):
48
+ The epsilon used by the layer normalization layers.
49
+ dropout (`float`, *optional*, defaults to 0.0):
50
+ The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
51
+ drop_path_rate (`float`, *optional*, defaults to 0.0):
52
+ Dropout rate for stochastic depth.
53
+ attention_dropout (`float`, *optional*, defaults to 0.0):
54
+ The dropout ratio for the attention probabilities.
55
+ initializer_range (`float`, *optional*, defaults to 0.02):
56
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
57
+ initializer_factor (`float`, *optional*, defaults to 0.1):
58
+ A factor for layer scale.
59
+ """
60
+
61
+ model_type = 'intern_vit_6b'
62
+
63
+ def __init__(
64
+ self,
65
+ num_channels=3,
66
+ patch_size=14,
67
+ image_size=224,
68
+ qkv_bias=False,
69
+ hidden_size=3200,
70
+ num_attention_heads=25,
71
+ intermediate_size=12800,
72
+ qk_normalization=True,
73
+ num_hidden_layers=48,
74
+ use_flash_attn=True,
75
+ hidden_act='gelu',
76
+ layer_norm_eps=1e-6,
77
+ dropout=0.0,
78
+ drop_path_rate=0.0,
79
+ attention_dropout=0.0,
80
+ initializer_range=0.02,
81
+ initializer_factor=0.1,
82
+ **kwargs,
83
+ ):
84
+ super().__init__(**kwargs)
85
+
86
+ self.hidden_size = hidden_size
87
+ self.intermediate_size = intermediate_size
88
+ self.dropout = dropout
89
+ self.drop_path_rate = drop_path_rate
90
+ self.num_hidden_layers = num_hidden_layers
91
+ self.num_attention_heads = num_attention_heads
92
+ self.num_channels = num_channels
93
+ self.patch_size = patch_size
94
+ self.image_size = image_size
95
+ self.initializer_range = initializer_range
96
+ self.initializer_factor = initializer_factor
97
+ self.attention_dropout = attention_dropout
98
+ self.layer_norm_eps = layer_norm_eps
99
+ self.hidden_act = hidden_act
100
+ self.qkv_bias = qkv_bias
101
+ self.qk_normalization = qk_normalization
102
+ self.use_flash_attn = use_flash_attn
103
+
104
+ @classmethod
105
+ def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> 'PretrainedConfig':
106
+ config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
107
+
108
+ if 'vision_config' in config_dict:
109
+ config_dict = config_dict['vision_config']
110
+
111
+ if 'model_type' in config_dict and hasattr(cls, 'model_type') and config_dict['model_type'] != cls.model_type:
112
+ logger.warning(
113
+ f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
114
+ f'{cls.model_type}. This is not supported for all configurations of models and can yield errors.'
115
+ )
116
+
117
+ return cls.from_dict(config_dict, **kwargs)
flash_attention.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+ from einops import rearrange
4
+
5
+ try: # v1
6
+ from flash_attn.flash_attn_interface import \
7
+ flash_attn_unpadded_qkvpacked_func
8
+ except: # v2
9
+ from flash_attn.flash_attn_interface import flash_attn_varlen_qkvpacked_func as flash_attn_unpadded_qkvpacked_func
10
+
11
+ from flash_attn.bert_padding import pad_input, unpad_input
12
+
13
+
14
+ class FlashAttention(nn.Module):
15
+ """Implement the scaled dot product attention with softmax.
16
+ Arguments
17
+ ---------
18
+ softmax_scale: The temperature to use for the softmax attention.
19
+ (default: 1/sqrt(d_keys) where d_keys is computed at
20
+ runtime)
21
+ attention_dropout: The dropout rate to apply to the attention
22
+ (default: 0.0)
23
+ """
24
+
25
+ def __init__(self, softmax_scale=None, attention_dropout=0.0, device=None, dtype=None):
26
+ super().__init__()
27
+ self.softmax_scale = softmax_scale
28
+ self.dropout_p = attention_dropout
29
+
30
+ def forward(self, qkv, key_padding_mask=None, causal=False, cu_seqlens=None,
31
+ max_s=None, need_weights=False):
32
+ """Implements the multihead softmax attention.
33
+ Arguments
34
+ ---------
35
+ qkv: The tensor containing the query, key, and value. (B, S, 3, H, D) if key_padding_mask is None
36
+ if unpadded: (nnz, 3, h, d)
37
+ key_padding_mask: a bool tensor of shape (B, S)
38
+ """
39
+ assert not need_weights
40
+ assert qkv.dtype in [torch.float16, torch.bfloat16]
41
+ assert qkv.is_cuda
42
+
43
+ if cu_seqlens is None:
44
+ batch_size = qkv.shape[0]
45
+ seqlen = qkv.shape[1]
46
+ if key_padding_mask is None:
47
+ qkv = rearrange(qkv, 'b s ... -> (b s) ...')
48
+ max_s = seqlen
49
+ cu_seqlens = torch.arange(0, (batch_size + 1) * seqlen, step=seqlen, dtype=torch.int32,
50
+ device=qkv.device)
51
+ output = flash_attn_unpadded_qkvpacked_func(
52
+ qkv, cu_seqlens, max_s, self.dropout_p if self.training else 0.0,
53
+ softmax_scale=self.softmax_scale, causal=causal
54
+ )
55
+ output = rearrange(output, '(b s) ... -> b s ...', b=batch_size)
56
+ else:
57
+ nheads = qkv.shape[-2]
58
+ x = rearrange(qkv, 'b s three h d -> b s (three h d)')
59
+ x_unpad, indices, cu_seqlens, max_s = unpad_input(x, key_padding_mask)
60
+ x_unpad = rearrange(x_unpad, 'nnz (three h d) -> nnz three h d', three=3, h=nheads)
61
+ output_unpad = flash_attn_unpadded_qkvpacked_func(
62
+ x_unpad, cu_seqlens, max_s, self.dropout_p if self.training else 0.0,
63
+ softmax_scale=self.softmax_scale, causal=causal
64
+ )
65
+ output = rearrange(pad_input(rearrange(output_unpad, 'nnz h d -> nnz (h d)'),
66
+ indices, batch_size, seqlen),
67
+ 'b s (h d) -> b s h d', h=nheads)
68
+ else:
69
+ assert max_s is not None
70
+ output = flash_attn_unpadded_qkvpacked_func(
71
+ qkv, cu_seqlens, max_s, self.dropout_p if self.training else 0.0,
72
+ softmax_scale=self.softmax_scale, causal=causal
73
+ )
74
+
75
+ return output, None
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b69de7960bd05ff0abaeb765783a439f5fbcfe80ce643c570fe08587fda66f4
3
+ size 4988565944
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8434954fb6944f58fd23356265239db07abde8b6016eb5f35af0bcaa9405eaa9
3
+ size 4937250176
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2fa4a1cb965066571ef70ba95956ad935c0ac4adff48f777e8c567e58c5443b
3
+ size 1147238088
model.safetensors.index.json ADDED
@@ -0,0 +1,596 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 11072992000
4
+ },
5
+ "weight_map": {
6
+ "embeddings.class_embedding": "model-00001-of-00003.safetensors",
7
+ "embeddings.patch_embedding.bias": "model-00001-of-00003.safetensors",
8
+ "embeddings.patch_embedding.weight": "model-00001-of-00003.safetensors",
9
+ "embeddings.position_embedding": "model-00001-of-00003.safetensors",
10
+ "encoder.layers.0.attn.k_norm.weight": "model-00001-of-00003.safetensors",
11
+ "encoder.layers.0.attn.proj.bias": "model-00001-of-00003.safetensors",
12
+ "encoder.layers.0.attn.proj.weight": "model-00001-of-00003.safetensors",
13
+ "encoder.layers.0.attn.q_norm.weight": "model-00001-of-00003.safetensors",
14
+ "encoder.layers.0.attn.qkv.weight": "model-00001-of-00003.safetensors",
15
+ "encoder.layers.0.ls1": "model-00001-of-00003.safetensors",
16
+ "encoder.layers.0.ls2": "model-00001-of-00003.safetensors",
17
+ "encoder.layers.0.mlp.fc1.bias": "model-00001-of-00003.safetensors",
18
+ "encoder.layers.0.mlp.fc1.weight": "model-00001-of-00003.safetensors",
19
+ "encoder.layers.0.mlp.fc2.bias": "model-00001-of-00003.safetensors",
20
+ "encoder.layers.0.mlp.fc2.weight": "model-00001-of-00003.safetensors",
21
+ "encoder.layers.0.norm1.weight": "model-00001-of-00003.safetensors",
22
+ "encoder.layers.0.norm2.weight": "model-00001-of-00003.safetensors",
23
+ "encoder.layers.1.attn.k_norm.weight": "model-00001-of-00003.safetensors",
24
+ "encoder.layers.1.attn.proj.bias": "model-00001-of-00003.safetensors",
25
+ "encoder.layers.1.attn.proj.weight": "model-00001-of-00003.safetensors",
26
+ "encoder.layers.1.attn.q_norm.weight": "model-00001-of-00003.safetensors",
27
+ "encoder.layers.1.attn.qkv.weight": "model-00001-of-00003.safetensors",
28
+ "encoder.layers.1.ls1": "model-00001-of-00003.safetensors",
29
+ "encoder.layers.1.ls2": "model-00001-of-00003.safetensors",
30
+ "encoder.layers.1.mlp.fc1.bias": "model-00001-of-00003.safetensors",
31
+ "encoder.layers.1.mlp.fc1.weight": "model-00001-of-00003.safetensors",
32
+ "encoder.layers.1.mlp.fc2.bias": "model-00001-of-00003.safetensors",
33
+ "encoder.layers.1.mlp.fc2.weight": "model-00001-of-00003.safetensors",
34
+ "encoder.layers.1.norm1.weight": "model-00001-of-00003.safetensors",
35
+ "encoder.layers.1.norm2.weight": "model-00001-of-00003.safetensors",
36
+ "encoder.layers.10.attn.k_norm.weight": "model-00001-of-00003.safetensors",
37
+ "encoder.layers.10.attn.proj.bias": "model-00001-of-00003.safetensors",
38
+ "encoder.layers.10.attn.proj.weight": "model-00001-of-00003.safetensors",
39
+ "encoder.layers.10.attn.q_norm.weight": "model-00001-of-00003.safetensors",
40
+ "encoder.layers.10.attn.qkv.weight": "model-00001-of-00003.safetensors",
41
+ "encoder.layers.10.ls1": "model-00001-of-00003.safetensors",
42
+ "encoder.layers.10.ls2": "model-00001-of-00003.safetensors",
43
+ "encoder.layers.10.mlp.fc1.bias": "model-00001-of-00003.safetensors",
44
+ "encoder.layers.10.mlp.fc1.weight": "model-00001-of-00003.safetensors",
45
+ "encoder.layers.10.mlp.fc2.bias": "model-00001-of-00003.safetensors",
46
+ "encoder.layers.10.mlp.fc2.weight": "model-00001-of-00003.safetensors",
47
+ "encoder.layers.10.norm1.weight": "model-00001-of-00003.safetensors",
48
+ "encoder.layers.10.norm2.weight": "model-00001-of-00003.safetensors",
49
+ "encoder.layers.11.attn.k_norm.weight": "model-00001-of-00003.safetensors",
50
+ "encoder.layers.11.attn.proj.bias": "model-00001-of-00003.safetensors",
51
+ "encoder.layers.11.attn.proj.weight": "model-00001-of-00003.safetensors",
52
+ "encoder.layers.11.attn.q_norm.weight": "model-00001-of-00003.safetensors",
53
+ "encoder.layers.11.attn.qkv.weight": "model-00001-of-00003.safetensors",
54
+ "encoder.layers.11.ls1": "model-00001-of-00003.safetensors",
55
+ "encoder.layers.11.ls2": "model-00001-of-00003.safetensors",
56
+ "encoder.layers.11.mlp.fc1.bias": "model-00001-of-00003.safetensors",
57
+ "encoder.layers.11.mlp.fc1.weight": "model-00001-of-00003.safetensors",
58
+ "encoder.layers.11.mlp.fc2.bias": "model-00001-of-00003.safetensors",
59
+ "encoder.layers.11.mlp.fc2.weight": "model-00001-of-00003.safetensors",
60
+ "encoder.layers.11.norm1.weight": "model-00001-of-00003.safetensors",
61
+ "encoder.layers.11.norm2.weight": "model-00001-of-00003.safetensors",
62
+ "encoder.layers.12.attn.k_norm.weight": "model-00001-of-00003.safetensors",
63
+ "encoder.layers.12.attn.proj.bias": "model-00001-of-00003.safetensors",
64
+ "encoder.layers.12.attn.proj.weight": "model-00001-of-00003.safetensors",
65
+ "encoder.layers.12.attn.q_norm.weight": "model-00001-of-00003.safetensors",
66
+ "encoder.layers.12.attn.qkv.weight": "model-00001-of-00003.safetensors",
67
+ "encoder.layers.12.ls1": "model-00001-of-00003.safetensors",
68
+ "encoder.layers.12.ls2": "model-00001-of-00003.safetensors",
69
+ "encoder.layers.12.mlp.fc1.bias": "model-00001-of-00003.safetensors",
70
+ "encoder.layers.12.mlp.fc1.weight": "model-00001-of-00003.safetensors",
71
+ "encoder.layers.12.mlp.fc2.bias": "model-00001-of-00003.safetensors",
72
+ "encoder.layers.12.mlp.fc2.weight": "model-00001-of-00003.safetensors",
73
+ "encoder.layers.12.norm1.weight": "model-00001-of-00003.safetensors",
74
+ "encoder.layers.12.norm2.weight": "model-00001-of-00003.safetensors",
75
+ "encoder.layers.13.attn.k_norm.weight": "model-00001-of-00003.safetensors",
76
+ "encoder.layers.13.attn.proj.bias": "model-00001-of-00003.safetensors",
77
+ "encoder.layers.13.attn.proj.weight": "model-00001-of-00003.safetensors",
78
+ "encoder.layers.13.attn.q_norm.weight": "model-00001-of-00003.safetensors",
79
+ "encoder.layers.13.attn.qkv.weight": "model-00001-of-00003.safetensors",
80
+ "encoder.layers.13.ls1": "model-00001-of-00003.safetensors",
81
+ "encoder.layers.13.ls2": "model-00001-of-00003.safetensors",
82
+ "encoder.layers.13.mlp.fc1.bias": "model-00001-of-00003.safetensors",
83
+ "encoder.layers.13.mlp.fc1.weight": "model-00001-of-00003.safetensors",
84
+ "encoder.layers.13.mlp.fc2.bias": "model-00001-of-00003.safetensors",
85
+ "encoder.layers.13.mlp.fc2.weight": "model-00001-of-00003.safetensors",
86
+ "encoder.layers.13.norm1.weight": "model-00001-of-00003.safetensors",
87
+ "encoder.layers.13.norm2.weight": "model-00001-of-00003.safetensors",
88
+ "encoder.layers.14.attn.k_norm.weight": "model-00001-of-00003.safetensors",
89
+ "encoder.layers.14.attn.proj.bias": "model-00001-of-00003.safetensors",
90
+ "encoder.layers.14.attn.proj.weight": "model-00001-of-00003.safetensors",
91
+ "encoder.layers.14.attn.q_norm.weight": "model-00001-of-00003.safetensors",
92
+ "encoder.layers.14.attn.qkv.weight": "model-00001-of-00003.safetensors",
93
+ "encoder.layers.14.ls1": "model-00001-of-00003.safetensors",
94
+ "encoder.layers.14.ls2": "model-00001-of-00003.safetensors",
95
+ "encoder.layers.14.mlp.fc1.bias": "model-00001-of-00003.safetensors",
96
+ "encoder.layers.14.mlp.fc1.weight": "model-00001-of-00003.safetensors",
97
+ "encoder.layers.14.mlp.fc2.bias": "model-00001-of-00003.safetensors",
98
+ "encoder.layers.14.mlp.fc2.weight": "model-00001-of-00003.safetensors",
99
+ "encoder.layers.14.norm1.weight": "model-00001-of-00003.safetensors",
100
+ "encoder.layers.14.norm2.weight": "model-00001-of-00003.safetensors",
101
+ "encoder.layers.15.attn.k_norm.weight": "model-00001-of-00003.safetensors",
102
+ "encoder.layers.15.attn.proj.bias": "model-00001-of-00003.safetensors",
103
+ "encoder.layers.15.attn.proj.weight": "model-00001-of-00003.safetensors",
104
+ "encoder.layers.15.attn.q_norm.weight": "model-00001-of-00003.safetensors",
105
+ "encoder.layers.15.attn.qkv.weight": "model-00001-of-00003.safetensors",
106
+ "encoder.layers.15.ls1": "model-00001-of-00003.safetensors",
107
+ "encoder.layers.15.ls2": "model-00001-of-00003.safetensors",
108
+ "encoder.layers.15.mlp.fc1.bias": "model-00001-of-00003.safetensors",
109
+ "encoder.layers.15.mlp.fc1.weight": "model-00001-of-00003.safetensors",
110
+ "encoder.layers.15.mlp.fc2.bias": "model-00001-of-00003.safetensors",
111
+ "encoder.layers.15.mlp.fc2.weight": "model-00001-of-00003.safetensors",
112
+ "encoder.layers.15.norm1.weight": "model-00001-of-00003.safetensors",
113
+ "encoder.layers.15.norm2.weight": "model-00001-of-00003.safetensors",
114
+ "encoder.layers.16.attn.k_norm.weight": "model-00001-of-00003.safetensors",
115
+ "encoder.layers.16.attn.proj.bias": "model-00001-of-00003.safetensors",
116
+ "encoder.layers.16.attn.proj.weight": "model-00001-of-00003.safetensors",
117
+ "encoder.layers.16.attn.q_norm.weight": "model-00001-of-00003.safetensors",
118
+ "encoder.layers.16.attn.qkv.weight": "model-00001-of-00003.safetensors",
119
+ "encoder.layers.16.ls1": "model-00001-of-00003.safetensors",
120
+ "encoder.layers.16.ls2": "model-00001-of-00003.safetensors",
121
+ "encoder.layers.16.mlp.fc1.bias": "model-00001-of-00003.safetensors",
122
+ "encoder.layers.16.mlp.fc1.weight": "model-00001-of-00003.safetensors",
123
+ "encoder.layers.16.mlp.fc2.bias": "model-00001-of-00003.safetensors",
124
+ "encoder.layers.16.mlp.fc2.weight": "model-00001-of-00003.safetensors",
125
+ "encoder.layers.16.norm1.weight": "model-00001-of-00003.safetensors",
126
+ "encoder.layers.16.norm2.weight": "model-00001-of-00003.safetensors",
127
+ "encoder.layers.17.attn.k_norm.weight": "model-00001-of-00003.safetensors",
128
+ "encoder.layers.17.attn.proj.bias": "model-00001-of-00003.safetensors",
129
+ "encoder.layers.17.attn.proj.weight": "model-00001-of-00003.safetensors",
130
+ "encoder.layers.17.attn.q_norm.weight": "model-00001-of-00003.safetensors",
131
+ "encoder.layers.17.attn.qkv.weight": "model-00001-of-00003.safetensors",
132
+ "encoder.layers.17.ls1": "model-00001-of-00003.safetensors",
133
+ "encoder.layers.17.ls2": "model-00001-of-00003.safetensors",
134
+ "encoder.layers.17.mlp.fc1.bias": "model-00001-of-00003.safetensors",
135
+ "encoder.layers.17.mlp.fc1.weight": "model-00001-of-00003.safetensors",
136
+ "encoder.layers.17.mlp.fc2.bias": "model-00001-of-00003.safetensors",
137
+ "encoder.layers.17.mlp.fc2.weight": "model-00001-of-00003.safetensors",
138
+ "encoder.layers.17.norm1.weight": "model-00001-of-00003.safetensors",
139
+ "encoder.layers.17.norm2.weight": "model-00001-of-00003.safetensors",
140
+ "encoder.layers.18.attn.k_norm.weight": "model-00001-of-00003.safetensors",
141
+ "encoder.layers.18.attn.proj.bias": "model-00001-of-00003.safetensors",
142
+ "encoder.layers.18.attn.proj.weight": "model-00001-of-00003.safetensors",
143
+ "encoder.layers.18.attn.q_norm.weight": "model-00001-of-00003.safetensors",
144
+ "encoder.layers.18.attn.qkv.weight": "model-00001-of-00003.safetensors",
145
+ "encoder.layers.18.ls1": "model-00001-of-00003.safetensors",
146
+ "encoder.layers.18.ls2": "model-00001-of-00003.safetensors",
147
+ "encoder.layers.18.mlp.fc1.bias": "model-00001-of-00003.safetensors",
148
+ "encoder.layers.18.mlp.fc1.weight": "model-00001-of-00003.safetensors",
149
+ "encoder.layers.18.mlp.fc2.bias": "model-00001-of-00003.safetensors",
150
+ "encoder.layers.18.mlp.fc2.weight": "model-00001-of-00003.safetensors",
151
+ "encoder.layers.18.norm1.weight": "model-00001-of-00003.safetensors",
152
+ "encoder.layers.18.norm2.weight": "model-00001-of-00003.safetensors",
153
+ "encoder.layers.19.attn.k_norm.weight": "model-00001-of-00003.safetensors",
154
+ "encoder.layers.19.attn.proj.bias": "model-00001-of-00003.safetensors",
155
+ "encoder.layers.19.attn.proj.weight": "model-00001-of-00003.safetensors",
156
+ "encoder.layers.19.attn.q_norm.weight": "model-00001-of-00003.safetensors",
157
+ "encoder.layers.19.attn.qkv.weight": "model-00001-of-00003.safetensors",
158
+ "encoder.layers.19.ls1": "model-00001-of-00003.safetensors",
159
+ "encoder.layers.19.ls2": "model-00001-of-00003.safetensors",
160
+ "encoder.layers.19.mlp.fc1.bias": "model-00001-of-00003.safetensors",
161
+ "encoder.layers.19.mlp.fc1.weight": "model-00001-of-00003.safetensors",
162
+ "encoder.layers.19.mlp.fc2.bias": "model-00001-of-00003.safetensors",
163
+ "encoder.layers.19.mlp.fc2.weight": "model-00001-of-00003.safetensors",
164
+ "encoder.layers.19.norm1.weight": "model-00001-of-00003.safetensors",
165
+ "encoder.layers.19.norm2.weight": "model-00001-of-00003.safetensors",
166
+ "encoder.layers.2.attn.k_norm.weight": "model-00001-of-00003.safetensors",
167
+ "encoder.layers.2.attn.proj.bias": "model-00001-of-00003.safetensors",
168
+ "encoder.layers.2.attn.proj.weight": "model-00001-of-00003.safetensors",
169
+ "encoder.layers.2.attn.q_norm.weight": "model-00001-of-00003.safetensors",
170
+ "encoder.layers.2.attn.qkv.weight": "model-00001-of-00003.safetensors",
171
+ "encoder.layers.2.ls1": "model-00001-of-00003.safetensors",
172
+ "encoder.layers.2.ls2": "model-00001-of-00003.safetensors",
173
+ "encoder.layers.2.mlp.fc1.bias": "model-00001-of-00003.safetensors",
174
+ "encoder.layers.2.mlp.fc1.weight": "model-00001-of-00003.safetensors",
175
+ "encoder.layers.2.mlp.fc2.bias": "model-00001-of-00003.safetensors",
176
+ "encoder.layers.2.mlp.fc2.weight": "model-00001-of-00003.safetensors",
177
+ "encoder.layers.2.norm1.weight": "model-00001-of-00003.safetensors",
178
+ "encoder.layers.2.norm2.weight": "model-00001-of-00003.safetensors",
179
+ "encoder.layers.20.attn.k_norm.weight": "model-00001-of-00003.safetensors",
180
+ "encoder.layers.20.attn.proj.bias": "model-00002-of-00003.safetensors",
181
+ "encoder.layers.20.attn.proj.weight": "model-00002-of-00003.safetensors",
182
+ "encoder.layers.20.attn.q_norm.weight": "model-00001-of-00003.safetensors",
183
+ "encoder.layers.20.attn.qkv.weight": "model-00001-of-00003.safetensors",
184
+ "encoder.layers.20.ls1": "model-00001-of-00003.safetensors",
185
+ "encoder.layers.20.ls2": "model-00001-of-00003.safetensors",
186
+ "encoder.layers.20.mlp.fc1.bias": "model-00002-of-00003.safetensors",
187
+ "encoder.layers.20.mlp.fc1.weight": "model-00002-of-00003.safetensors",
188
+ "encoder.layers.20.mlp.fc2.bias": "model-00002-of-00003.safetensors",
189
+ "encoder.layers.20.mlp.fc2.weight": "model-00002-of-00003.safetensors",
190
+ "encoder.layers.20.norm1.weight": "model-00002-of-00003.safetensors",
191
+ "encoder.layers.20.norm2.weight": "model-00002-of-00003.safetensors",
192
+ "encoder.layers.21.attn.k_norm.weight": "model-00002-of-00003.safetensors",
193
+ "encoder.layers.21.attn.proj.bias": "model-00002-of-00003.safetensors",
194
+ "encoder.layers.21.attn.proj.weight": "model-00002-of-00003.safetensors",
195
+ "encoder.layers.21.attn.q_norm.weight": "model-00002-of-00003.safetensors",
196
+ "encoder.layers.21.attn.qkv.weight": "model-00002-of-00003.safetensors",
197
+ "encoder.layers.21.ls1": "model-00002-of-00003.safetensors",
198
+ "encoder.layers.21.ls2": "model-00002-of-00003.safetensors",
199
+ "encoder.layers.21.mlp.fc1.bias": "model-00002-of-00003.safetensors",
200
+ "encoder.layers.21.mlp.fc1.weight": "model-00002-of-00003.safetensors",
201
+ "encoder.layers.21.mlp.fc2.bias": "model-00002-of-00003.safetensors",
202
+ "encoder.layers.21.mlp.fc2.weight": "model-00002-of-00003.safetensors",
203
+ "encoder.layers.21.norm1.weight": "model-00002-of-00003.safetensors",
204
+ "encoder.layers.21.norm2.weight": "model-00002-of-00003.safetensors",
205
+ "encoder.layers.22.attn.k_norm.weight": "model-00002-of-00003.safetensors",
206
+ "encoder.layers.22.attn.proj.bias": "model-00002-of-00003.safetensors",
207
+ "encoder.layers.22.attn.proj.weight": "model-00002-of-00003.safetensors",
208
+ "encoder.layers.22.attn.q_norm.weight": "model-00002-of-00003.safetensors",
209
+ "encoder.layers.22.attn.qkv.weight": "model-00002-of-00003.safetensors",
210
+ "encoder.layers.22.ls1": "model-00002-of-00003.safetensors",
211
+ "encoder.layers.22.ls2": "model-00002-of-00003.safetensors",
212
+ "encoder.layers.22.mlp.fc1.bias": "model-00002-of-00003.safetensors",
213
+ "encoder.layers.22.mlp.fc1.weight": "model-00002-of-00003.safetensors",
214
+ "encoder.layers.22.mlp.fc2.bias": "model-00002-of-00003.safetensors",
215
+ "encoder.layers.22.mlp.fc2.weight": "model-00002-of-00003.safetensors",
216
+ "encoder.layers.22.norm1.weight": "model-00002-of-00003.safetensors",
217
+ "encoder.layers.22.norm2.weight": "model-00002-of-00003.safetensors",
218
+ "encoder.layers.23.attn.k_norm.weight": "model-00002-of-00003.safetensors",
219
+ "encoder.layers.23.attn.proj.bias": "model-00002-of-00003.safetensors",
220
+ "encoder.layers.23.attn.proj.weight": "model-00002-of-00003.safetensors",
221
+ "encoder.layers.23.attn.q_norm.weight": "model-00002-of-00003.safetensors",
222
+ "encoder.layers.23.attn.qkv.weight": "model-00002-of-00003.safetensors",
223
+ "encoder.layers.23.ls1": "model-00002-of-00003.safetensors",
224
+ "encoder.layers.23.ls2": "model-00002-of-00003.safetensors",
225
+ "encoder.layers.23.mlp.fc1.bias": "model-00002-of-00003.safetensors",
226
+ "encoder.layers.23.mlp.fc1.weight": "model-00002-of-00003.safetensors",
227
+ "encoder.layers.23.mlp.fc2.bias": "model-00002-of-00003.safetensors",
228
+ "encoder.layers.23.mlp.fc2.weight": "model-00002-of-00003.safetensors",
229
+ "encoder.layers.23.norm1.weight": "model-00002-of-00003.safetensors",
230
+ "encoder.layers.23.norm2.weight": "model-00002-of-00003.safetensors",
231
+ "encoder.layers.24.attn.k_norm.weight": "model-00002-of-00003.safetensors",
232
+ "encoder.layers.24.attn.proj.bias": "model-00002-of-00003.safetensors",
233
+ "encoder.layers.24.attn.proj.weight": "model-00002-of-00003.safetensors",
234
+ "encoder.layers.24.attn.q_norm.weight": "model-00002-of-00003.safetensors",
235
+ "encoder.layers.24.attn.qkv.weight": "model-00002-of-00003.safetensors",
236
+ "encoder.layers.24.ls1": "model-00002-of-00003.safetensors",
237
+ "encoder.layers.24.ls2": "model-00002-of-00003.safetensors",
238
+ "encoder.layers.24.mlp.fc1.bias": "model-00002-of-00003.safetensors",
239
+ "encoder.layers.24.mlp.fc1.weight": "model-00002-of-00003.safetensors",
240
+ "encoder.layers.24.mlp.fc2.bias": "model-00002-of-00003.safetensors",
241
+ "encoder.layers.24.mlp.fc2.weight": "model-00002-of-00003.safetensors",
242
+ "encoder.layers.24.norm1.weight": "model-00002-of-00003.safetensors",
243
+ "encoder.layers.24.norm2.weight": "model-00002-of-00003.safetensors",
244
+ "encoder.layers.25.attn.k_norm.weight": "model-00002-of-00003.safetensors",
245
+ "encoder.layers.25.attn.proj.bias": "model-00002-of-00003.safetensors",
246
+ "encoder.layers.25.attn.proj.weight": "model-00002-of-00003.safetensors",
247
+ "encoder.layers.25.attn.q_norm.weight": "model-00002-of-00003.safetensors",
248
+ "encoder.layers.25.attn.qkv.weight": "model-00002-of-00003.safetensors",
249
+ "encoder.layers.25.ls1": "model-00002-of-00003.safetensors",
250
+ "encoder.layers.25.ls2": "model-00002-of-00003.safetensors",
251
+ "encoder.layers.25.mlp.fc1.bias": "model-00002-of-00003.safetensors",
252
+ "encoder.layers.25.mlp.fc1.weight": "model-00002-of-00003.safetensors",
253
+ "encoder.layers.25.mlp.fc2.bias": "model-00002-of-00003.safetensors",
254
+ "encoder.layers.25.mlp.fc2.weight": "model-00002-of-00003.safetensors",
255
+ "encoder.layers.25.norm1.weight": "model-00002-of-00003.safetensors",
256
+ "encoder.layers.25.norm2.weight": "model-00002-of-00003.safetensors",
257
+ "encoder.layers.26.attn.k_norm.weight": "model-00002-of-00003.safetensors",
258
+ "encoder.layers.26.attn.proj.bias": "model-00002-of-00003.safetensors",
259
+ "encoder.layers.26.attn.proj.weight": "model-00002-of-00003.safetensors",
260
+ "encoder.layers.26.attn.q_norm.weight": "model-00002-of-00003.safetensors",
261
+ "encoder.layers.26.attn.qkv.weight": "model-00002-of-00003.safetensors",
262
+ "encoder.layers.26.ls1": "model-00002-of-00003.safetensors",
263
+ "encoder.layers.26.ls2": "model-00002-of-00003.safetensors",
264
+ "encoder.layers.26.mlp.fc1.bias": "model-00002-of-00003.safetensors",
265
+ "encoder.layers.26.mlp.fc1.weight": "model-00002-of-00003.safetensors",
266
+ "encoder.layers.26.mlp.fc2.bias": "model-00002-of-00003.safetensors",
267
+ "encoder.layers.26.mlp.fc2.weight": "model-00002-of-00003.safetensors",
268
+ "encoder.layers.26.norm1.weight": "model-00002-of-00003.safetensors",
269
+ "encoder.layers.26.norm2.weight": "model-00002-of-00003.safetensors",
270
+ "encoder.layers.27.attn.k_norm.weight": "model-00002-of-00003.safetensors",
271
+ "encoder.layers.27.attn.proj.bias": "model-00002-of-00003.safetensors",
272
+ "encoder.layers.27.attn.proj.weight": "model-00002-of-00003.safetensors",
273
+ "encoder.layers.27.attn.q_norm.weight": "model-00002-of-00003.safetensors",
274
+ "encoder.layers.27.attn.qkv.weight": "model-00002-of-00003.safetensors",
275
+ "encoder.layers.27.ls1": "model-00002-of-00003.safetensors",
276
+ "encoder.layers.27.ls2": "model-00002-of-00003.safetensors",
277
+ "encoder.layers.27.mlp.fc1.bias": "model-00002-of-00003.safetensors",
278
+ "encoder.layers.27.mlp.fc1.weight": "model-00002-of-00003.safetensors",
279
+ "encoder.layers.27.mlp.fc2.bias": "model-00002-of-00003.safetensors",
280
+ "encoder.layers.27.mlp.fc2.weight": "model-00002-of-00003.safetensors",
281
+ "encoder.layers.27.norm1.weight": "model-00002-of-00003.safetensors",
282
+ "encoder.layers.27.norm2.weight": "model-00002-of-00003.safetensors",
283
+ "encoder.layers.28.attn.k_norm.weight": "model-00002-of-00003.safetensors",
284
+ "encoder.layers.28.attn.proj.bias": "model-00002-of-00003.safetensors",
285
+ "encoder.layers.28.attn.proj.weight": "model-00002-of-00003.safetensors",
286
+ "encoder.layers.28.attn.q_norm.weight": "model-00002-of-00003.safetensors",
287
+ "encoder.layers.28.attn.qkv.weight": "model-00002-of-00003.safetensors",
288
+ "encoder.layers.28.ls1": "model-00002-of-00003.safetensors",
289
+ "encoder.layers.28.ls2": "model-00002-of-00003.safetensors",
290
+ "encoder.layers.28.mlp.fc1.bias": "model-00002-of-00003.safetensors",
291
+ "encoder.layers.28.mlp.fc1.weight": "model-00002-of-00003.safetensors",
292
+ "encoder.layers.28.mlp.fc2.bias": "model-00002-of-00003.safetensors",
293
+ "encoder.layers.28.mlp.fc2.weight": "model-00002-of-00003.safetensors",
294
+ "encoder.layers.28.norm1.weight": "model-00002-of-00003.safetensors",
295
+ "encoder.layers.28.norm2.weight": "model-00002-of-00003.safetensors",
296
+ "encoder.layers.29.attn.k_norm.weight": "model-00002-of-00003.safetensors",
297
+ "encoder.layers.29.attn.proj.bias": "model-00002-of-00003.safetensors",
298
+ "encoder.layers.29.attn.proj.weight": "model-00002-of-00003.safetensors",
299
+ "encoder.layers.29.attn.q_norm.weight": "model-00002-of-00003.safetensors",
300
+ "encoder.layers.29.attn.qkv.weight": "model-00002-of-00003.safetensors",
301
+ "encoder.layers.29.ls1": "model-00002-of-00003.safetensors",
302
+ "encoder.layers.29.ls2": "model-00002-of-00003.safetensors",
303
+ "encoder.layers.29.mlp.fc1.bias": "model-00002-of-00003.safetensors",
304
+ "encoder.layers.29.mlp.fc1.weight": "model-00002-of-00003.safetensors",
305
+ "encoder.layers.29.mlp.fc2.bias": "model-00002-of-00003.safetensors",
306
+ "encoder.layers.29.mlp.fc2.weight": "model-00002-of-00003.safetensors",
307
+ "encoder.layers.29.norm1.weight": "model-00002-of-00003.safetensors",
308
+ "encoder.layers.29.norm2.weight": "model-00002-of-00003.safetensors",
309
+ "encoder.layers.3.attn.k_norm.weight": "model-00001-of-00003.safetensors",
310
+ "encoder.layers.3.attn.proj.bias": "model-00001-of-00003.safetensors",
311
+ "encoder.layers.3.attn.proj.weight": "model-00001-of-00003.safetensors",
312
+ "encoder.layers.3.attn.q_norm.weight": "model-00001-of-00003.safetensors",
313
+ "encoder.layers.3.attn.qkv.weight": "model-00001-of-00003.safetensors",
314
+ "encoder.layers.3.ls1": "model-00001-of-00003.safetensors",
315
+ "encoder.layers.3.ls2": "model-00001-of-00003.safetensors",
316
+ "encoder.layers.3.mlp.fc1.bias": "model-00001-of-00003.safetensors",
317
+ "encoder.layers.3.mlp.fc1.weight": "model-00001-of-00003.safetensors",
318
+ "encoder.layers.3.mlp.fc2.bias": "model-00001-of-00003.safetensors",
319
+ "encoder.layers.3.mlp.fc2.weight": "model-00001-of-00003.safetensors",
320
+ "encoder.layers.3.norm1.weight": "model-00001-of-00003.safetensors",
321
+ "encoder.layers.3.norm2.weight": "model-00001-of-00003.safetensors",
322
+ "encoder.layers.30.attn.k_norm.weight": "model-00002-of-00003.safetensors",
323
+ "encoder.layers.30.attn.proj.bias": "model-00002-of-00003.safetensors",
324
+ "encoder.layers.30.attn.proj.weight": "model-00002-of-00003.safetensors",
325
+ "encoder.layers.30.attn.q_norm.weight": "model-00002-of-00003.safetensors",
326
+ "encoder.layers.30.attn.qkv.weight": "model-00002-of-00003.safetensors",
327
+ "encoder.layers.30.ls1": "model-00002-of-00003.safetensors",
328
+ "encoder.layers.30.ls2": "model-00002-of-00003.safetensors",
329
+ "encoder.layers.30.mlp.fc1.bias": "model-00002-of-00003.safetensors",
330
+ "encoder.layers.30.mlp.fc1.weight": "model-00002-of-00003.safetensors",
331
+ "encoder.layers.30.mlp.fc2.bias": "model-00002-of-00003.safetensors",
332
+ "encoder.layers.30.mlp.fc2.weight": "model-00002-of-00003.safetensors",
333
+ "encoder.layers.30.norm1.weight": "model-00002-of-00003.safetensors",
334
+ "encoder.layers.30.norm2.weight": "model-00002-of-00003.safetensors",
335
+ "encoder.layers.31.attn.k_norm.weight": "model-00002-of-00003.safetensors",
336
+ "encoder.layers.31.attn.proj.bias": "model-00002-of-00003.safetensors",
337
+ "encoder.layers.31.attn.proj.weight": "model-00002-of-00003.safetensors",
338
+ "encoder.layers.31.attn.q_norm.weight": "model-00002-of-00003.safetensors",
339
+ "encoder.layers.31.attn.qkv.weight": "model-00002-of-00003.safetensors",
340
+ "encoder.layers.31.ls1": "model-00002-of-00003.safetensors",
341
+ "encoder.layers.31.ls2": "model-00002-of-00003.safetensors",
342
+ "encoder.layers.31.mlp.fc1.bias": "model-00002-of-00003.safetensors",
343
+ "encoder.layers.31.mlp.fc1.weight": "model-00002-of-00003.safetensors",
344
+ "encoder.layers.31.mlp.fc2.bias": "model-00002-of-00003.safetensors",
345
+ "encoder.layers.31.mlp.fc2.weight": "model-00002-of-00003.safetensors",
346
+ "encoder.layers.31.norm1.weight": "model-00002-of-00003.safetensors",
347
+ "encoder.layers.31.norm2.weight": "model-00002-of-00003.safetensors",
348
+ "encoder.layers.32.attn.k_norm.weight": "model-00002-of-00003.safetensors",
349
+ "encoder.layers.32.attn.proj.bias": "model-00002-of-00003.safetensors",
350
+ "encoder.layers.32.attn.proj.weight": "model-00002-of-00003.safetensors",
351
+ "encoder.layers.32.attn.q_norm.weight": "model-00002-of-00003.safetensors",
352
+ "encoder.layers.32.attn.qkv.weight": "model-00002-of-00003.safetensors",
353
+ "encoder.layers.32.ls1": "model-00002-of-00003.safetensors",
354
+ "encoder.layers.32.ls2": "model-00002-of-00003.safetensors",
355
+ "encoder.layers.32.mlp.fc1.bias": "model-00002-of-00003.safetensors",
356
+ "encoder.layers.32.mlp.fc1.weight": "model-00002-of-00003.safetensors",
357
+ "encoder.layers.32.mlp.fc2.bias": "model-00002-of-00003.safetensors",
358
+ "encoder.layers.32.mlp.fc2.weight": "model-00002-of-00003.safetensors",
359
+ "encoder.layers.32.norm1.weight": "model-00002-of-00003.safetensors",
360
+ "encoder.layers.32.norm2.weight": "model-00002-of-00003.safetensors",
361
+ "encoder.layers.33.attn.k_norm.weight": "model-00002-of-00003.safetensors",
362
+ "encoder.layers.33.attn.proj.bias": "model-00002-of-00003.safetensors",
363
+ "encoder.layers.33.attn.proj.weight": "model-00002-of-00003.safetensors",
364
+ "encoder.layers.33.attn.q_norm.weight": "model-00002-of-00003.safetensors",
365
+ "encoder.layers.33.attn.qkv.weight": "model-00002-of-00003.safetensors",
366
+ "encoder.layers.33.ls1": "model-00002-of-00003.safetensors",
367
+ "encoder.layers.33.ls2": "model-00002-of-00003.safetensors",
368
+ "encoder.layers.33.mlp.fc1.bias": "model-00002-of-00003.safetensors",
369
+ "encoder.layers.33.mlp.fc1.weight": "model-00002-of-00003.safetensors",
370
+ "encoder.layers.33.mlp.fc2.bias": "model-00002-of-00003.safetensors",
371
+ "encoder.layers.33.mlp.fc2.weight": "model-00002-of-00003.safetensors",
372
+ "encoder.layers.33.norm1.weight": "model-00002-of-00003.safetensors",
373
+ "encoder.layers.33.norm2.weight": "model-00002-of-00003.safetensors",
374
+ "encoder.layers.34.attn.k_norm.weight": "model-00002-of-00003.safetensors",
375
+ "encoder.layers.34.attn.proj.bias": "model-00002-of-00003.safetensors",
376
+ "encoder.layers.34.attn.proj.weight": "model-00002-of-00003.safetensors",
377
+ "encoder.layers.34.attn.q_norm.weight": "model-00002-of-00003.safetensors",
378
+ "encoder.layers.34.attn.qkv.weight": "model-00002-of-00003.safetensors",
379
+ "encoder.layers.34.ls1": "model-00002-of-00003.safetensors",
380
+ "encoder.layers.34.ls2": "model-00002-of-00003.safetensors",
381
+ "encoder.layers.34.mlp.fc1.bias": "model-00002-of-00003.safetensors",
382
+ "encoder.layers.34.mlp.fc1.weight": "model-00002-of-00003.safetensors",
383
+ "encoder.layers.34.mlp.fc2.bias": "model-00002-of-00003.safetensors",
384
+ "encoder.layers.34.mlp.fc2.weight": "model-00002-of-00003.safetensors",
385
+ "encoder.layers.34.norm1.weight": "model-00002-of-00003.safetensors",
386
+ "encoder.layers.34.norm2.weight": "model-00002-of-00003.safetensors",
387
+ "encoder.layers.35.attn.k_norm.weight": "model-00002-of-00003.safetensors",
388
+ "encoder.layers.35.attn.proj.bias": "model-00002-of-00003.safetensors",
389
+ "encoder.layers.35.attn.proj.weight": "model-00002-of-00003.safetensors",
390
+ "encoder.layers.35.attn.q_norm.weight": "model-00002-of-00003.safetensors",
391
+ "encoder.layers.35.attn.qkv.weight": "model-00002-of-00003.safetensors",
392
+ "encoder.layers.35.ls1": "model-00002-of-00003.safetensors",
393
+ "encoder.layers.35.ls2": "model-00002-of-00003.safetensors",
394
+ "encoder.layers.35.mlp.fc1.bias": "model-00002-of-00003.safetensors",
395
+ "encoder.layers.35.mlp.fc1.weight": "model-00002-of-00003.safetensors",
396
+ "encoder.layers.35.mlp.fc2.bias": "model-00002-of-00003.safetensors",
397
+ "encoder.layers.35.mlp.fc2.weight": "model-00002-of-00003.safetensors",
398
+ "encoder.layers.35.norm1.weight": "model-00002-of-00003.safetensors",
399
+ "encoder.layers.35.norm2.weight": "model-00002-of-00003.safetensors",
400
+ "encoder.layers.36.attn.k_norm.weight": "model-00002-of-00003.safetensors",
401
+ "encoder.layers.36.attn.proj.bias": "model-00002-of-00003.safetensors",
402
+ "encoder.layers.36.attn.proj.weight": "model-00002-of-00003.safetensors",
403
+ "encoder.layers.36.attn.q_norm.weight": "model-00002-of-00003.safetensors",
404
+ "encoder.layers.36.attn.qkv.weight": "model-00002-of-00003.safetensors",
405
+ "encoder.layers.36.ls1": "model-00002-of-00003.safetensors",
406
+ "encoder.layers.36.ls2": "model-00002-of-00003.safetensors",
407
+ "encoder.layers.36.mlp.fc1.bias": "model-00002-of-00003.safetensors",
408
+ "encoder.layers.36.mlp.fc1.weight": "model-00002-of-00003.safetensors",
409
+ "encoder.layers.36.mlp.fc2.bias": "model-00002-of-00003.safetensors",
410
+ "encoder.layers.36.mlp.fc2.weight": "model-00002-of-00003.safetensors",
411
+ "encoder.layers.36.norm1.weight": "model-00002-of-00003.safetensors",
412
+ "encoder.layers.36.norm2.weight": "model-00002-of-00003.safetensors",
413
+ "encoder.layers.37.attn.k_norm.weight": "model-00002-of-00003.safetensors",
414
+ "encoder.layers.37.attn.proj.bias": "model-00002-of-00003.safetensors",
415
+ "encoder.layers.37.attn.proj.weight": "model-00002-of-00003.safetensors",
416
+ "encoder.layers.37.attn.q_norm.weight": "model-00002-of-00003.safetensors",
417
+ "encoder.layers.37.attn.qkv.weight": "model-00002-of-00003.safetensors",
418
+ "encoder.layers.37.ls1": "model-00002-of-00003.safetensors",
419
+ "encoder.layers.37.ls2": "model-00002-of-00003.safetensors",
420
+ "encoder.layers.37.mlp.fc1.bias": "model-00002-of-00003.safetensors",
421
+ "encoder.layers.37.mlp.fc1.weight": "model-00002-of-00003.safetensors",
422
+ "encoder.layers.37.mlp.fc2.bias": "model-00002-of-00003.safetensors",
423
+ "encoder.layers.37.mlp.fc2.weight": "model-00002-of-00003.safetensors",
424
+ "encoder.layers.37.norm1.weight": "model-00002-of-00003.safetensors",
425
+ "encoder.layers.37.norm2.weight": "model-00002-of-00003.safetensors",
426
+ "encoder.layers.38.attn.k_norm.weight": "model-00002-of-00003.safetensors",
427
+ "encoder.layers.38.attn.proj.bias": "model-00002-of-00003.safetensors",
428
+ "encoder.layers.38.attn.proj.weight": "model-00002-of-00003.safetensors",
429
+ "encoder.layers.38.attn.q_norm.weight": "model-00002-of-00003.safetensors",
430
+ "encoder.layers.38.attn.qkv.weight": "model-00002-of-00003.safetensors",
431
+ "encoder.layers.38.ls1": "model-00002-of-00003.safetensors",
432
+ "encoder.layers.38.ls2": "model-00002-of-00003.safetensors",
433
+ "encoder.layers.38.mlp.fc1.bias": "model-00002-of-00003.safetensors",
434
+ "encoder.layers.38.mlp.fc1.weight": "model-00002-of-00003.safetensors",
435
+ "encoder.layers.38.mlp.fc2.bias": "model-00002-of-00003.safetensors",
436
+ "encoder.layers.38.mlp.fc2.weight": "model-00002-of-00003.safetensors",
437
+ "encoder.layers.38.norm1.weight": "model-00002-of-00003.safetensors",
438
+ "encoder.layers.38.norm2.weight": "model-00002-of-00003.safetensors",
439
+ "encoder.layers.39.attn.k_norm.weight": "model-00002-of-00003.safetensors",
440
+ "encoder.layers.39.attn.proj.bias": "model-00002-of-00003.safetensors",
441
+ "encoder.layers.39.attn.proj.weight": "model-00002-of-00003.safetensors",
442
+ "encoder.layers.39.attn.q_norm.weight": "model-00002-of-00003.safetensors",
443
+ "encoder.layers.39.attn.qkv.weight": "model-00002-of-00003.safetensors",
444
+ "encoder.layers.39.ls1": "model-00002-of-00003.safetensors",
445
+ "encoder.layers.39.ls2": "model-00002-of-00003.safetensors",
446
+ "encoder.layers.39.mlp.fc1.bias": "model-00002-of-00003.safetensors",
447
+ "encoder.layers.39.mlp.fc1.weight": "model-00002-of-00003.safetensors",
448
+ "encoder.layers.39.mlp.fc2.bias": "model-00002-of-00003.safetensors",
449
+ "encoder.layers.39.mlp.fc2.weight": "model-00002-of-00003.safetensors",
450
+ "encoder.layers.39.norm1.weight": "model-00002-of-00003.safetensors",
451
+ "encoder.layers.39.norm2.weight": "model-00002-of-00003.safetensors",
452
+ "encoder.layers.4.attn.k_norm.weight": "model-00001-of-00003.safetensors",
453
+ "encoder.layers.4.attn.proj.bias": "model-00001-of-00003.safetensors",
454
+ "encoder.layers.4.attn.proj.weight": "model-00001-of-00003.safetensors",
455
+ "encoder.layers.4.attn.q_norm.weight": "model-00001-of-00003.safetensors",
456
+ "encoder.layers.4.attn.qkv.weight": "model-00001-of-00003.safetensors",
457
+ "encoder.layers.4.ls1": "model-00001-of-00003.safetensors",
458
+ "encoder.layers.4.ls2": "model-00001-of-00003.safetensors",
459
+ "encoder.layers.4.mlp.fc1.bias": "model-00001-of-00003.safetensors",
460
+ "encoder.layers.4.mlp.fc1.weight": "model-00001-of-00003.safetensors",
461
+ "encoder.layers.4.mlp.fc2.bias": "model-00001-of-00003.safetensors",
462
+ "encoder.layers.4.mlp.fc2.weight": "model-00001-of-00003.safetensors",
463
+ "encoder.layers.4.norm1.weight": "model-00001-of-00003.safetensors",
464
+ "encoder.layers.4.norm2.weight": "model-00001-of-00003.safetensors",
465
+ "encoder.layers.40.attn.k_norm.weight": "model-00002-of-00003.safetensors",
466
+ "encoder.layers.40.attn.proj.bias": "model-00002-of-00003.safetensors",
467
+ "encoder.layers.40.attn.proj.weight": "model-00002-of-00003.safetensors",
468
+ "encoder.layers.40.attn.q_norm.weight": "model-00002-of-00003.safetensors",
469
+ "encoder.layers.40.attn.qkv.weight": "model-00002-of-00003.safetensors",
470
+ "encoder.layers.40.ls1": "model-00002-of-00003.safetensors",
471
+ "encoder.layers.40.ls2": "model-00002-of-00003.safetensors",
472
+ "encoder.layers.40.mlp.fc1.bias": "model-00003-of-00003.safetensors",
473
+ "encoder.layers.40.mlp.fc1.weight": "model-00003-of-00003.safetensors",
474
+ "encoder.layers.40.mlp.fc2.bias": "model-00003-of-00003.safetensors",
475
+ "encoder.layers.40.mlp.fc2.weight": "model-00003-of-00003.safetensors",
476
+ "encoder.layers.40.norm1.weight": "model-00003-of-00003.safetensors",
477
+ "encoder.layers.40.norm2.weight": "model-00003-of-00003.safetensors",
478
+ "encoder.layers.41.attn.k_norm.weight": "model-00003-of-00003.safetensors",
479
+ "encoder.layers.41.attn.proj.bias": "model-00003-of-00003.safetensors",
480
+ "encoder.layers.41.attn.proj.weight": "model-00003-of-00003.safetensors",
481
+ "encoder.layers.41.attn.q_norm.weight": "model-00003-of-00003.safetensors",
482
+ "encoder.layers.41.attn.qkv.weight": "model-00003-of-00003.safetensors",
483
+ "encoder.layers.41.ls1": "model-00003-of-00003.safetensors",
484
+ "encoder.layers.41.ls2": "model-00003-of-00003.safetensors",
485
+ "encoder.layers.41.mlp.fc1.bias": "model-00003-of-00003.safetensors",
486
+ "encoder.layers.41.mlp.fc1.weight": "model-00003-of-00003.safetensors",
487
+ "encoder.layers.41.mlp.fc2.bias": "model-00003-of-00003.safetensors",
488
+ "encoder.layers.41.mlp.fc2.weight": "model-00003-of-00003.safetensors",
489
+ "encoder.layers.41.norm1.weight": "model-00003-of-00003.safetensors",
490
+ "encoder.layers.41.norm2.weight": "model-00003-of-00003.safetensors",
491
+ "encoder.layers.42.attn.k_norm.weight": "model-00003-of-00003.safetensors",
492
+ "encoder.layers.42.attn.proj.bias": "model-00003-of-00003.safetensors",
493
+ "encoder.layers.42.attn.proj.weight": "model-00003-of-00003.safetensors",
494
+ "encoder.layers.42.attn.q_norm.weight": "model-00003-of-00003.safetensors",
495
+ "encoder.layers.42.attn.qkv.weight": "model-00003-of-00003.safetensors",
496
+ "encoder.layers.42.ls1": "model-00003-of-00003.safetensors",
497
+ "encoder.layers.42.ls2": "model-00003-of-00003.safetensors",
498
+ "encoder.layers.42.mlp.fc1.bias": "model-00003-of-00003.safetensors",
499
+ "encoder.layers.42.mlp.fc1.weight": "model-00003-of-00003.safetensors",
500
+ "encoder.layers.42.mlp.fc2.bias": "model-00003-of-00003.safetensors",
501
+ "encoder.layers.42.mlp.fc2.weight": "model-00003-of-00003.safetensors",
502
+ "encoder.layers.42.norm1.weight": "model-00003-of-00003.safetensors",
503
+ "encoder.layers.42.norm2.weight": "model-00003-of-00003.safetensors",
504
+ "encoder.layers.43.attn.k_norm.weight": "model-00003-of-00003.safetensors",
505
+ "encoder.layers.43.attn.proj.bias": "model-00003-of-00003.safetensors",
506
+ "encoder.layers.43.attn.proj.weight": "model-00003-of-00003.safetensors",
507
+ "encoder.layers.43.attn.q_norm.weight": "model-00003-of-00003.safetensors",
508
+ "encoder.layers.43.attn.qkv.weight": "model-00003-of-00003.safetensors",
509
+ "encoder.layers.43.ls1": "model-00003-of-00003.safetensors",
510
+ "encoder.layers.43.ls2": "model-00003-of-00003.safetensors",
511
+ "encoder.layers.43.mlp.fc1.bias": "model-00003-of-00003.safetensors",
512
+ "encoder.layers.43.mlp.fc1.weight": "model-00003-of-00003.safetensors",
513
+ "encoder.layers.43.mlp.fc2.bias": "model-00003-of-00003.safetensors",
514
+ "encoder.layers.43.mlp.fc2.weight": "model-00003-of-00003.safetensors",
515
+ "encoder.layers.43.norm1.weight": "model-00003-of-00003.safetensors",
516
+ "encoder.layers.43.norm2.weight": "model-00003-of-00003.safetensors",
517
+ "encoder.layers.44.attn.k_norm.weight": "model-00003-of-00003.safetensors",
518
+ "encoder.layers.44.attn.proj.bias": "model-00003-of-00003.safetensors",
519
+ "encoder.layers.44.attn.proj.weight": "model-00003-of-00003.safetensors",
520
+ "encoder.layers.44.attn.q_norm.weight": "model-00003-of-00003.safetensors",
521
+ "encoder.layers.44.attn.qkv.weight": "model-00003-of-00003.safetensors",
522
+ "encoder.layers.44.ls1": "model-00003-of-00003.safetensors",
523
+ "encoder.layers.44.ls2": "model-00003-of-00003.safetensors",
524
+ "encoder.layers.44.mlp.fc1.bias": "model-00003-of-00003.safetensors",
525
+ "encoder.layers.44.mlp.fc1.weight": "model-00003-of-00003.safetensors",
526
+ "encoder.layers.44.mlp.fc2.bias": "model-00003-of-00003.safetensors",
527
+ "encoder.layers.44.mlp.fc2.weight": "model-00003-of-00003.safetensors",
528
+ "encoder.layers.44.norm1.weight": "model-00003-of-00003.safetensors",
529
+ "encoder.layers.44.norm2.weight": "model-00003-of-00003.safetensors",
530
+ "encoder.layers.5.attn.k_norm.weight": "model-00001-of-00003.safetensors",
531
+ "encoder.layers.5.attn.proj.bias": "model-00001-of-00003.safetensors",
532
+ "encoder.layers.5.attn.proj.weight": "model-00001-of-00003.safetensors",
533
+ "encoder.layers.5.attn.q_norm.weight": "model-00001-of-00003.safetensors",
534
+ "encoder.layers.5.attn.qkv.weight": "model-00001-of-00003.safetensors",
535
+ "encoder.layers.5.ls1": "model-00001-of-00003.safetensors",
536
+ "encoder.layers.5.ls2": "model-00001-of-00003.safetensors",
537
+ "encoder.layers.5.mlp.fc1.bias": "model-00001-of-00003.safetensors",
538
+ "encoder.layers.5.mlp.fc1.weight": "model-00001-of-00003.safetensors",
539
+ "encoder.layers.5.mlp.fc2.bias": "model-00001-of-00003.safetensors",
540
+ "encoder.layers.5.mlp.fc2.weight": "model-00001-of-00003.safetensors",
541
+ "encoder.layers.5.norm1.weight": "model-00001-of-00003.safetensors",
542
+ "encoder.layers.5.norm2.weight": "model-00001-of-00003.safetensors",
543
+ "encoder.layers.6.attn.k_norm.weight": "model-00001-of-00003.safetensors",
544
+ "encoder.layers.6.attn.proj.bias": "model-00001-of-00003.safetensors",
545
+ "encoder.layers.6.attn.proj.weight": "model-00001-of-00003.safetensors",
546
+ "encoder.layers.6.attn.q_norm.weight": "model-00001-of-00003.safetensors",
547
+ "encoder.layers.6.attn.qkv.weight": "model-00001-of-00003.safetensors",
548
+ "encoder.layers.6.ls1": "model-00001-of-00003.safetensors",
549
+ "encoder.layers.6.ls2": "model-00001-of-00003.safetensors",
550
+ "encoder.layers.6.mlp.fc1.bias": "model-00001-of-00003.safetensors",
551
+ "encoder.layers.6.mlp.fc1.weight": "model-00001-of-00003.safetensors",
552
+ "encoder.layers.6.mlp.fc2.bias": "model-00001-of-00003.safetensors",
553
+ "encoder.layers.6.mlp.fc2.weight": "model-00001-of-00003.safetensors",
554
+ "encoder.layers.6.norm1.weight": "model-00001-of-00003.safetensors",
555
+ "encoder.layers.6.norm2.weight": "model-00001-of-00003.safetensors",
556
+ "encoder.layers.7.attn.k_norm.weight": "model-00001-of-00003.safetensors",
557
+ "encoder.layers.7.attn.proj.bias": "model-00001-of-00003.safetensors",
558
+ "encoder.layers.7.attn.proj.weight": "model-00001-of-00003.safetensors",
559
+ "encoder.layers.7.attn.q_norm.weight": "model-00001-of-00003.safetensors",
560
+ "encoder.layers.7.attn.qkv.weight": "model-00001-of-00003.safetensors",
561
+ "encoder.layers.7.ls1": "model-00001-of-00003.safetensors",
562
+ "encoder.layers.7.ls2": "model-00001-of-00003.safetensors",
563
+ "encoder.layers.7.mlp.fc1.bias": "model-00001-of-00003.safetensors",
564
+ "encoder.layers.7.mlp.fc1.weight": "model-00001-of-00003.safetensors",
565
+ "encoder.layers.7.mlp.fc2.bias": "model-00001-of-00003.safetensors",
566
+ "encoder.layers.7.mlp.fc2.weight": "model-00001-of-00003.safetensors",
567
+ "encoder.layers.7.norm1.weight": "model-00001-of-00003.safetensors",
568
+ "encoder.layers.7.norm2.weight": "model-00001-of-00003.safetensors",
569
+ "encoder.layers.8.attn.k_norm.weight": "model-00001-of-00003.safetensors",
570
+ "encoder.layers.8.attn.proj.bias": "model-00001-of-00003.safetensors",
571
+ "encoder.layers.8.attn.proj.weight": "model-00001-of-00003.safetensors",
572
+ "encoder.layers.8.attn.q_norm.weight": "model-00001-of-00003.safetensors",
573
+ "encoder.layers.8.attn.qkv.weight": "model-00001-of-00003.safetensors",
574
+ "encoder.layers.8.ls1": "model-00001-of-00003.safetensors",
575
+ "encoder.layers.8.ls2": "model-00001-of-00003.safetensors",
576
+ "encoder.layers.8.mlp.fc1.bias": "model-00001-of-00003.safetensors",
577
+ "encoder.layers.8.mlp.fc1.weight": "model-00001-of-00003.safetensors",
578
+ "encoder.layers.8.mlp.fc2.bias": "model-00001-of-00003.safetensors",
579
+ "encoder.layers.8.mlp.fc2.weight": "model-00001-of-00003.safetensors",
580
+ "encoder.layers.8.norm1.weight": "model-00001-of-00003.safetensors",
581
+ "encoder.layers.8.norm2.weight": "model-00001-of-00003.safetensors",
582
+ "encoder.layers.9.attn.k_norm.weight": "model-00001-of-00003.safetensors",
583
+ "encoder.layers.9.attn.proj.bias": "model-00001-of-00003.safetensors",
584
+ "encoder.layers.9.attn.proj.weight": "model-00001-of-00003.safetensors",
585
+ "encoder.layers.9.attn.q_norm.weight": "model-00001-of-00003.safetensors",
586
+ "encoder.layers.9.attn.qkv.weight": "model-00001-of-00003.safetensors",
587
+ "encoder.layers.9.ls1": "model-00001-of-00003.safetensors",
588
+ "encoder.layers.9.ls2": "model-00001-of-00003.safetensors",
589
+ "encoder.layers.9.mlp.fc1.bias": "model-00001-of-00003.safetensors",
590
+ "encoder.layers.9.mlp.fc1.weight": "model-00001-of-00003.safetensors",
591
+ "encoder.layers.9.mlp.fc2.bias": "model-00001-of-00003.safetensors",
592
+ "encoder.layers.9.mlp.fc2.weight": "model-00001-of-00003.safetensors",
593
+ "encoder.layers.9.norm1.weight": "model-00001-of-00003.safetensors",
594
+ "encoder.layers.9.norm2.weight": "model-00001-of-00003.safetensors"
595
+ }
596
+ }
modeling_intern_vit.py ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --------------------------------------------------------
2
+ # InternVL
3
+ # Copyright (c) 2023 OpenGVLab
4
+ # Licensed under The MIT License [see LICENSE for details]
5
+ # --------------------------------------------------------
6
+ from typing import Optional, Tuple, Union
7
+
8
+ import torch
9
+ import torch.nn.functional as F
10
+ import torch.utils.checkpoint
11
+ from einops import rearrange
12
+ from timm.models.layers import DropPath
13
+ from torch import nn
14
+ from transformers.activations import ACT2FN
15
+ from transformers.modeling_outputs import (BaseModelOutput,
16
+ BaseModelOutputWithPooling)
17
+ from transformers.modeling_utils import PreTrainedModel
18
+ from transformers.utils import logging
19
+
20
+ from .configuration_intern_vit import InternVisionConfig
21
+
22
+ try:
23
+ from .flash_attention import FlashAttention
24
+ has_flash_attn = True
25
+ except:
26
+ print('FlashAttention is not installed.')
27
+ has_flash_attn = False
28
+
29
+
30
+ logger = logging.get_logger(__name__)
31
+
32
+
33
+ class InternRMSNorm(nn.Module):
34
+ def __init__(self, hidden_size, eps=1e-6):
35
+ super().__init__()
36
+ self.weight = nn.Parameter(torch.ones(hidden_size))
37
+ self.variance_epsilon = eps
38
+
39
+ def forward(self, hidden_states):
40
+ input_dtype = hidden_states.dtype
41
+ hidden_states = hidden_states.to(torch.float32)
42
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
43
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
44
+ return self.weight * hidden_states.to(input_dtype)
45
+
46
+
47
+ try:
48
+ from apex.normalization import FusedRMSNorm
49
+
50
+ InternRMSNorm = FusedRMSNorm # noqa
51
+
52
+ logger.info('Discovered apex.normalization.FusedRMSNorm - will use it instead of InternRMSNorm')
53
+ except ImportError:
54
+ # using the normal InternRMSNorm
55
+ pass
56
+ except Exception:
57
+ logger.warning('discovered apex but it failed to load, falling back to InternRMSNorm')
58
+ pass
59
+
60
+
61
+ class InternVisionEmbeddings(nn.Module):
62
+ def __init__(self, config: InternVisionConfig):
63
+ super().__init__()
64
+ self.config = config
65
+ self.embed_dim = config.hidden_size
66
+ self.image_size = config.image_size
67
+ self.patch_size = config.patch_size
68
+
69
+ self.class_embedding = nn.Parameter(
70
+ torch.randn(1, 1, self.embed_dim),
71
+ )
72
+
73
+ self.patch_embedding = nn.Conv2d(
74
+ in_channels=3, out_channels=self.embed_dim, kernel_size=self.patch_size, stride=self.patch_size
75
+ )
76
+
77
+ self.num_patches = (self.image_size // self.patch_size) ** 2
78
+ self.num_positions = self.num_patches + 1
79
+
80
+ self.position_embedding = nn.Parameter(torch.randn(1, self.num_positions, self.embed_dim))
81
+
82
+ def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor:
83
+ batch_size = pixel_values.shape[0]
84
+ target_dtype = self.patch_embedding.weight.dtype
85
+ patch_embeds = self.patch_embedding(pixel_values) # shape = [*, width, grid, grid]
86
+ patch_embeds = patch_embeds.flatten(2).transpose(1, 2)
87
+ class_embeds = self.class_embedding.expand(batch_size, 1, -1).to(target_dtype)
88
+ embeddings = torch.cat([class_embeds, patch_embeds], dim=1)
89
+ embeddings = embeddings + self.position_embedding.to(target_dtype)
90
+ return embeddings
91
+
92
+
93
+ class InternAttention(nn.Module):
94
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
95
+
96
+ def __init__(self, config: InternVisionConfig):
97
+ super().__init__()
98
+ self.config = config
99
+ self.embed_dim = config.hidden_size
100
+ self.num_heads = config.num_attention_heads
101
+ self.use_flash_attn = config.use_flash_attn and has_flash_attn
102
+ if config.use_flash_attn and not has_flash_attn:
103
+ print('Warning: Flash Attention is not available, use_flash_attn is set to False.')
104
+ self.head_dim = self.embed_dim // self.num_heads
105
+ if self.head_dim * self.num_heads != self.embed_dim:
106
+ raise ValueError(
107
+ f'embed_dim must be divisible by num_heads (got `embed_dim`: {self.embed_dim} and `num_heads`:'
108
+ f' {self.num_heads}).'
109
+ )
110
+
111
+ self.scale = self.head_dim ** -0.5
112
+ self.qkv = nn.Linear(self.embed_dim, 3 * self.embed_dim, bias=config.qkv_bias)
113
+ self.attn_drop = nn.Dropout(config.attention_dropout)
114
+ self.proj_drop = nn.Dropout(config.dropout)
115
+
116
+ self.qk_normalization = config.qk_normalization
117
+
118
+ if self.qk_normalization:
119
+ self.q_norm = InternRMSNorm(self.embed_dim, eps=config.layer_norm_eps)
120
+ self.k_norm = InternRMSNorm(self.embed_dim, eps=config.layer_norm_eps)
121
+
122
+ if self.use_flash_attn:
123
+ self.inner_attn = FlashAttention(attention_dropout=config.attention_dropout)
124
+ self.proj = nn.Linear(self.embed_dim, self.embed_dim)
125
+
126
+ def _naive_attn(self, x):
127
+ B, N, C = x.shape
128
+ qkv = self.qkv(x).reshape(B, N, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
129
+ q, k, v = qkv.unbind(0) # make torchscript happy (cannot use tensor as tuple)
130
+
131
+ if self.qk_normalization:
132
+ B_, H_, N_, D_ = q.shape
133
+ q = self.q_norm(q.transpose(1, 2).flatten(-2, -1)).view(B_, N_, H_, D_).transpose(1, 2)
134
+ k = self.k_norm(k.transpose(1, 2).flatten(-2, -1)).view(B_, N_, H_, D_).transpose(1, 2)
135
+
136
+ attn = ((q * self.scale) @ k.transpose(-2, -1))
137
+ attn = attn.softmax(dim=-1)
138
+ attn = self.attn_drop(attn)
139
+
140
+ x = (attn @ v).transpose(1, 2).reshape(B, N, C)
141
+ x = self.proj(x)
142
+ x = self.proj_drop(x)
143
+ return x
144
+
145
+ def _flash_attn(self, x, key_padding_mask=None, need_weights=False):
146
+ qkv = self.qkv(x)
147
+ qkv = rearrange(qkv, 'b s (three h d) -> b s three h d', three=3, h=self.num_heads)
148
+
149
+ if self.qk_normalization:
150
+ q, k, v = qkv.unbind(2)
151
+ q = self.q_norm(q.flatten(-2, -1)).view(q.shape)
152
+ k = self.k_norm(k.flatten(-2, -1)).view(k.shape)
153
+ qkv = torch.stack([q, k, v], dim=2)
154
+
155
+ context, _ = self.inner_attn(
156
+ qkv, key_padding_mask=key_padding_mask, need_weights=need_weights, causal=False
157
+ )
158
+ outs = self.proj(rearrange(context, 'b s h d -> b s (h d)'))
159
+ outs = self.proj_drop(outs)
160
+ return outs
161
+
162
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
163
+ x = self._naive_attn(hidden_states) if not self.use_flash_attn else self._flash_attn(hidden_states)
164
+ return x
165
+
166
+
167
+ class InternMLP(nn.Module):
168
+ def __init__(self, config: InternVisionConfig):
169
+ super().__init__()
170
+ self.config = config
171
+ self.act = ACT2FN[config.hidden_act]
172
+ self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
173
+ self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size)
174
+
175
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
176
+ hidden_states = self.fc1(hidden_states)
177
+ hidden_states = self.act(hidden_states)
178
+ hidden_states = self.fc2(hidden_states)
179
+ return hidden_states
180
+
181
+
182
+ class InternVisionEncoderLayer(nn.Module):
183
+ def __init__(self, config: InternVisionConfig, drop_path_rate: float):
184
+ super().__init__()
185
+ self.embed_dim = config.hidden_size
186
+ self.intermediate_size = config.intermediate_size
187
+
188
+ self.attn = InternAttention(config)
189
+ self.mlp = InternMLP(config)
190
+ self.norm1 = InternRMSNorm(self.embed_dim, eps=config.layer_norm_eps)
191
+ self.norm2 = InternRMSNorm(self.embed_dim, eps=config.layer_norm_eps)
192
+
193
+ self.ls1 = nn.Parameter(config.initializer_factor * torch.ones(self.embed_dim))
194
+ self.ls2 = nn.Parameter(config.initializer_factor * torch.ones(self.embed_dim))
195
+ self.drop_path1 = DropPath(drop_path_rate) if drop_path_rate > 0. else nn.Identity()
196
+ self.drop_path2 = DropPath(drop_path_rate) if drop_path_rate > 0. else nn.Identity()
197
+
198
+ def forward(
199
+ self,
200
+ hidden_states: torch.Tensor,
201
+ ) -> Tuple[torch.FloatTensor, Optional[torch.FloatTensor], Optional[Tuple[torch.FloatTensor]]]:
202
+ """
203
+ Args:
204
+ hidden_states (`Tuple[torch.FloatTensor, Optional[torch.FloatTensor]]`): input to the layer of shape `(batch, seq_len, embed_dim)`
205
+ """
206
+ hidden_states = hidden_states + self.drop_path1(self.attn(self.norm1(hidden_states)) * self.ls1)
207
+
208
+ hidden_states = hidden_states + self.drop_path2(self.mlp(self.norm2(hidden_states)) * self.ls2)
209
+
210
+ return hidden_states
211
+
212
+
213
+ class InternVisionEncoder(nn.Module):
214
+ """
215
+ Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
216
+ [`InternEncoderLayer`].
217
+
218
+ Args:
219
+ config (`InternConfig`):
220
+ The corresponding vision configuration for the `InternEncoder`.
221
+ """
222
+
223
+ def __init__(self, config: InternVisionConfig):
224
+ super().__init__()
225
+ self.config = config
226
+ # stochastic depth decay rule
227
+ dpr = [x.item() for x in torch.linspace(0, config.drop_path_rate, config.num_hidden_layers)]
228
+ self.layers = nn.ModuleList([
229
+ InternVisionEncoderLayer(config, dpr[idx]) for idx in range(config.num_hidden_layers)])
230
+ self.gradient_checkpointing = True
231
+
232
+ def forward(
233
+ self,
234
+ inputs_embeds,
235
+ output_hidden_states: Optional[bool] = None,
236
+ return_dict: Optional[bool] = None,
237
+ ) -> Union[Tuple, BaseModelOutput]:
238
+ r"""
239
+ Args:
240
+ inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
241
+ Embedded representation of the inputs. Should be float, not int tokens.
242
+ output_hidden_states (`bool`, *optional*):
243
+ Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
244
+ for more detail.
245
+ return_dict (`bool`, *optional*):
246
+ Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
247
+ """
248
+ output_hidden_states = (
249
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
250
+ )
251
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
252
+
253
+ encoder_states = () if output_hidden_states else None
254
+ hidden_states = inputs_embeds
255
+
256
+ for idx, encoder_layer in enumerate(self.layers):
257
+ if output_hidden_states:
258
+ encoder_states = encoder_states + (hidden_states,)
259
+ if self.gradient_checkpointing and self.training:
260
+ layer_outputs = torch.utils.checkpoint.checkpoint(
261
+ encoder_layer,
262
+ hidden_states)
263
+ else:
264
+ layer_outputs = encoder_layer(
265
+ hidden_states,
266
+ )
267
+ hidden_states = layer_outputs
268
+
269
+ if output_hidden_states:
270
+ encoder_states = encoder_states + (hidden_states,)
271
+
272
+ if not return_dict:
273
+ return tuple(v for v in [hidden_states, encoder_states] if v is not None)
274
+ return BaseModelOutput(
275
+ last_hidden_state=hidden_states, hidden_states=encoder_states
276
+ )
277
+
278
+
279
+ class InternVisionModel(PreTrainedModel):
280
+ main_input_name = 'pixel_values'
281
+ config_class = InternVisionConfig
282
+ _no_split_modules = ['InternVisionEncoderLayer']
283
+
284
+ def __init__(self, config: InternVisionConfig):
285
+ super().__init__(config)
286
+ self.config = config
287
+
288
+ self.embeddings = InternVisionEmbeddings(config)
289
+ self.encoder = InternVisionEncoder(config)
290
+
291
+ def resize_pos_embeddings(self, old_size, new_size, patch_size):
292
+ pos_emb = self.embeddings.position_embedding
293
+ _, num_positions, embed_dim = pos_emb.shape
294
+ cls_emb = pos_emb[:, :1, :]
295
+ pos_emb = pos_emb[:, 1:, :].reshape(1, old_size // patch_size, old_size // patch_size, -1).permute(0, 3, 1, 2)
296
+ pos_emb = F.interpolate(pos_emb.float(), size=new_size // patch_size, mode='bicubic', align_corners=False)
297
+ pos_emb = pos_emb.to(cls_emb.dtype).reshape(1, embed_dim, -1).permute(0, 2, 1)
298
+ pos_emb = torch.cat([cls_emb, pos_emb], dim=1)
299
+ self.embeddings.position_embedding = nn.Parameter(pos_emb)
300
+ logger.info('Resized position embeddings from {} to {}'.format(old_size, new_size))
301
+
302
+ def get_input_embeddings(self):
303
+ return self.embeddings
304
+
305
+ def forward(
306
+ self,
307
+ pixel_values: Optional[torch.FloatTensor] = None,
308
+ output_hidden_states: Optional[bool] = None,
309
+ return_dict: Optional[bool] = None,
310
+ pixel_embeds: Optional[torch.FloatTensor] = None,
311
+ ) -> Union[Tuple, BaseModelOutputWithPooling]:
312
+ output_hidden_states = (
313
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
314
+ )
315
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
316
+
317
+ if pixel_values is None and pixel_embeds is None:
318
+ raise ValueError('You have to specify pixel_values or pixel_embeds')
319
+
320
+ if pixel_embeds is not None:
321
+ hidden_states = pixel_embeds
322
+ else:
323
+ if len(pixel_values.shape) == 4:
324
+ hidden_states = self.embeddings(pixel_values)
325
+ else:
326
+ raise ValueError(f'wrong pixel_values size: {pixel_values.shape}')
327
+ encoder_outputs = self.encoder(
328
+ inputs_embeds=hidden_states,
329
+ output_hidden_states=output_hidden_states,
330
+ return_dict=return_dict,
331
+ )
332
+ last_hidden_state = encoder_outputs.last_hidden_state
333
+ pooled_output = last_hidden_state[:, 0, :]
334
+
335
+ if not return_dict:
336
+ return (last_hidden_state, pooled_output) + encoder_outputs[1:]
337
+
338
+ return BaseModelOutputWithPooling(
339
+ last_hidden_state=last_hidden_state,
340
+ pooler_output=pooled_output,
341
+ hidden_states=encoder_outputs.hidden_states,
342
+ attentions=encoder_outputs.attentions,
343
+ )
preprocessor_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": 448,
3
+ "do_center_crop": true,
4
+ "do_normalize": true,
5
+ "do_resize": true,
6
+ "feature_extractor_type": "CLIPFeatureExtractor",
7
+ "image_mean": [
8
+ 0.485,
9
+ 0.456,
10
+ 0.406
11
+ ],
12
+ "image_std": [
13
+ 0.229,
14
+ 0.224,
15
+ 0.225
16
+ ],
17
+ "resample": 3,
18
+ "size": 448
19
+ }