File size: 6,616 Bytes
ca066a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40a1f37
 
ca066a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
T5_SHUNT_REPOS = {
    "clip_g": {
        "models": ["vit-bigG-14", 'flan-t5-base'],
        "config": {
            "adapter_id": "003", "name": "DualShuntAdapter-G",
            "t5": {
                "model": "google/flan-t5-base",
                "hidden_size": 768
            },
            "clip": {
                "model": "openai/clip-vit-large-patch14",
                "hidden_size": 1280
            },
            "hidden_size": 1280,  # This is the adapter's output size
            "bottleneck": 640, "heads": 20,
            "tau_init": 0.1, "max_guidance": 10.0,
            "proj_layers": 2, "layer_norm": True, "dropout": 0.1,
            "use_dropout": True, "use_proj_stack": True, "assert_input_dims": True,
            "routing": {"type": "cross_attention", "enable_causal_mask": False, "bidirectional": True},
            "version": "v0.3.2"
        },
        "repo": "AbstractPhil/t5-flan-base-vit-bigG-14-dual-stream-adapter",
        "shunts_available": {
            "shunt_type_name": "DualStreamAdapter-G",
            "config_file_name": "config.json",
            "shunt_list": [
                "t5-flan-vit-bigG-14-dual_shunt_caption.safetensors",
                "t5-flan-vit-bigG-14-dual_shunt_no_caption_e1.safetensors",
                "t5-flan-vit-bigG-14-dual_shunt_no_caption_e2.safetensors",
                "t5-flan-vit-bigG-14-dual_shunt_no_caption_e3.safetensors",
                "t5-flan-vit-bigG-14-dual_shunt_summarize.safetensors",
                "dual_shunt_omega_no_caption_e1_step_10000.safetensors",
                "dual_shunt_omega_no_caption_noised_e1_step_1000.safetensors",
                "dual_shunt_omega_no_caption_noised_e1_step_4000.safetensors",
                "dual_shunt_omega_no_caption_noised_e1_step_10000.safetensors",
            ],
        }
    },
    "clip_l": {
        "models": ["vit-l-14", 'flan-t5-base'],
        "config": {
            "adapter_id": "002",
            "name": "DualShuntAdapter",
            "t5": {"model": "google/flan-t5-base", "hidden_size": 768},
            "clip": {"model": "openai/clip-vit-large-patch14", "hidden_size": 768},
            "hidden_size": 768,  # This is the adapter's output size
            "bottleneck": 384, "heads": 12,
            "tau_init": 0.1, "max_guidance": 10.0,
            "proj_layers": 2, "layer_norm": True, "dropout": 0.1,
            "use_dropout": True, "use_proj_stack": True, "assert_input_dims": True,
            "routing": {"type": "cross_attention", "enable_causal_mask": False, "bidirectional": True},
            "version": "v0.3.2"
        },
        "repo": "AbstractPhil/t5-flan-base-vit-l-14-dual-stream-adapter",
        "shunts_available": {
            "shunt_type_name": "DualStreamAdapter-L",
            "config_file_name": "config.json",
            "shunt_list": [
                "t5-vit-l-14-dual_shunt_caption.safetensors",
                "t5-vit-l-14-dual_shunt_no_caption.safetensors",
                "t5-vit-l-14-dual_shunt_summarize.safetensors",
                "t5-vit-l-14-dual_shunt_booru_13_000_000.safetensors",
                "t5-vit-l-14-dual_shunt_booru_51_200_000.safetensors",
            ],
        },
    }
}

# ─── Adapter Configs ─────────────────────────────────────────────

BERT_CONFIGS = {
    "mobilebert-base-uncased": {
        "repo_name": "google/mobilebert-uncased",
        "use_huggingface": True,  # defaults to simple loading from HuggingFace, if False, will use repo_name and subfolder
        "subfolder": "",
    },
    "bert-base-uncased": {
        "repo_name": "bert-base-uncased",
        "use_huggingface": True,  # defaults to simple loading from HuggingFace, if False, will use repo_name and subfolder
    },
    "bert-large-uncased": {
        "repo_name": "bert-large-uncased",
        "use_huggingface": True,  # defaults to simple loading from HuggingFace, if False, will use repo_name and subfolder
    },
    "bert-base-cased": {
        "repo_name": "bert-base-cased",
        "use_huggingface": True,  # defaults to simple loading from HuggingFace, if False, will use repo_name and subfolder
    }
}

T5_CONFIGS = {
    "flan-t5-base": {
        "repo_name": "google/flan-t5-base",
        "use_huggingface": True, # defaults to simple loading from HuggingFace, if False, will use repo_name and subfolder
    },
    "t5-small": {
        "repo_name": "google-t5/t5-small",
        "use_huggingface": True, # defaults to simple loading from HuggingFace, if False, will use repo_name and subfolder

    },
    "t5_small_human_attentive_try2_pass3": {
        "repo_name": "AbstractPhil/t5_small_human_attentive_try2_pass3",
        "use_huggingface": True, # defaults to simple loading from HuggingFace, if False, will use repo_name and subfolder
        # the necessary config is present here for posterity in case it fails to load from HuggingFace.
        "subfolder": "",
        "tokenizer": "t5-small",
        "file_name": "model.safetensors",
        "config": {
              "config_file_name": "config.json",
              "architectures": [
                "T5ForConditionalGeneration"
              ],
              "attention_dropout": 0.3,
              "classifier_dropout": 0.0,
              "d_ff": 2048,
              "d_kv": 64,
              "d_model": 512,
              "decoder_start_token_id": 0,
              "dense_act_fn": "relu",
              "dropout_rate": 0.0, #0.3,                  # disable for generation
              "eos_token_id": 1,
              "feed_forward_proj": "relu",
              "initializer_factor": 1.0,
              "is_encoder_decoder": True,
              "is_gated_act": False,
              "layer_norm_epsilon": 1e-06,
              "model_type": "t5",
              "n_positions": 512,
              "num_decoder_layers": 6,
              "num_heads": 8,
              "num_layers": 6,
              "output_past": True,
              "pad_token_id": 0,
              "relative_attention_max_distance": 128,
              "relative_attention_num_buckets": 32,
              "task_specific_params": {
                "caption": {
                  "early_stopping": True,
                  "length_penalty": 1.0,
                  "max_length": 64,
                  "num_beams": 4,
                  "prefix": "caption: "
                }
              },
              "torch_dtype": "float32",
              "transformers_version": "4.51.3",
              "use_cache": True,
              "vocab_size": 32128
        }
    }
}