Upload CondViTForEmbedding
Browse files- config.json +23 -0
- hf_model.py +71 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +357 -0
- module.py +167 -0
config.json
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "__debug_save",
|
3 |
+
"architectures": [
|
4 |
+
"CondViTForEmbedding"
|
5 |
+
],
|
6 |
+
"auto_map": {
|
7 |
+
"AutoConfig": "hf_model.CondViTConfig",
|
8 |
+
"AutoModel": "hf_model.CondViTForEmbedding"
|
9 |
+
},
|
10 |
+
"device": "cpu",
|
11 |
+
"heads": 12,
|
12 |
+
"input_resolution": 224,
|
13 |
+
"layers": 12,
|
14 |
+
"lm_backbone": "sentence-transformers/sentence-t5-xl",
|
15 |
+
"lm_revision": "e0976ba9afd18be963c22c680367a3928c44fd22",
|
16 |
+
"model_type": "condvit",
|
17 |
+
"n_categories": 10,
|
18 |
+
"output_dim": 512,
|
19 |
+
"patch_size": 16,
|
20 |
+
"torch_dtype": "float32",
|
21 |
+
"transformers_version": "4.37.1",
|
22 |
+
"width": 768
|
23 |
+
}
|
hf_model.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import PreTrainedModel, PretrainedConfig
|
2 |
+
from .module import ConditionalViT
|
3 |
+
|
4 |
+
from sentence_transformers import SentenceTransformer
|
5 |
+
|
6 |
+
|
7 |
+
class CondViTConfig(PretrainedConfig):
|
8 |
+
model_type = "condvit"
|
9 |
+
|
10 |
+
def __init__(
|
11 |
+
self,
|
12 |
+
input_resolution: int = 224,
|
13 |
+
patch_size: int = 16,
|
14 |
+
width: int = 768,
|
15 |
+
layers: int = 12,
|
16 |
+
heads: int = 12,
|
17 |
+
output_dim: int = 512,
|
18 |
+
n_categories: int = 10,
|
19 |
+
lm_backbone: str = "sentence-transformers/sentence-t5-xl",
|
20 |
+
lm_revision: str = "e0976ba9afd18be963c22c680367a3928c44fd22",
|
21 |
+
device: str = "cpu",
|
22 |
+
**kwargs
|
23 |
+
):
|
24 |
+
self.input_resolution = input_resolution
|
25 |
+
self.patch_size = patch_size
|
26 |
+
self.width = width
|
27 |
+
self.layers = layers
|
28 |
+
self.heads = heads
|
29 |
+
self.output_dim = output_dim
|
30 |
+
self.n_categories = n_categories
|
31 |
+
|
32 |
+
self.lm_backbone = lm_backbone
|
33 |
+
self.lm_revision = lm_revision
|
34 |
+
|
35 |
+
self.device = device
|
36 |
+
|
37 |
+
super().__init__(**kwargs)
|
38 |
+
|
39 |
+
|
40 |
+
class CondViTForEmbedding(PreTrainedModel):
|
41 |
+
config_class = CondViTConfig
|
42 |
+
|
43 |
+
def __init__(self, config):
|
44 |
+
super().__init__(config)
|
45 |
+
|
46 |
+
self.condvit = ConditionalViT(
|
47 |
+
input_resolution=config.input_resolution,
|
48 |
+
patch_size=config.patch_size,
|
49 |
+
width=config.width,
|
50 |
+
layers=config.layers,
|
51 |
+
heads=config.heads,
|
52 |
+
output_dim=config.output_dim,
|
53 |
+
)
|
54 |
+
if config.device:
|
55 |
+
self.condvit.to(config.device)
|
56 |
+
|
57 |
+
self.lm = SentenceTransformer(
|
58 |
+
config.lm_backbone, revision=config.lm_revision, device=config.device
|
59 |
+
)
|
60 |
+
|
61 |
+
def forward(self, pixel_values, texts=None):
|
62 |
+
if texts is not None:
|
63 |
+
text_embeddings = self.lm.encode(
|
64 |
+
texts,
|
65 |
+
convert_to_tensor=True,
|
66 |
+
convert_to_numpy=False,
|
67 |
+
)
|
68 |
+
text_embeddings = text_embeddings.to(pixel_values.device)
|
69 |
+
else:
|
70 |
+
text_embeddings = None
|
71 |
+
return self.condvit(imgs=pixel_values, c=text_embeddings)
|
model-00001-of-00002.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:55b611cb11b4bf73bf8715538c3be0240daabdd2a48314c214e5cfa9c1adb742
|
3 |
+
size 4972895436
|
model-00002-of-00002.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:339d88b3be497bb3333457701c9487260fc0a270388a3029d6869322d83ee3d5
|
3 |
+
size 338708184
|
model.safetensors.index.json
ADDED
@@ -0,0 +1,357 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"metadata": {
|
3 |
+
"total_size": 5311558660
|
4 |
+
},
|
5 |
+
"weight_map": {
|
6 |
+
"condvit.c_pos_embedding": "model-00001-of-00002.safetensors",
|
7 |
+
"condvit.class_embedding": "model-00001-of-00002.safetensors",
|
8 |
+
"condvit.conv1.weight": "model-00001-of-00002.safetensors",
|
9 |
+
"condvit.ln_post.bias": "model-00001-of-00002.safetensors",
|
10 |
+
"condvit.ln_post.weight": "model-00001-of-00002.safetensors",
|
11 |
+
"condvit.ln_pre.bias": "model-00001-of-00002.safetensors",
|
12 |
+
"condvit.ln_pre.weight": "model-00001-of-00002.safetensors",
|
13 |
+
"condvit.logit_scale": "model-00001-of-00002.safetensors",
|
14 |
+
"condvit.positional_embedding": "model-00001-of-00002.safetensors",
|
15 |
+
"condvit.proj.weight": "model-00001-of-00002.safetensors",
|
16 |
+
"condvit.transformer.resblocks.0.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
17 |
+
"condvit.transformer.resblocks.0.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
18 |
+
"condvit.transformer.resblocks.0.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
19 |
+
"condvit.transformer.resblocks.0.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
20 |
+
"condvit.transformer.resblocks.0.ln_1.bias": "model-00001-of-00002.safetensors",
|
21 |
+
"condvit.transformer.resblocks.0.ln_1.weight": "model-00001-of-00002.safetensors",
|
22 |
+
"condvit.transformer.resblocks.0.ln_2.bias": "model-00001-of-00002.safetensors",
|
23 |
+
"condvit.transformer.resblocks.0.ln_2.weight": "model-00001-of-00002.safetensors",
|
24 |
+
"condvit.transformer.resblocks.0.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
25 |
+
"condvit.transformer.resblocks.0.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
26 |
+
"condvit.transformer.resblocks.0.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
27 |
+
"condvit.transformer.resblocks.0.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
28 |
+
"condvit.transformer.resblocks.1.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
29 |
+
"condvit.transformer.resblocks.1.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
30 |
+
"condvit.transformer.resblocks.1.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
31 |
+
"condvit.transformer.resblocks.1.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
32 |
+
"condvit.transformer.resblocks.1.ln_1.bias": "model-00001-of-00002.safetensors",
|
33 |
+
"condvit.transformer.resblocks.1.ln_1.weight": "model-00001-of-00002.safetensors",
|
34 |
+
"condvit.transformer.resblocks.1.ln_2.bias": "model-00001-of-00002.safetensors",
|
35 |
+
"condvit.transformer.resblocks.1.ln_2.weight": "model-00001-of-00002.safetensors",
|
36 |
+
"condvit.transformer.resblocks.1.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
37 |
+
"condvit.transformer.resblocks.1.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
38 |
+
"condvit.transformer.resblocks.1.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
39 |
+
"condvit.transformer.resblocks.1.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
40 |
+
"condvit.transformer.resblocks.10.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
41 |
+
"condvit.transformer.resblocks.10.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
42 |
+
"condvit.transformer.resblocks.10.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
43 |
+
"condvit.transformer.resblocks.10.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
44 |
+
"condvit.transformer.resblocks.10.ln_1.bias": "model-00001-of-00002.safetensors",
|
45 |
+
"condvit.transformer.resblocks.10.ln_1.weight": "model-00001-of-00002.safetensors",
|
46 |
+
"condvit.transformer.resblocks.10.ln_2.bias": "model-00001-of-00002.safetensors",
|
47 |
+
"condvit.transformer.resblocks.10.ln_2.weight": "model-00001-of-00002.safetensors",
|
48 |
+
"condvit.transformer.resblocks.10.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
49 |
+
"condvit.transformer.resblocks.10.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
50 |
+
"condvit.transformer.resblocks.10.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
51 |
+
"condvit.transformer.resblocks.10.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
52 |
+
"condvit.transformer.resblocks.11.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
53 |
+
"condvit.transformer.resblocks.11.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
54 |
+
"condvit.transformer.resblocks.11.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
55 |
+
"condvit.transformer.resblocks.11.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
56 |
+
"condvit.transformer.resblocks.11.ln_1.bias": "model-00001-of-00002.safetensors",
|
57 |
+
"condvit.transformer.resblocks.11.ln_1.weight": "model-00001-of-00002.safetensors",
|
58 |
+
"condvit.transformer.resblocks.11.ln_2.bias": "model-00001-of-00002.safetensors",
|
59 |
+
"condvit.transformer.resblocks.11.ln_2.weight": "model-00001-of-00002.safetensors",
|
60 |
+
"condvit.transformer.resblocks.11.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
61 |
+
"condvit.transformer.resblocks.11.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
62 |
+
"condvit.transformer.resblocks.11.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
63 |
+
"condvit.transformer.resblocks.11.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
64 |
+
"condvit.transformer.resblocks.2.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
65 |
+
"condvit.transformer.resblocks.2.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
66 |
+
"condvit.transformer.resblocks.2.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
67 |
+
"condvit.transformer.resblocks.2.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
68 |
+
"condvit.transformer.resblocks.2.ln_1.bias": "model-00001-of-00002.safetensors",
|
69 |
+
"condvit.transformer.resblocks.2.ln_1.weight": "model-00001-of-00002.safetensors",
|
70 |
+
"condvit.transformer.resblocks.2.ln_2.bias": "model-00001-of-00002.safetensors",
|
71 |
+
"condvit.transformer.resblocks.2.ln_2.weight": "model-00001-of-00002.safetensors",
|
72 |
+
"condvit.transformer.resblocks.2.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
73 |
+
"condvit.transformer.resblocks.2.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
74 |
+
"condvit.transformer.resblocks.2.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
75 |
+
"condvit.transformer.resblocks.2.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
76 |
+
"condvit.transformer.resblocks.3.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
77 |
+
"condvit.transformer.resblocks.3.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
78 |
+
"condvit.transformer.resblocks.3.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
79 |
+
"condvit.transformer.resblocks.3.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
80 |
+
"condvit.transformer.resblocks.3.ln_1.bias": "model-00001-of-00002.safetensors",
|
81 |
+
"condvit.transformer.resblocks.3.ln_1.weight": "model-00001-of-00002.safetensors",
|
82 |
+
"condvit.transformer.resblocks.3.ln_2.bias": "model-00001-of-00002.safetensors",
|
83 |
+
"condvit.transformer.resblocks.3.ln_2.weight": "model-00001-of-00002.safetensors",
|
84 |
+
"condvit.transformer.resblocks.3.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
85 |
+
"condvit.transformer.resblocks.3.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
86 |
+
"condvit.transformer.resblocks.3.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
87 |
+
"condvit.transformer.resblocks.3.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
88 |
+
"condvit.transformer.resblocks.4.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
89 |
+
"condvit.transformer.resblocks.4.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
90 |
+
"condvit.transformer.resblocks.4.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
91 |
+
"condvit.transformer.resblocks.4.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
92 |
+
"condvit.transformer.resblocks.4.ln_1.bias": "model-00001-of-00002.safetensors",
|
93 |
+
"condvit.transformer.resblocks.4.ln_1.weight": "model-00001-of-00002.safetensors",
|
94 |
+
"condvit.transformer.resblocks.4.ln_2.bias": "model-00001-of-00002.safetensors",
|
95 |
+
"condvit.transformer.resblocks.4.ln_2.weight": "model-00001-of-00002.safetensors",
|
96 |
+
"condvit.transformer.resblocks.4.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
97 |
+
"condvit.transformer.resblocks.4.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
98 |
+
"condvit.transformer.resblocks.4.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
99 |
+
"condvit.transformer.resblocks.4.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
100 |
+
"condvit.transformer.resblocks.5.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
101 |
+
"condvit.transformer.resblocks.5.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
102 |
+
"condvit.transformer.resblocks.5.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
103 |
+
"condvit.transformer.resblocks.5.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
104 |
+
"condvit.transformer.resblocks.5.ln_1.bias": "model-00001-of-00002.safetensors",
|
105 |
+
"condvit.transformer.resblocks.5.ln_1.weight": "model-00001-of-00002.safetensors",
|
106 |
+
"condvit.transformer.resblocks.5.ln_2.bias": "model-00001-of-00002.safetensors",
|
107 |
+
"condvit.transformer.resblocks.5.ln_2.weight": "model-00001-of-00002.safetensors",
|
108 |
+
"condvit.transformer.resblocks.5.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
109 |
+
"condvit.transformer.resblocks.5.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
110 |
+
"condvit.transformer.resblocks.5.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
111 |
+
"condvit.transformer.resblocks.5.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
112 |
+
"condvit.transformer.resblocks.6.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
113 |
+
"condvit.transformer.resblocks.6.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
114 |
+
"condvit.transformer.resblocks.6.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
115 |
+
"condvit.transformer.resblocks.6.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
116 |
+
"condvit.transformer.resblocks.6.ln_1.bias": "model-00001-of-00002.safetensors",
|
117 |
+
"condvit.transformer.resblocks.6.ln_1.weight": "model-00001-of-00002.safetensors",
|
118 |
+
"condvit.transformer.resblocks.6.ln_2.bias": "model-00001-of-00002.safetensors",
|
119 |
+
"condvit.transformer.resblocks.6.ln_2.weight": "model-00001-of-00002.safetensors",
|
120 |
+
"condvit.transformer.resblocks.6.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
121 |
+
"condvit.transformer.resblocks.6.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
122 |
+
"condvit.transformer.resblocks.6.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
123 |
+
"condvit.transformer.resblocks.6.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
124 |
+
"condvit.transformer.resblocks.7.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
125 |
+
"condvit.transformer.resblocks.7.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
126 |
+
"condvit.transformer.resblocks.7.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
127 |
+
"condvit.transformer.resblocks.7.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
128 |
+
"condvit.transformer.resblocks.7.ln_1.bias": "model-00001-of-00002.safetensors",
|
129 |
+
"condvit.transformer.resblocks.7.ln_1.weight": "model-00001-of-00002.safetensors",
|
130 |
+
"condvit.transformer.resblocks.7.ln_2.bias": "model-00001-of-00002.safetensors",
|
131 |
+
"condvit.transformer.resblocks.7.ln_2.weight": "model-00001-of-00002.safetensors",
|
132 |
+
"condvit.transformer.resblocks.7.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
133 |
+
"condvit.transformer.resblocks.7.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
134 |
+
"condvit.transformer.resblocks.7.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
135 |
+
"condvit.transformer.resblocks.7.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
136 |
+
"condvit.transformer.resblocks.8.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
137 |
+
"condvit.transformer.resblocks.8.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
138 |
+
"condvit.transformer.resblocks.8.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
139 |
+
"condvit.transformer.resblocks.8.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
140 |
+
"condvit.transformer.resblocks.8.ln_1.bias": "model-00001-of-00002.safetensors",
|
141 |
+
"condvit.transformer.resblocks.8.ln_1.weight": "model-00001-of-00002.safetensors",
|
142 |
+
"condvit.transformer.resblocks.8.ln_2.bias": "model-00001-of-00002.safetensors",
|
143 |
+
"condvit.transformer.resblocks.8.ln_2.weight": "model-00001-of-00002.safetensors",
|
144 |
+
"condvit.transformer.resblocks.8.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
145 |
+
"condvit.transformer.resblocks.8.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
146 |
+
"condvit.transformer.resblocks.8.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
147 |
+
"condvit.transformer.resblocks.8.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
148 |
+
"condvit.transformer.resblocks.9.attn.in_proj_bias": "model-00001-of-00002.safetensors",
|
149 |
+
"condvit.transformer.resblocks.9.attn.in_proj_weight": "model-00001-of-00002.safetensors",
|
150 |
+
"condvit.transformer.resblocks.9.attn.out_proj.bias": "model-00001-of-00002.safetensors",
|
151 |
+
"condvit.transformer.resblocks.9.attn.out_proj.weight": "model-00001-of-00002.safetensors",
|
152 |
+
"condvit.transformer.resblocks.9.ln_1.bias": "model-00001-of-00002.safetensors",
|
153 |
+
"condvit.transformer.resblocks.9.ln_1.weight": "model-00001-of-00002.safetensors",
|
154 |
+
"condvit.transformer.resblocks.9.ln_2.bias": "model-00001-of-00002.safetensors",
|
155 |
+
"condvit.transformer.resblocks.9.ln_2.weight": "model-00001-of-00002.safetensors",
|
156 |
+
"condvit.transformer.resblocks.9.mlp.c_fc.bias": "model-00001-of-00002.safetensors",
|
157 |
+
"condvit.transformer.resblocks.9.mlp.c_fc.weight": "model-00001-of-00002.safetensors",
|
158 |
+
"condvit.transformer.resblocks.9.mlp.c_proj.bias": "model-00001-of-00002.safetensors",
|
159 |
+
"condvit.transformer.resblocks.9.mlp.c_proj.weight": "model-00001-of-00002.safetensors",
|
160 |
+
"lm.0.auto_model.encoder.block.0.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
161 |
+
"lm.0.auto_model.encoder.block.0.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
162 |
+
"lm.0.auto_model.encoder.block.0.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
163 |
+
"lm.0.auto_model.encoder.block.0.layer.0.SelfAttention.relative_attention_bias.weight": "model-00001-of-00002.safetensors",
|
164 |
+
"lm.0.auto_model.encoder.block.0.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
165 |
+
"lm.0.auto_model.encoder.block.0.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
166 |
+
"lm.0.auto_model.encoder.block.0.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
167 |
+
"lm.0.auto_model.encoder.block.0.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
168 |
+
"lm.0.auto_model.encoder.block.0.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
169 |
+
"lm.0.auto_model.encoder.block.1.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
170 |
+
"lm.0.auto_model.encoder.block.1.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
171 |
+
"lm.0.auto_model.encoder.block.1.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
172 |
+
"lm.0.auto_model.encoder.block.1.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
173 |
+
"lm.0.auto_model.encoder.block.1.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
174 |
+
"lm.0.auto_model.encoder.block.1.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
175 |
+
"lm.0.auto_model.encoder.block.1.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
176 |
+
"lm.0.auto_model.encoder.block.1.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
177 |
+
"lm.0.auto_model.encoder.block.10.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
178 |
+
"lm.0.auto_model.encoder.block.10.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
179 |
+
"lm.0.auto_model.encoder.block.10.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
180 |
+
"lm.0.auto_model.encoder.block.10.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
181 |
+
"lm.0.auto_model.encoder.block.10.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
182 |
+
"lm.0.auto_model.encoder.block.10.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
183 |
+
"lm.0.auto_model.encoder.block.10.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
184 |
+
"lm.0.auto_model.encoder.block.10.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
185 |
+
"lm.0.auto_model.encoder.block.11.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
186 |
+
"lm.0.auto_model.encoder.block.11.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
187 |
+
"lm.0.auto_model.encoder.block.11.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
188 |
+
"lm.0.auto_model.encoder.block.11.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
189 |
+
"lm.0.auto_model.encoder.block.11.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
190 |
+
"lm.0.auto_model.encoder.block.11.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
191 |
+
"lm.0.auto_model.encoder.block.11.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
192 |
+
"lm.0.auto_model.encoder.block.11.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
193 |
+
"lm.0.auto_model.encoder.block.12.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
194 |
+
"lm.0.auto_model.encoder.block.12.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
195 |
+
"lm.0.auto_model.encoder.block.12.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
196 |
+
"lm.0.auto_model.encoder.block.12.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
197 |
+
"lm.0.auto_model.encoder.block.12.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
198 |
+
"lm.0.auto_model.encoder.block.12.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
199 |
+
"lm.0.auto_model.encoder.block.12.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
200 |
+
"lm.0.auto_model.encoder.block.12.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
201 |
+
"lm.0.auto_model.encoder.block.13.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
202 |
+
"lm.0.auto_model.encoder.block.13.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
203 |
+
"lm.0.auto_model.encoder.block.13.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
204 |
+
"lm.0.auto_model.encoder.block.13.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
205 |
+
"lm.0.auto_model.encoder.block.13.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
206 |
+
"lm.0.auto_model.encoder.block.13.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
207 |
+
"lm.0.auto_model.encoder.block.13.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
208 |
+
"lm.0.auto_model.encoder.block.13.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
209 |
+
"lm.0.auto_model.encoder.block.14.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
210 |
+
"lm.0.auto_model.encoder.block.14.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
211 |
+
"lm.0.auto_model.encoder.block.14.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
212 |
+
"lm.0.auto_model.encoder.block.14.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
213 |
+
"lm.0.auto_model.encoder.block.14.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
214 |
+
"lm.0.auto_model.encoder.block.14.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
215 |
+
"lm.0.auto_model.encoder.block.14.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
216 |
+
"lm.0.auto_model.encoder.block.14.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
217 |
+
"lm.0.auto_model.encoder.block.15.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
218 |
+
"lm.0.auto_model.encoder.block.15.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
219 |
+
"lm.0.auto_model.encoder.block.15.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
220 |
+
"lm.0.auto_model.encoder.block.15.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
221 |
+
"lm.0.auto_model.encoder.block.15.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
222 |
+
"lm.0.auto_model.encoder.block.15.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
223 |
+
"lm.0.auto_model.encoder.block.15.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
224 |
+
"lm.0.auto_model.encoder.block.15.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
225 |
+
"lm.0.auto_model.encoder.block.16.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
226 |
+
"lm.0.auto_model.encoder.block.16.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
227 |
+
"lm.0.auto_model.encoder.block.16.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
228 |
+
"lm.0.auto_model.encoder.block.16.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
229 |
+
"lm.0.auto_model.encoder.block.16.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
230 |
+
"lm.0.auto_model.encoder.block.16.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
231 |
+
"lm.0.auto_model.encoder.block.16.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
232 |
+
"lm.0.auto_model.encoder.block.16.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
233 |
+
"lm.0.auto_model.encoder.block.17.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
234 |
+
"lm.0.auto_model.encoder.block.17.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
235 |
+
"lm.0.auto_model.encoder.block.17.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
236 |
+
"lm.0.auto_model.encoder.block.17.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
237 |
+
"lm.0.auto_model.encoder.block.17.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
238 |
+
"lm.0.auto_model.encoder.block.17.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
239 |
+
"lm.0.auto_model.encoder.block.17.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
240 |
+
"lm.0.auto_model.encoder.block.17.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
241 |
+
"lm.0.auto_model.encoder.block.18.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
242 |
+
"lm.0.auto_model.encoder.block.18.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
243 |
+
"lm.0.auto_model.encoder.block.18.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
244 |
+
"lm.0.auto_model.encoder.block.18.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
245 |
+
"lm.0.auto_model.encoder.block.18.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
246 |
+
"lm.0.auto_model.encoder.block.18.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
247 |
+
"lm.0.auto_model.encoder.block.18.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
248 |
+
"lm.0.auto_model.encoder.block.18.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
249 |
+
"lm.0.auto_model.encoder.block.19.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
250 |
+
"lm.0.auto_model.encoder.block.19.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
251 |
+
"lm.0.auto_model.encoder.block.19.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
252 |
+
"lm.0.auto_model.encoder.block.19.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
253 |
+
"lm.0.auto_model.encoder.block.19.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
254 |
+
"lm.0.auto_model.encoder.block.19.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
255 |
+
"lm.0.auto_model.encoder.block.19.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
256 |
+
"lm.0.auto_model.encoder.block.19.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
257 |
+
"lm.0.auto_model.encoder.block.2.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
258 |
+
"lm.0.auto_model.encoder.block.2.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
259 |
+
"lm.0.auto_model.encoder.block.2.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
260 |
+
"lm.0.auto_model.encoder.block.2.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
261 |
+
"lm.0.auto_model.encoder.block.2.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
262 |
+
"lm.0.auto_model.encoder.block.2.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
263 |
+
"lm.0.auto_model.encoder.block.2.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
264 |
+
"lm.0.auto_model.encoder.block.2.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
265 |
+
"lm.0.auto_model.encoder.block.20.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
266 |
+
"lm.0.auto_model.encoder.block.20.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
267 |
+
"lm.0.auto_model.encoder.block.20.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
268 |
+
"lm.0.auto_model.encoder.block.20.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
269 |
+
"lm.0.auto_model.encoder.block.20.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
270 |
+
"lm.0.auto_model.encoder.block.20.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
271 |
+
"lm.0.auto_model.encoder.block.20.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
272 |
+
"lm.0.auto_model.encoder.block.20.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
273 |
+
"lm.0.auto_model.encoder.block.21.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
274 |
+
"lm.0.auto_model.encoder.block.21.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
275 |
+
"lm.0.auto_model.encoder.block.21.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
276 |
+
"lm.0.auto_model.encoder.block.21.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
277 |
+
"lm.0.auto_model.encoder.block.21.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
278 |
+
"lm.0.auto_model.encoder.block.21.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
279 |
+
"lm.0.auto_model.encoder.block.21.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
280 |
+
"lm.0.auto_model.encoder.block.21.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
281 |
+
"lm.0.auto_model.encoder.block.22.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
282 |
+
"lm.0.auto_model.encoder.block.22.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
283 |
+
"lm.0.auto_model.encoder.block.22.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
284 |
+
"lm.0.auto_model.encoder.block.22.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
285 |
+
"lm.0.auto_model.encoder.block.22.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
286 |
+
"lm.0.auto_model.encoder.block.22.layer.1.DenseReluDense.wi.weight": "model-00002-of-00002.safetensors",
|
287 |
+
"lm.0.auto_model.encoder.block.22.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors",
|
288 |
+
"lm.0.auto_model.encoder.block.22.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors",
|
289 |
+
"lm.0.auto_model.encoder.block.23.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors",
|
290 |
+
"lm.0.auto_model.encoder.block.23.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors",
|
291 |
+
"lm.0.auto_model.encoder.block.23.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors",
|
292 |
+
"lm.0.auto_model.encoder.block.23.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors",
|
293 |
+
"lm.0.auto_model.encoder.block.23.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors",
|
294 |
+
"lm.0.auto_model.encoder.block.23.layer.1.DenseReluDense.wi.weight": "model-00002-of-00002.safetensors",
|
295 |
+
"lm.0.auto_model.encoder.block.23.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors",
|
296 |
+
"lm.0.auto_model.encoder.block.23.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors",
|
297 |
+
"lm.0.auto_model.encoder.block.3.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
298 |
+
"lm.0.auto_model.encoder.block.3.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
299 |
+
"lm.0.auto_model.encoder.block.3.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
300 |
+
"lm.0.auto_model.encoder.block.3.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
301 |
+
"lm.0.auto_model.encoder.block.3.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
302 |
+
"lm.0.auto_model.encoder.block.3.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
303 |
+
"lm.0.auto_model.encoder.block.3.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
304 |
+
"lm.0.auto_model.encoder.block.3.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
305 |
+
"lm.0.auto_model.encoder.block.4.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
306 |
+
"lm.0.auto_model.encoder.block.4.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
307 |
+
"lm.0.auto_model.encoder.block.4.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
308 |
+
"lm.0.auto_model.encoder.block.4.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
309 |
+
"lm.0.auto_model.encoder.block.4.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
310 |
+
"lm.0.auto_model.encoder.block.4.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
311 |
+
"lm.0.auto_model.encoder.block.4.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
312 |
+
"lm.0.auto_model.encoder.block.4.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
313 |
+
"lm.0.auto_model.encoder.block.5.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
314 |
+
"lm.0.auto_model.encoder.block.5.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
315 |
+
"lm.0.auto_model.encoder.block.5.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
316 |
+
"lm.0.auto_model.encoder.block.5.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
317 |
+
"lm.0.auto_model.encoder.block.5.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
318 |
+
"lm.0.auto_model.encoder.block.5.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
319 |
+
"lm.0.auto_model.encoder.block.5.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
320 |
+
"lm.0.auto_model.encoder.block.5.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
321 |
+
"lm.0.auto_model.encoder.block.6.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
322 |
+
"lm.0.auto_model.encoder.block.6.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
323 |
+
"lm.0.auto_model.encoder.block.6.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
324 |
+
"lm.0.auto_model.encoder.block.6.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
325 |
+
"lm.0.auto_model.encoder.block.6.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
326 |
+
"lm.0.auto_model.encoder.block.6.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
327 |
+
"lm.0.auto_model.encoder.block.6.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
328 |
+
"lm.0.auto_model.encoder.block.6.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
329 |
+
"lm.0.auto_model.encoder.block.7.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
330 |
+
"lm.0.auto_model.encoder.block.7.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
331 |
+
"lm.0.auto_model.encoder.block.7.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
332 |
+
"lm.0.auto_model.encoder.block.7.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
333 |
+
"lm.0.auto_model.encoder.block.7.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
334 |
+
"lm.0.auto_model.encoder.block.7.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
335 |
+
"lm.0.auto_model.encoder.block.7.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
336 |
+
"lm.0.auto_model.encoder.block.7.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
337 |
+
"lm.0.auto_model.encoder.block.8.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
338 |
+
"lm.0.auto_model.encoder.block.8.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
339 |
+
"lm.0.auto_model.encoder.block.8.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
340 |
+
"lm.0.auto_model.encoder.block.8.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
341 |
+
"lm.0.auto_model.encoder.block.8.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
342 |
+
"lm.0.auto_model.encoder.block.8.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
343 |
+
"lm.0.auto_model.encoder.block.8.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
344 |
+
"lm.0.auto_model.encoder.block.8.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
345 |
+
"lm.0.auto_model.encoder.block.9.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors",
|
346 |
+
"lm.0.auto_model.encoder.block.9.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors",
|
347 |
+
"lm.0.auto_model.encoder.block.9.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors",
|
348 |
+
"lm.0.auto_model.encoder.block.9.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors",
|
349 |
+
"lm.0.auto_model.encoder.block.9.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors",
|
350 |
+
"lm.0.auto_model.encoder.block.9.layer.1.DenseReluDense.wi.weight": "model-00001-of-00002.safetensors",
|
351 |
+
"lm.0.auto_model.encoder.block.9.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors",
|
352 |
+
"lm.0.auto_model.encoder.block.9.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors",
|
353 |
+
"lm.0.auto_model.encoder.final_layer_norm.weight": "model-00002-of-00002.safetensors",
|
354 |
+
"lm.0.auto_model.shared.weight": "model-00001-of-00002.safetensors",
|
355 |
+
"lm.2.linear.weight": "model-00002-of-00002.safetensors"
|
356 |
+
}
|
357 |
+
}
|
module.py
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from torch import nn
|
3 |
+
|
4 |
+
from collections import OrderedDict
|
5 |
+
import logging
|
6 |
+
|
7 |
+
logger = logging.getLogger(__name__)
|
8 |
+
|
9 |
+
|
10 |
+
class LayerNorm(nn.LayerNorm):
|
11 |
+
"""Subclass torch's LayerNorm to handle fp16."""
|
12 |
+
|
13 |
+
def forward(self, x: torch.Tensor):
|
14 |
+
if self.weight.dtype != x.dtype:
|
15 |
+
orig_type = x.dtype
|
16 |
+
ret = super().forward(x.type(self.weight.dtype))
|
17 |
+
return ret.type(orig_type)
|
18 |
+
else:
|
19 |
+
return super().forward(x)
|
20 |
+
|
21 |
+
|
22 |
+
class QuickGELU(nn.Module):
|
23 |
+
def forward(self, x: torch.Tensor):
|
24 |
+
return x * torch.sigmoid(1.702 * x)
|
25 |
+
|
26 |
+
|
27 |
+
class ResidualAttentionBlock(nn.Module):
|
28 |
+
def __init__(
|
29 |
+
self,
|
30 |
+
d_model: int,
|
31 |
+
n_head: int,
|
32 |
+
attn_mask: torch.Tensor = None,
|
33 |
+
):
|
34 |
+
super().__init__()
|
35 |
+
|
36 |
+
self.attn = nn.MultiheadAttention(d_model, n_head)
|
37 |
+
self.ln_1 = LayerNorm(d_model)
|
38 |
+
self.mlp = nn.Sequential(
|
39 |
+
OrderedDict(
|
40 |
+
[
|
41 |
+
(
|
42 |
+
"c_fc",
|
43 |
+
nn.Linear(d_model, d_model * 4),
|
44 |
+
),
|
45 |
+
("gelu", QuickGELU()),
|
46 |
+
(
|
47 |
+
"c_proj",
|
48 |
+
nn.Linear(d_model * 4, d_model),
|
49 |
+
),
|
50 |
+
]
|
51 |
+
)
|
52 |
+
)
|
53 |
+
self.ln_2 = LayerNorm(d_model)
|
54 |
+
self.attn_mask = attn_mask
|
55 |
+
|
56 |
+
def attention(self, x: torch.Tensor):
|
57 |
+
self.attn_mask = (
|
58 |
+
self.attn_mask.to(dtype=x.dtype, device=x.device)
|
59 |
+
if self.attn_mask is not None
|
60 |
+
else None
|
61 |
+
)
|
62 |
+
return self.attn(
|
63 |
+
x,
|
64 |
+
x,
|
65 |
+
x,
|
66 |
+
need_weights=False,
|
67 |
+
attn_mask=self.attn_mask,
|
68 |
+
)[0]
|
69 |
+
|
70 |
+
def forward(self, x: torch.Tensor):
|
71 |
+
x = x + self.attention(self.ln_1(x))
|
72 |
+
x = x + self.mlp(self.ln_2(x))
|
73 |
+
return x
|
74 |
+
|
75 |
+
|
76 |
+
class Transformer(nn.Module):
|
77 |
+
def __init__(
|
78 |
+
self,
|
79 |
+
width: int,
|
80 |
+
layers: int,
|
81 |
+
heads: int,
|
82 |
+
attn_mask: torch.Tensor = None,
|
83 |
+
):
|
84 |
+
super().__init__()
|
85 |
+
self.width = width
|
86 |
+
self.layers = layers
|
87 |
+
self.resblocks = nn.Sequential(
|
88 |
+
*[ResidualAttentionBlock(width, heads, attn_mask) for _ in range(layers)]
|
89 |
+
)
|
90 |
+
|
91 |
+
def forward(self, x: torch.Tensor):
|
92 |
+
return self.resblocks(x)
|
93 |
+
|
94 |
+
|
95 |
+
class ConditionalViT(nn.Module):
|
96 |
+
def __init__(
|
97 |
+
self,
|
98 |
+
input_resolution: int,
|
99 |
+
patch_size: int,
|
100 |
+
width: int,
|
101 |
+
layers: int,
|
102 |
+
heads: int,
|
103 |
+
output_dim: int,
|
104 |
+
):
|
105 |
+
super().__init__()
|
106 |
+
self.input_resolution = input_resolution
|
107 |
+
self.output_dim = output_dim
|
108 |
+
self.conv1 = nn.Conv2d(
|
109 |
+
in_channels=3,
|
110 |
+
out_channels=width,
|
111 |
+
kernel_size=patch_size,
|
112 |
+
stride=patch_size,
|
113 |
+
bias=False,
|
114 |
+
)
|
115 |
+
|
116 |
+
scale = width**-0.5
|
117 |
+
|
118 |
+
self.class_embedding = nn.Parameter(scale * torch.randn(width))
|
119 |
+
|
120 |
+
self.c_pos_embedding = nn.Parameter(scale * torch.randn(1, width))
|
121 |
+
|
122 |
+
self.positional_embedding = nn.Parameter(
|
123 |
+
scale * torch.randn((input_resolution // patch_size) ** 2 + 1, width)
|
124 |
+
)
|
125 |
+
self.ln_pre = LayerNorm(width)
|
126 |
+
|
127 |
+
self.transformer = Transformer(width, layers, heads)
|
128 |
+
self.ln_post = LayerNorm(width)
|
129 |
+
self.logit_scale = torch.nn.Parameter(torch.ones([]) * 4.6052)
|
130 |
+
|
131 |
+
self.proj = nn.Linear(width, output_dim, bias=False)
|
132 |
+
|
133 |
+
def forward(self, imgs: torch.Tensor, c: torch.Tensor = None):
|
134 |
+
"""
|
135 |
+
imgs : Batch of images
|
136 |
+
c : Text embedding.
|
137 |
+
"""
|
138 |
+
|
139 |
+
x = self.conv1(imgs) # shape = [*, width, grid, grid]
|
140 |
+
# shape = [*, width, grid ** 2]
|
141 |
+
x = x.reshape(x.shape[0], x.shape[1], -1)
|
142 |
+
x = x.permute(0, 2, 1) # shape = [*, grid ** 2, width]
|
143 |
+
|
144 |
+
# Gather CLS, Grid, maybe CAT, and positional embedding
|
145 |
+
tokens = [self.class_embedding.tile(x.shape[0], 1, 1), x] # NLD
|
146 |
+
pos_embed = [self.positional_embedding] # LD
|
147 |
+
|
148 |
+
if c is not None:
|
149 |
+
pos_embed += [self.c_pos_embedding] # +1D -> N1D
|
150 |
+
tokens += [c.unsqueeze(1)]
|
151 |
+
|
152 |
+
x = torch.cat(tokens, dim=1) # shape = [*, grid ** 2 + 1|2, width] = N(L|L+1)D
|
153 |
+
pos_embed = torch.cat(pos_embed, dim=0).unsqueeze(0) # 1(L|L+1)D
|
154 |
+
|
155 |
+
x = x + pos_embed
|
156 |
+
x = self.ln_pre(x)
|
157 |
+
|
158 |
+
x = x.permute(1, 0, 2) # NLD -> LND
|
159 |
+
|
160 |
+
x = self.transformer(x)
|
161 |
+
x = x.permute(1, 0, 2) # LND -> NLD
|
162 |
+
|
163 |
+
x = self.ln_post(x[:, 0, :])
|
164 |
+
|
165 |
+
x = self.proj(x)
|
166 |
+
|
167 |
+
return x
|