Cuiunbo commited on
Commit
f6e91f3
1 Parent(s): 89c9b34

Upload configuration_minicpmv.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. configuration_minicpmv.py +50 -0
configuration_minicpmv.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 Rhapsody AI and ModelBest Inc. All rights reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from transformers import PretrainedConfig
17
+
18
+ from .modeling_siglip import SiglipVisionConfig
19
+ # from .modeling_minicpm import MiniCPMConfig
20
+ from .configuration_minicpm import MiniCPMConfig
21
+ from .configuration_siglip import SiglipVisionConfig
22
+
23
+ from transformers.utils import logging
24
+
25
+ logger = logging.get_logger(__name__)
26
+
27
+
28
+ class MiniCPMVConfig(PretrainedConfig):
29
+ model_type = "minicpmv"
30
+
31
+ def __init__(self, vpm_config=None, llm_config=None, query_num=64, drop_vision_last_layer=False, slice_mode=True, max_slice_nums=9, mm_use_im_start_end=True, **kwargs):
32
+ super().__init__(**kwargs)
33
+
34
+ if vpm_config is None:
35
+ vpm_config = {}
36
+ logger.info("`vpm_config` is `None`. Initializing the `SiglipVisionConfig` with default values.")
37
+
38
+ if llm_config is None:
39
+ llm_config = {}
40
+ logger.info("`llm_config` is `None`. initializing the `MiniCPMConfig` with default values.")
41
+
42
+ self.llm_config = MiniCPMConfig(**llm_config)
43
+ self.vpm_config = SiglipVisionConfig(**vpm_config)
44
+
45
+ self.query_num = query_num
46
+ self.drop_vision_last_layer = drop_vision_last_layer
47
+ self.slice_mode = slice_mode
48
+ self.max_slice_nums = max_slice_nums
49
+ self.mm_use_im_start_end = mm_use_im_start_end
50
+