Upload model
Browse files- configuration_cxrmate_ed.py +16 -1
configuration_cxrmate_ed.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import transformers
|
|
|
2 |
|
3 |
|
4 |
class CXRMateEDConfig(transformers.PretrainedConfig):
|
@@ -21,7 +22,7 @@ class CXRMateEDConfig(transformers.PretrainedConfig):
|
|
21 |
):
|
22 |
super().__init__(**kwargs)
|
23 |
self.vision_config = vision_config
|
24 |
-
|
25 |
self.index_value_encoder_intermediate_size = index_value_encoder_intermediate_size
|
26 |
self.include_time_delta = include_time_delta
|
27 |
self.time_delta_monotonic_inversion = time_delta_monotonic_inversion
|
@@ -31,6 +32,20 @@ class CXRMateEDConfig(transformers.PretrainedConfig):
|
|
31 |
self.prompt_report_sections_filter = prompt_report_sections_filter
|
32 |
self.pad_token_id = pad_token_id
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
# class CXRMateEDConfig(transformers.PretrainedConfig):
|
36 |
|
|
|
1 |
import transformers
|
2 |
+
from transformers.models.auto import CONFIG_MAPPING
|
3 |
|
4 |
|
5 |
class CXRMateEDConfig(transformers.PretrainedConfig):
|
|
|
22 |
):
|
23 |
super().__init__(**kwargs)
|
24 |
self.vision_config = vision_config
|
25 |
+
|
26 |
self.index_value_encoder_intermediate_size = index_value_encoder_intermediate_size
|
27 |
self.include_time_delta = include_time_delta
|
28 |
self.time_delta_monotonic_inversion = time_delta_monotonic_inversion
|
|
|
32 |
self.prompt_report_sections_filter = prompt_report_sections_filter
|
33 |
self.pad_token_id = pad_token_id
|
34 |
|
35 |
+
if isinstance(vision_config, dict):
|
36 |
+
vision_config = transformers.AutoConfig.from_pretrained(
|
37 |
+
'aehrc/uniformer_base_tl_384',
|
38 |
+
trust_remote_code=True,
|
39 |
+
**vision_config,
|
40 |
+
)
|
41 |
+
|
42 |
+
self.vision_config = vision_config
|
43 |
+
|
44 |
+
if isinstance(text_config, dict):
|
45 |
+
text_config['model_type'] = text_config['model_type'] if 'model_type' in text_config else 'llama'
|
46 |
+
text_config = CONFIG_MAPPING[text_config['model_type']](**text_config)
|
47 |
+
|
48 |
+
self.text_config = text_config
|
49 |
|
50 |
# class CXRMateEDConfig(transformers.PretrainedConfig):
|
51 |
|