Delete .ipynb_checkpoints
Browse files
.ipynb_checkpoints/config-checkpoint.json
DELETED
|
@@ -1,209 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"_commit_hash": null,
|
| 3 |
-
"_name_or_path": "/mnt/datasets_vlm/tianxie/LLM_Quantization/Skywork-R1V3-38B",
|
| 4 |
-
"architectures": [
|
| 5 |
-
"SkyworkChatModel"
|
| 6 |
-
],
|
| 7 |
-
"auto_map": {
|
| 8 |
-
"AutoConfig": "configuration_skywork_chat.SkyworkChatConfig",
|
| 9 |
-
"AutoModel": "modeling_skywork_chat.SkyworkChatModel",
|
| 10 |
-
"AutoModelForCausalLM": "modeling_skywork_chat.SkyworkChatModel"
|
| 11 |
-
},
|
| 12 |
-
"downsample_ratio": 0.5,
|
| 13 |
-
"dynamic_image_size": true,
|
| 14 |
-
"force_image_size": 448,
|
| 15 |
-
"freeze_adapter": false,
|
| 16 |
-
"freeze_llm": false,
|
| 17 |
-
"freeze_vision": false,
|
| 18 |
-
"hidden_size": 5120,
|
| 19 |
-
"llm_config": {
|
| 20 |
-
"_attn_implementation_autoset": true,
|
| 21 |
-
"_name_or_path": "",
|
| 22 |
-
"add_cross_attention": false,
|
| 23 |
-
"architectures": [
|
| 24 |
-
"Qwen2ForCausalLM"
|
| 25 |
-
],
|
| 26 |
-
"attention_dropout": 0.0,
|
| 27 |
-
"attn_implementation": "eager",
|
| 28 |
-
"bad_words_ids": null,
|
| 29 |
-
"begin_suppress_tokens": null,
|
| 30 |
-
"bos_token_id": 151643,
|
| 31 |
-
"chunk_size_feed_forward": 0,
|
| 32 |
-
"cross_attention_hidden_size": null,
|
| 33 |
-
"decoder_start_token_id": null,
|
| 34 |
-
"diversity_penalty": 0.0,
|
| 35 |
-
"do_sample": false,
|
| 36 |
-
"early_stopping": false,
|
| 37 |
-
"encoder_no_repeat_ngram_size": 0,
|
| 38 |
-
"eos_token_id": 151645,
|
| 39 |
-
"exponential_decay_length_penalty": null,
|
| 40 |
-
"finetuning_task": null,
|
| 41 |
-
"forced_bos_token_id": null,
|
| 42 |
-
"forced_eos_token_id": null,
|
| 43 |
-
"hidden_act": "silu",
|
| 44 |
-
"hidden_size": 5120,
|
| 45 |
-
"id2label": {
|
| 46 |
-
"0": "LABEL_0",
|
| 47 |
-
"1": "LABEL_1"
|
| 48 |
-
},
|
| 49 |
-
"initializer_range": 0.02,
|
| 50 |
-
"intermediate_size": 27648,
|
| 51 |
-
"is_decoder": false,
|
| 52 |
-
"is_encoder_decoder": false,
|
| 53 |
-
"label2id": {
|
| 54 |
-
"LABEL_0": 0,
|
| 55 |
-
"LABEL_1": 1
|
| 56 |
-
},
|
| 57 |
-
"length_penalty": 1.0,
|
| 58 |
-
"max_length": 20,
|
| 59 |
-
"max_position_embeddings": 32768,
|
| 60 |
-
"max_window_layers": 70,
|
| 61 |
-
"min_length": 0,
|
| 62 |
-
"model_type": "qwen2",
|
| 63 |
-
"no_repeat_ngram_size": 0,
|
| 64 |
-
"num_attention_heads": 40,
|
| 65 |
-
"num_beam_groups": 1,
|
| 66 |
-
"num_beams": 1,
|
| 67 |
-
"num_hidden_layers": 64,
|
| 68 |
-
"num_key_value_heads": 8,
|
| 69 |
-
"num_return_sequences": 1,
|
| 70 |
-
"output_attentions": false,
|
| 71 |
-
"output_hidden_states": false,
|
| 72 |
-
"output_scores": false,
|
| 73 |
-
"pad_token_id": null,
|
| 74 |
-
"prefix": null,
|
| 75 |
-
"problem_type": null,
|
| 76 |
-
"pruned_heads": {},
|
| 77 |
-
"quantization_config": {
|
| 78 |
-
"bits": 4,
|
| 79 |
-
"group_size": 128,
|
| 80 |
-
"quant_method": "awq",
|
| 81 |
-
"version": "gemm",
|
| 82 |
-
"zero_point": true
|
| 83 |
-
},
|
| 84 |
-
"remove_invalid_values": false,
|
| 85 |
-
"repetition_penalty": 1.0,
|
| 86 |
-
"return_dict": true,
|
| 87 |
-
"return_dict_in_generate": false,
|
| 88 |
-
"rms_norm_eps": 1e-06,
|
| 89 |
-
"rope_scaling": null,
|
| 90 |
-
"rope_theta": 1000000.0,
|
| 91 |
-
"sep_token_id": null,
|
| 92 |
-
"sliding_window": null,
|
| 93 |
-
"suppress_tokens": null,
|
| 94 |
-
"task_specific_params": null,
|
| 95 |
-
"temperature": 1.0,
|
| 96 |
-
"tf_legacy_loss": false,
|
| 97 |
-
"tie_encoder_decoder": false,
|
| 98 |
-
"tie_word_embeddings": false,
|
| 99 |
-
"tokenizer_class": null,
|
| 100 |
-
"top_k": 50,
|
| 101 |
-
"top_p": 1.0,
|
| 102 |
-
"torch_dtype": "bfloat16",
|
| 103 |
-
"torchscript": false,
|
| 104 |
-
"transformers_version": "4.46.3",
|
| 105 |
-
"typical_p": 1.0,
|
| 106 |
-
"use_bfloat16": true,
|
| 107 |
-
"use_cache": false,
|
| 108 |
-
"use_sliding_window": false,
|
| 109 |
-
"vocab_size": 151674
|
| 110 |
-
},
|
| 111 |
-
"max_dynamic_patch": 6,
|
| 112 |
-
"min_dynamic_patch": 1,
|
| 113 |
-
"model_type": "skywork_chat",
|
| 114 |
-
"pad2square": false,
|
| 115 |
-
"ps_version": "v2",
|
| 116 |
-
"select_layer": -1,
|
| 117 |
-
"template": "skywork-r1v-chat",
|
| 118 |
-
"tie_word_embeddings": false,
|
| 119 |
-
"torch_dtype": "float16",
|
| 120 |
-
"transformers_version": null,
|
| 121 |
-
"use_backbone_lora": 0,
|
| 122 |
-
"use_llm_lora": 0,
|
| 123 |
-
"use_thumbnail": true,
|
| 124 |
-
"vision_config": {
|
| 125 |
-
"_attn_implementation_autoset": true,
|
| 126 |
-
"_name_or_path": "",
|
| 127 |
-
"add_cross_attention": false,
|
| 128 |
-
"architectures": [
|
| 129 |
-
"InternVisionModel"
|
| 130 |
-
],
|
| 131 |
-
"attention_dropout": 0.0,
|
| 132 |
-
"bad_words_ids": null,
|
| 133 |
-
"begin_suppress_tokens": null,
|
| 134 |
-
"bos_token_id": null,
|
| 135 |
-
"chunk_size_feed_forward": 0,
|
| 136 |
-
"cross_attention_hidden_size": null,
|
| 137 |
-
"decoder_start_token_id": null,
|
| 138 |
-
"diversity_penalty": 0.0,
|
| 139 |
-
"do_sample": false,
|
| 140 |
-
"drop_path_rate": 0.1,
|
| 141 |
-
"dropout": 0.0,
|
| 142 |
-
"early_stopping": false,
|
| 143 |
-
"encoder_no_repeat_ngram_size": 0,
|
| 144 |
-
"eos_token_id": null,
|
| 145 |
-
"exponential_decay_length_penalty": null,
|
| 146 |
-
"finetuning_task": null,
|
| 147 |
-
"forced_bos_token_id": null,
|
| 148 |
-
"forced_eos_token_id": null,
|
| 149 |
-
"hidden_act": "gelu",
|
| 150 |
-
"hidden_size": 3200,
|
| 151 |
-
"id2label": {
|
| 152 |
-
"0": "LABEL_0",
|
| 153 |
-
"1": "LABEL_1"
|
| 154 |
-
},
|
| 155 |
-
"image_size": 448,
|
| 156 |
-
"initializer_factor": 0.1,
|
| 157 |
-
"initializer_range": 1e-10,
|
| 158 |
-
"intermediate_size": 12800,
|
| 159 |
-
"is_decoder": false,
|
| 160 |
-
"is_encoder_decoder": false,
|
| 161 |
-
"label2id": {
|
| 162 |
-
"LABEL_0": 0,
|
| 163 |
-
"LABEL_1": 1
|
| 164 |
-
},
|
| 165 |
-
"layer_norm_eps": 1e-06,
|
| 166 |
-
"length_penalty": 1.0,
|
| 167 |
-
"max_length": 20,
|
| 168 |
-
"min_length": 0,
|
| 169 |
-
"model_type": "",
|
| 170 |
-
"no_repeat_ngram_size": 0,
|
| 171 |
-
"norm_type": "rms_norm",
|
| 172 |
-
"num_attention_heads": 25,
|
| 173 |
-
"num_beam_groups": 1,
|
| 174 |
-
"num_beams": 1,
|
| 175 |
-
"num_channels": 3,
|
| 176 |
-
"num_hidden_layers": 45,
|
| 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": 14,
|
| 183 |
-
"prefix": null,
|
| 184 |
-
"problem_type": null,
|
| 185 |
-
"pruned_heads": {},
|
| 186 |
-
"qk_normalization": true,
|
| 187 |
-
"qkv_bias": false,
|
| 188 |
-
"remove_invalid_values": false,
|
| 189 |
-
"repetition_penalty": 1.0,
|
| 190 |
-
"return_dict": true,
|
| 191 |
-
"return_dict_in_generate": false,
|
| 192 |
-
"sep_token_id": null,
|
| 193 |
-
"suppress_tokens": null,
|
| 194 |
-
"task_specific_params": null,
|
| 195 |
-
"temperature": 1.0,
|
| 196 |
-
"tf_legacy_loss": false,
|
| 197 |
-
"tie_encoder_decoder": false,
|
| 198 |
-
"tie_word_embeddings": true,
|
| 199 |
-
"tokenizer_class": null,
|
| 200 |
-
"top_k": 50,
|
| 201 |
-
"top_p": 1.0,
|
| 202 |
-
"torch_dtype": "bfloat16",
|
| 203 |
-
"torchscript": false,
|
| 204 |
-
"transformers_version": "4.46.3",
|
| 205 |
-
"typical_p": 1.0,
|
| 206 |
-
"use_bfloat16": true,
|
| 207 |
-
"use_flash_attn": false
|
| 208 |
-
}
|
| 209 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ipynb_checkpoints/configuration_skywork_chat-checkpoint.py
DELETED
|
@@ -1,91 +0,0 @@
|
|
| 1 |
-
import copy
|
| 2 |
-
|
| 3 |
-
from transformers import AutoConfig, LlamaConfig
|
| 4 |
-
from transformers.configuration_utils import PretrainedConfig
|
| 5 |
-
from transformers.utils import logging
|
| 6 |
-
|
| 7 |
-
from .configuration_skywork_vit import SkyworkVisionConfig
|
| 8 |
-
from .configuration_skywork_lm2 import SkyworkLM2Config
|
| 9 |
-
from transformers import Qwen2Config, Qwen2ForCausalLM
|
| 10 |
-
|
| 11 |
-
logger = logging.get_logger(__name__)
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
class SkyworkChatConfig(PretrainedConfig):
|
| 15 |
-
model_type = 'skywork_chat'
|
| 16 |
-
is_composition = True
|
| 17 |
-
|
| 18 |
-
def __init__(
|
| 19 |
-
self,
|
| 20 |
-
vision_config=None,
|
| 21 |
-
llm_config=None,
|
| 22 |
-
use_backbone_lora=0,
|
| 23 |
-
use_llm_lora=0,
|
| 24 |
-
select_layer=-1,
|
| 25 |
-
force_image_size=None,
|
| 26 |
-
downsample_ratio=0.5,
|
| 27 |
-
template=None,
|
| 28 |
-
dynamic_image_size=False,
|
| 29 |
-
use_thumbnail=False,
|
| 30 |
-
ps_version='v1',
|
| 31 |
-
min_dynamic_patch=1,
|
| 32 |
-
max_dynamic_patch=6,
|
| 33 |
-
**kwargs):
|
| 34 |
-
super().__init__(**kwargs)
|
| 35 |
-
if vision_config is None:
|
| 36 |
-
vision_config = {'architectures': ['SkyworkVisionModel']}
|
| 37 |
-
logger.info('vision_config is None. Initializing the SkyworkVisionConfig with default values.')
|
| 38 |
-
|
| 39 |
-
if llm_config is None:
|
| 40 |
-
llm_config = {'architectures': ['Qwen2ForCausalLM']}
|
| 41 |
-
logger.info('llm_config is None. Initializing the LlamaConfig config with default values (`LlamaConfig`).')
|
| 42 |
-
|
| 43 |
-
self.vision_config = SkyworkVisionConfig(**vision_config)
|
| 44 |
-
if llm_config.get('architectures')[0] == 'LlamaForCausalLM':
|
| 45 |
-
self.llm_config = LlamaConfig(**llm_config)
|
| 46 |
-
elif llm_config.get('architectures')[0] == 'Qwen2ForCausalLM':
|
| 47 |
-
self.llm_config = Qwen2Config(**llm_config)
|
| 48 |
-
else:
|
| 49 |
-
raise ValueError('Unsupported architecture: {}'.format(llm_config.get('architectures')[0]))
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
self.use_backbone_lora = use_backbone_lora
|
| 53 |
-
self.use_llm_lora = use_llm_lora
|
| 54 |
-
self.select_layer = select_layer
|
| 55 |
-
self.force_image_size = force_image_size
|
| 56 |
-
self.downsample_ratio = downsample_ratio
|
| 57 |
-
self.template = template
|
| 58 |
-
self.dynamic_image_size = dynamic_image_size
|
| 59 |
-
self.use_thumbnail = use_thumbnail
|
| 60 |
-
self.ps_version = ps_version # pixel shuffle version
|
| 61 |
-
self.min_dynamic_patch = min_dynamic_patch
|
| 62 |
-
self.max_dynamic_patch = max_dynamic_patch
|
| 63 |
-
|
| 64 |
-
logger.info(f'vision_select_layer: {self.select_layer}')
|
| 65 |
-
logger.info(f'ps_version: {self.ps_version}')
|
| 66 |
-
logger.info(f'min_dynamic_patch: {self.min_dynamic_patch}')
|
| 67 |
-
logger.info(f'max_dynamic_patch: {self.max_dynamic_patch}')
|
| 68 |
-
|
| 69 |
-
def to_dict(self):
|
| 70 |
-
"""
|
| 71 |
-
Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`].
|
| 72 |
-
Returns:
|
| 73 |
-
`Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
|
| 74 |
-
"""
|
| 75 |
-
output = copy.deepcopy(self.__dict__)
|
| 76 |
-
output['vision_config'] = self.vision_config.to_dict()
|
| 77 |
-
output['llm_config'] = self.llm_config.to_dict()
|
| 78 |
-
output['model_type'] = self.__class__.model_type
|
| 79 |
-
output['use_backbone_lora'] = self.use_backbone_lora
|
| 80 |
-
output['use_llm_lora'] = self.use_llm_lora
|
| 81 |
-
output['select_layer'] = self.select_layer
|
| 82 |
-
output['force_image_size'] = self.force_image_size
|
| 83 |
-
output['downsample_ratio'] = self.downsample_ratio
|
| 84 |
-
output['template'] = self.template
|
| 85 |
-
output['dynamic_image_size'] = self.dynamic_image_size
|
| 86 |
-
output['use_thumbnail'] = self.use_thumbnail
|
| 87 |
-
output['ps_version'] = self.ps_version
|
| 88 |
-
output['min_dynamic_patch'] = self.min_dynamic_patch
|
| 89 |
-
output['max_dynamic_patch'] = self.max_dynamic_patch
|
| 90 |
-
|
| 91 |
-
return output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|