Upload model
Browse files- config.json +132 -8
- configuration_cxrmate_ed.py +8 -7
config.json
CHANGED
@@ -9,14 +9,10 @@
|
|
9 |
},
|
10 |
"hidden_size": 768,
|
11 |
"history": 0,
|
12 |
-
"ignore_index": -100,
|
13 |
-
"image_seq_length": 576,
|
14 |
-
"image_token_index": 32000,
|
15 |
"include_time_delta": true,
|
16 |
"index_value_encoder_intermediate_size": 2048,
|
17 |
"model_type": "cxrmate-ed",
|
18 |
"pad_token_id": 4,
|
19 |
-
"projector_hidden_act": "gelu",
|
20 |
"prompt_report_sections_filter": [
|
21 |
"indication",
|
22 |
"history"
|
@@ -27,20 +23,94 @@
|
|
27 |
"medrecon"
|
28 |
],
|
29 |
"text_config": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
"head_dim": 64,
|
|
|
31 |
"hidden_size": 768,
|
|
|
|
|
|
|
|
|
|
|
32 |
"intermediate_size": 3072,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
"model_type": "llama",
|
|
|
34 |
"num_attention_heads": 12,
|
|
|
|
|
35 |
"num_hidden_layers": 6,
|
36 |
"num_key_value_heads": 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
"vocab_size": 30000
|
38 |
},
|
39 |
"time_delta_monotonic_inversion": true,
|
40 |
"torch_dtype": "float32",
|
41 |
"transformers_version": "4.47.0",
|
42 |
"vision_config": {
|
|
|
43 |
"_name_or_path": "aehrc/uniformer_base_tl_384",
|
|
|
44 |
"architectures": [
|
45 |
"UniFormerModel"
|
46 |
],
|
@@ -49,42 +119,96 @@
|
|
49 |
"AutoConfig": "aehrc/uniformer_base_tl_384--configuration_uniformer.UniFormerWithProjectionHeadConfig",
|
50 |
"AutoModel": "aehrc/uniformer_base_tl_384--modelling_uniformer.UniFormerModel"
|
51 |
},
|
|
|
|
|
|
|
|
|
52 |
"conv_stem": false,
|
|
|
|
|
53 |
"depth": [
|
54 |
5,
|
55 |
8,
|
56 |
20,
|
57 |
7
|
58 |
],
|
|
|
|
|
59 |
"drop_path_rate": 0.3,
|
60 |
"drop_rate": 0.0,
|
|
|
61 |
"embed_dim": [
|
62 |
64,
|
63 |
128,
|
64 |
320,
|
65 |
512
|
66 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
"head_dim": 64,
|
|
|
|
|
|
|
|
|
68 |
"image_size": 384,
|
69 |
"in_chans": 3,
|
70 |
"init_value": 1e-06,
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
"layer_norm_eps": 1e-06,
|
72 |
"layer_scale": false,
|
|
|
|
|
|
|
73 |
"mlp_ratio": 4,
|
74 |
"model_type": "uniformer",
|
|
|
|
|
|
|
75 |
"num_classes": 1000,
|
|
|
|
|
|
|
|
|
|
|
76 |
"patch_size": [
|
77 |
4,
|
78 |
2,
|
79 |
2,
|
80 |
2
|
81 |
],
|
|
|
|
|
82 |
"projection_size": null,
|
|
|
83 |
"qk_scale": null,
|
84 |
"qkv_bias": true,
|
|
|
|
|
85 |
"representation_size": null,
|
86 |
-
"
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
|
|
9 |
},
|
10 |
"hidden_size": 768,
|
11 |
"history": 0,
|
|
|
|
|
|
|
12 |
"include_time_delta": true,
|
13 |
"index_value_encoder_intermediate_size": 2048,
|
14 |
"model_type": "cxrmate-ed",
|
15 |
"pad_token_id": 4,
|
|
|
16 |
"prompt_report_sections_filter": [
|
17 |
"indication",
|
18 |
"history"
|
|
|
23 |
"medrecon"
|
24 |
],
|
25 |
"text_config": {
|
26 |
+
"_attn_implementation_autoset": false,
|
27 |
+
"_name_or_path": "",
|
28 |
+
"add_cross_attention": false,
|
29 |
+
"architectures": null,
|
30 |
+
"attention_bias": false,
|
31 |
+
"attention_dropout": 0.0,
|
32 |
+
"bad_words_ids": null,
|
33 |
+
"begin_suppress_tokens": null,
|
34 |
+
"bos_token_id": 1,
|
35 |
+
"chunk_size_feed_forward": 0,
|
36 |
+
"cross_attention_hidden_size": null,
|
37 |
+
"decoder_start_token_id": null,
|
38 |
+
"diversity_penalty": 0.0,
|
39 |
+
"do_sample": false,
|
40 |
+
"early_stopping": false,
|
41 |
+
"encoder_no_repeat_ngram_size": 0,
|
42 |
+
"eos_token_id": 2,
|
43 |
+
"exponential_decay_length_penalty": null,
|
44 |
+
"finetuning_task": null,
|
45 |
+
"forced_bos_token_id": null,
|
46 |
+
"forced_eos_token_id": null,
|
47 |
"head_dim": 64,
|
48 |
+
"hidden_act": "silu",
|
49 |
"hidden_size": 768,
|
50 |
+
"id2label": {
|
51 |
+
"0": "LABEL_0",
|
52 |
+
"1": "LABEL_1"
|
53 |
+
},
|
54 |
+
"initializer_range": 0.02,
|
55 |
"intermediate_size": 3072,
|
56 |
+
"is_decoder": false,
|
57 |
+
"is_encoder_decoder": false,
|
58 |
+
"label2id": {
|
59 |
+
"LABEL_0": 0,
|
60 |
+
"LABEL_1": 1
|
61 |
+
},
|
62 |
+
"length_penalty": 1.0,
|
63 |
+
"max_length": 20,
|
64 |
+
"max_position_embeddings": 2048,
|
65 |
+
"min_length": 0,
|
66 |
+
"mlp_bias": false,
|
67 |
"model_type": "llama",
|
68 |
+
"no_repeat_ngram_size": 0,
|
69 |
"num_attention_heads": 12,
|
70 |
+
"num_beam_groups": 1,
|
71 |
+
"num_beams": 1,
|
72 |
"num_hidden_layers": 6,
|
73 |
"num_key_value_heads": 12,
|
74 |
+
"num_return_sequences": 1,
|
75 |
+
"output_attentions": false,
|
76 |
+
"output_hidden_states": false,
|
77 |
+
"output_scores": false,
|
78 |
+
"pad_token_id": null,
|
79 |
+
"prefix": null,
|
80 |
+
"pretraining_tp": 1,
|
81 |
+
"problem_type": null,
|
82 |
+
"pruned_heads": {},
|
83 |
+
"remove_invalid_values": false,
|
84 |
+
"repetition_penalty": 1.0,
|
85 |
+
"return_dict": true,
|
86 |
+
"return_dict_in_generate": false,
|
87 |
+
"rms_norm_eps": 1e-06,
|
88 |
+
"rope_scaling": null,
|
89 |
+
"rope_theta": 10000.0,
|
90 |
+
"sep_token_id": null,
|
91 |
+
"suppress_tokens": null,
|
92 |
+
"task_specific_params": null,
|
93 |
+
"temperature": 1.0,
|
94 |
+
"tf_legacy_loss": false,
|
95 |
+
"tie_encoder_decoder": false,
|
96 |
+
"tie_word_embeddings": false,
|
97 |
+
"tokenizer_class": null,
|
98 |
+
"top_k": 50,
|
99 |
+
"top_p": 1.0,
|
100 |
+
"torch_dtype": null,
|
101 |
+
"torchscript": false,
|
102 |
+
"typical_p": 1.0,
|
103 |
+
"use_bfloat16": false,
|
104 |
+
"use_cache": true,
|
105 |
"vocab_size": 30000
|
106 |
},
|
107 |
"time_delta_monotonic_inversion": true,
|
108 |
"torch_dtype": "float32",
|
109 |
"transformers_version": "4.47.0",
|
110 |
"vision_config": {
|
111 |
+
"_attn_implementation_autoset": false,
|
112 |
"_name_or_path": "aehrc/uniformer_base_tl_384",
|
113 |
+
"add_cross_attention": false,
|
114 |
"architectures": [
|
115 |
"UniFormerModel"
|
116 |
],
|
|
|
119 |
"AutoConfig": "aehrc/uniformer_base_tl_384--configuration_uniformer.UniFormerWithProjectionHeadConfig",
|
120 |
"AutoModel": "aehrc/uniformer_base_tl_384--modelling_uniformer.UniFormerModel"
|
121 |
},
|
122 |
+
"bad_words_ids": null,
|
123 |
+
"begin_suppress_tokens": null,
|
124 |
+
"bos_token_id": null,
|
125 |
+
"chunk_size_feed_forward": 0,
|
126 |
"conv_stem": false,
|
127 |
+
"cross_attention_hidden_size": null,
|
128 |
+
"decoder_start_token_id": null,
|
129 |
"depth": [
|
130 |
5,
|
131 |
8,
|
132 |
20,
|
133 |
7
|
134 |
],
|
135 |
+
"diversity_penalty": 0.0,
|
136 |
+
"do_sample": false,
|
137 |
"drop_path_rate": 0.3,
|
138 |
"drop_rate": 0.0,
|
139 |
+
"early_stopping": false,
|
140 |
"embed_dim": [
|
141 |
64,
|
142 |
128,
|
143 |
320,
|
144 |
512
|
145 |
],
|
146 |
+
"encoder_no_repeat_ngram_size": 0,
|
147 |
+
"eos_token_id": null,
|
148 |
+
"exponential_decay_length_penalty": null,
|
149 |
+
"finetuning_task": null,
|
150 |
+
"forced_bos_token_id": null,
|
151 |
+
"forced_eos_token_id": null,
|
152 |
"head_dim": 64,
|
153 |
+
"id2label": {
|
154 |
+
"0": "LABEL_0",
|
155 |
+
"1": "LABEL_1"
|
156 |
+
},
|
157 |
"image_size": 384,
|
158 |
"in_chans": 3,
|
159 |
"init_value": 1e-06,
|
160 |
+
"is_decoder": false,
|
161 |
+
"is_encoder_decoder": false,
|
162 |
+
"label2id": {
|
163 |
+
"LABEL_0": 0,
|
164 |
+
"LABEL_1": 1
|
165 |
+
},
|
166 |
"layer_norm_eps": 1e-06,
|
167 |
"layer_scale": false,
|
168 |
+
"length_penalty": 1.0,
|
169 |
+
"max_length": 20,
|
170 |
+
"min_length": 0,
|
171 |
"mlp_ratio": 4,
|
172 |
"model_type": "uniformer",
|
173 |
+
"no_repeat_ngram_size": 0,
|
174 |
+
"num_beam_groups": 1,
|
175 |
+
"num_beams": 1,
|
176 |
"num_classes": 1000,
|
177 |
+
"num_return_sequences": 1,
|
178 |
+
"output_attentions": false,
|
179 |
+
"output_hidden_states": false,
|
180 |
+
"output_scores": false,
|
181 |
+
"pad_token_id": null,
|
182 |
"patch_size": [
|
183 |
4,
|
184 |
2,
|
185 |
2,
|
186 |
2
|
187 |
],
|
188 |
+
"prefix": null,
|
189 |
+
"problem_type": null,
|
190 |
"projection_size": null,
|
191 |
+
"pruned_heads": {},
|
192 |
"qk_scale": null,
|
193 |
"qkv_bias": true,
|
194 |
+
"remove_invalid_values": false,
|
195 |
+
"repetition_penalty": 1.0,
|
196 |
"representation_size": null,
|
197 |
+
"return_dict": true,
|
198 |
+
"return_dict_in_generate": false,
|
199 |
+
"sep_token_id": null,
|
200 |
+
"suppress_tokens": null,
|
201 |
+
"task_specific_params": null,
|
202 |
+
"temperature": 1.0,
|
203 |
+
"tf_legacy_loss": false,
|
204 |
+
"tie_encoder_decoder": false,
|
205 |
+
"tie_word_embeddings": true,
|
206 |
+
"tokenizer_class": null,
|
207 |
+
"top_k": 50,
|
208 |
+
"top_p": 1.0,
|
209 |
+
"torch_dtype": "float32",
|
210 |
+
"torchscript": false,
|
211 |
+
"typical_p": 1.0,
|
212 |
+
"use_bfloat16": false
|
213 |
+
}
|
214 |
}
|
configuration_cxrmate_ed.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
from typing import Any
|
2 |
|
3 |
-
|
4 |
|
5 |
|
6 |
-
class CXRMateEDConfig(
|
7 |
|
8 |
model_type = 'cxrmate-ed'
|
9 |
|
@@ -51,7 +51,10 @@ class CXRMateEDConfig(LlavaConfig):
|
|
51 |
pad_token_id: int = 4,
|
52 |
**kwargs,
|
53 |
):
|
|
|
54 |
|
|
|
|
|
55 |
self.index_value_encoder_intermediate_size = index_value_encoder_intermediate_size
|
56 |
self.include_time_delta = include_time_delta
|
57 |
self.time_delta_monotonic_inversion = time_delta_monotonic_inversion
|
@@ -61,8 +64,9 @@ class CXRMateEDConfig(LlavaConfig):
|
|
61 |
self.prompt_report_sections_filter = prompt_report_sections_filter
|
62 |
self.pad_token_id = pad_token_id
|
63 |
|
64 |
-
self.hidden_size = self.text_config.hidden_size
|
65 |
|
|
|
66 |
# self.ignore_index = ignore_index
|
67 |
# self.image_token_index = image_token_index
|
68 |
# self.projector_hidden_act = projector_hidden_act
|
@@ -94,7 +98,6 @@ class CXRMateEDConfig(LlavaConfig):
|
|
94 |
# projection_dim=768,
|
95 |
# )
|
96 |
|
97 |
-
self.vision_config = vision_config
|
98 |
|
99 |
# if isinstance(text_config, dict):
|
100 |
# text_config["model_type"] = text_config["model_type"] if "model_type" in text_config else "llama"
|
@@ -102,9 +105,7 @@ class CXRMateEDConfig(LlavaConfig):
|
|
102 |
# elif text_config is None:
|
103 |
# text_config = CONFIG_MAPPING["llama"]()
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
super().__init__(**kwargs)
|
108 |
|
109 |
|
110 |
# import transformers
|
|
|
1 |
from typing import Any
|
2 |
|
3 |
+
import transformers
|
4 |
|
5 |
|
6 |
+
class CXRMateEDConfig(transformers.PretrainedConfig):
|
7 |
|
8 |
model_type = 'cxrmate-ed'
|
9 |
|
|
|
51 |
pad_token_id: int = 4,
|
52 |
**kwargs,
|
53 |
):
|
54 |
+
transformers.PretrainedConfig.__init__(self, **kwargs)
|
55 |
|
56 |
+
self.vision_config = vision_config
|
57 |
+
self.text_config = text_config
|
58 |
self.index_value_encoder_intermediate_size = index_value_encoder_intermediate_size
|
59 |
self.include_time_delta = include_time_delta
|
60 |
self.time_delta_monotonic_inversion = time_delta_monotonic_inversion
|
|
|
64 |
self.prompt_report_sections_filter = prompt_report_sections_filter
|
65 |
self.pad_token_id = pad_token_id
|
66 |
|
67 |
+
self.hidden_size = self.text_config.hidden_size if self.text_config is not None else None
|
68 |
|
69 |
+
|
70 |
# self.ignore_index = ignore_index
|
71 |
# self.image_token_index = image_token_index
|
72 |
# self.projector_hidden_act = projector_hidden_act
|
|
|
98 |
# projection_dim=768,
|
99 |
# )
|
100 |
|
|
|
101 |
|
102 |
# if isinstance(text_config, dict):
|
103 |
# text_config["model_type"] = text_config["model_type"] if "model_type" in text_config else "llama"
|
|
|
105 |
# elif text_config is None:
|
106 |
# text_config = CONFIG_MAPPING["llama"]()
|
107 |
|
108 |
+
# super().__init__(**kwargs)
|
|
|
|
|
109 |
|
110 |
|
111 |
# import transformers
|