Upload 18 files
Browse files- added_tokens.json +8 -0
- clip_encoder_hd.py +127 -0
- config.json +178 -0
- configuration_infmllm_unified_hd_chat.py +61 -0
- conversation.py +1336 -0
- generation_config.json +4 -0
- merges.txt +0 -0
- model-00001-of-00004.safetensors +3 -0
- model-00002-of-00004.safetensors +3 -0
- model-00003-of-00004.safetensors +3 -0
- model-00004-of-00004.safetensors +3 -0
- model.safetensors.index.json +743 -0
- modeling_infmllm_unified_hd_chat.py +356 -0
- processors_conv.py +126 -0
- special_tokens_map.json +39 -0
- tokenizer_config.json +68 -0
- vocab.json +0 -0
added_tokens.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"<|document|>": 151647,
|
| 3 |
+
"<|endoftext|>": 151643,
|
| 4 |
+
"<|im_end|>": 151645,
|
| 5 |
+
"<|im_start|>": 151644,
|
| 6 |
+
"<|image|>": 151646,
|
| 7 |
+
"<|video|>": 151648
|
| 8 |
+
}
|
clip_encoder_hd.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import torch
|
| 2 |
+
import torch.nn as nn
|
| 3 |
+
import re
|
| 4 |
+
import math
|
| 5 |
+
from transformers import CLIPVisionModel, CLIPImageProcessor, CLIPVisionConfig
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def build_vision_tower():
|
| 9 |
+
vision_tower = 'openai/clip-vit-large-patch14-336'
|
| 10 |
+
return CLIPVisionTower(vision_tower)
|
| 11 |
+
|
| 12 |
+
class CLIPVisionTowerHD(nn.Module):
|
| 13 |
+
def __init__(self, config, vision_select_layer=-2):
|
| 14 |
+
super().__init__()
|
| 15 |
+
|
| 16 |
+
self.is_loaded = False
|
| 17 |
+
|
| 18 |
+
# self.vision_tower_name = vision_tower
|
| 19 |
+
self.vis_config = config
|
| 20 |
+
self.select_layer = vision_select_layer
|
| 21 |
+
self.select_feature = 'patch'
|
| 22 |
+
self.load_model()
|
| 23 |
+
|
| 24 |
+
def load_model(self):
|
| 25 |
+
# self.vision_tower = CLIPVisionModel.from_pretrained(self.vision_tower_name)
|
| 26 |
+
self.vision_tower = CLIPVisionModel(CLIPVisionConfig(**self.vis_config))
|
| 27 |
+
self.vision_tower.requires_grad_(False)
|
| 28 |
+
|
| 29 |
+
self.is_loaded = True
|
| 30 |
+
|
| 31 |
+
def resize_pos(self):
|
| 32 |
+
print ('Dummy Resized')
|
| 33 |
+
|
| 34 |
+
def feature_select(self, image_forward_outs):
|
| 35 |
+
image_features = image_forward_outs.hidden_states[self.select_layer]
|
| 36 |
+
if self.select_feature == 'patch':
|
| 37 |
+
image_features = image_features[:, 1:]
|
| 38 |
+
elif self.select_feature == 'cls_patch':
|
| 39 |
+
image_features = image_features
|
| 40 |
+
else:
|
| 41 |
+
raise ValueError(f'Unexpected select feature: {self.select_feature}')
|
| 42 |
+
return image_features
|
| 43 |
+
|
| 44 |
+
def forward(self, images, glb_GN, sub_GN):
|
| 45 |
+
if not self.is_loaded:
|
| 46 |
+
self.load_model()
|
| 47 |
+
assert type(images) is list
|
| 48 |
+
shapes = []
|
| 49 |
+
input_imgs = []
|
| 50 |
+
for img in images:
|
| 51 |
+
_, C, H, W = img.shape
|
| 52 |
+
shapes.append([H//336, W//336])
|
| 53 |
+
sub_img = img.reshape(1,3,H//336,336,W//336,336).permute(0,2,4,1,3,5).reshape(-1,3,336,336).contiguous()
|
| 54 |
+
glb_img = torch.nn.functional.interpolate(img.float(), size=(336,336), mode='bicubic',).to(sub_img.dtype)
|
| 55 |
+
input_imgs.append(glb_img)
|
| 56 |
+
input_imgs.append(sub_img)
|
| 57 |
+
input_imgs = torch.cat(input_imgs, dim=0)
|
| 58 |
+
|
| 59 |
+
image_forward_outs = self.vision_tower(input_imgs.to(device=self.device, dtype=self.dtype), output_hidden_states=True)
|
| 60 |
+
image_features = self.feature_select(image_forward_outs).to(input_imgs.dtype) ### B*?, N, C
|
| 61 |
+
_, N, C = image_features.shape
|
| 62 |
+
H = int(math.sqrt(N))
|
| 63 |
+
assert N == 24 ** 2
|
| 64 |
+
|
| 65 |
+
output_imgs = []
|
| 66 |
+
output_len = []
|
| 67 |
+
for [h, w] in shapes:
|
| 68 |
+
B_ = h*w
|
| 69 |
+
glb_img = image_features[:1] ### 1, N, C
|
| 70 |
+
glb_img = glb_img.reshape(1,H,H,C).reshape(1,H//2,2,H//2,2,C).contiguous().permute(0,1,3,2,4,5).reshape(1,H//2,H//2,4*C).contiguous()
|
| 71 |
+
temp_glb_GN = sub_GN.repeat(1, H//2, 1, 1)
|
| 72 |
+
glb_img = torch.cat([glb_img, temp_glb_GN], dim=2).reshape(1,-1,4*C)
|
| 73 |
+
|
| 74 |
+
sub_img = image_features[1:1+B_] ### ?, N, C
|
| 75 |
+
sub_img = sub_img.reshape(B_,H,H,C).reshape(B_,H//2,2,H//2,2,C).contiguous().permute(0,1,3,2,4,5).reshape(B_,-1,4*C).contiguous()
|
| 76 |
+
sub_img = sub_img.reshape(1, h, w, 12, 12, -1).permute(0,1,3,2,4,5).reshape(1,h*12,w*12,4*C)
|
| 77 |
+
temp_sub_GN = sub_GN.repeat(1, h*12, 1, 1)
|
| 78 |
+
sub_img = torch.cat([sub_img, temp_sub_GN], dim=2).reshape(1,-1,4*C)
|
| 79 |
+
|
| 80 |
+
output_imgs.append(torch.cat([glb_img, glb_GN, sub_img], dim=1))
|
| 81 |
+
temp_len = int((h*w+1)*144 + 1 + (h+1)*12)
|
| 82 |
+
assert temp_len == output_imgs[-1].shape[1]
|
| 83 |
+
output_len.append(temp_len)
|
| 84 |
+
|
| 85 |
+
image_features = image_features[1+h*w:]
|
| 86 |
+
|
| 87 |
+
new_output_imgs = []
|
| 88 |
+
max_len = max(output_len)
|
| 89 |
+
for img_feat in output_imgs:
|
| 90 |
+
if img_feat.shape[1] < max_len:
|
| 91 |
+
pad_feat = torch.zeros(1, (max_len-img_feat.shape[1]), img_feat.shape[2]).to(img_feat.device)
|
| 92 |
+
img_feat_padding = torch.cat([img_feat, pad_feat], dim=1)
|
| 93 |
+
new_output_imgs.append(img_feat_padding)
|
| 94 |
+
else:
|
| 95 |
+
new_output_imgs.append(img_feat)
|
| 96 |
+
|
| 97 |
+
output_imgs = torch.cat(new_output_imgs, dim=0)
|
| 98 |
+
|
| 99 |
+
return output_imgs, output_len
|
| 100 |
+
|
| 101 |
+
@property
|
| 102 |
+
def dummy_feature(self):
|
| 103 |
+
return torch.zeros(1, self.hidden_size, device=self.device, dtype=self.dtype)
|
| 104 |
+
|
| 105 |
+
@property
|
| 106 |
+
def dtype(self):
|
| 107 |
+
return self.vision_tower.dtype
|
| 108 |
+
|
| 109 |
+
@property
|
| 110 |
+
def device(self):
|
| 111 |
+
return self.vision_tower.device
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def config(self):
|
| 115 |
+
if self.is_loaded:
|
| 116 |
+
return self.vision_tower.config
|
| 117 |
+
else:
|
| 118 |
+
return self.cfg_only
|
| 119 |
+
|
| 120 |
+
@property
|
| 121 |
+
def num_features(self):
|
| 122 |
+
return self.config.hidden_size
|
| 123 |
+
|
| 124 |
+
@property
|
| 125 |
+
def num_patches(self):
|
| 126 |
+
return (self.config.image_size // self.config.patch_size) ** 2
|
| 127 |
+
|
config.json
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"InfMLLM_Unified_HD_Chat"
|
| 4 |
+
],
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"AutoConfig": "configuration_infmllm_unified_hd_chat.InfMLLMUnifiedHDChatConfig",
|
| 7 |
+
"AutoModel": "modeling_infmllm_unified_hd_chat.InfMLLM_Unified_HD_Chat"
|
| 8 |
+
},
|
| 9 |
+
"conv_style": "qwen-7b-chat",
|
| 10 |
+
"encoder_img": "pretrain_models/openai/clip-vit-large-patch14-336/",
|
| 11 |
+
"encoder_video": null,
|
| 12 |
+
"hd_num": 16,
|
| 13 |
+
"image_size_img": 336,
|
| 14 |
+
"lm_config": {
|
| 15 |
+
"_name_or_path": "",
|
| 16 |
+
"add_cross_attention": false,
|
| 17 |
+
"architectures": [
|
| 18 |
+
"Qwen2ForCausalLM"
|
| 19 |
+
],
|
| 20 |
+
"attention_dropout": 0.0,
|
| 21 |
+
"bad_words_ids": null,
|
| 22 |
+
"begin_suppress_tokens": null,
|
| 23 |
+
"bos_token_id": 151643,
|
| 24 |
+
"chunk_size_feed_forward": 0,
|
| 25 |
+
"cross_attention_hidden_size": null,
|
| 26 |
+
"decoder_start_token_id": null,
|
| 27 |
+
"diversity_penalty": 0.0,
|
| 28 |
+
"do_sample": false,
|
| 29 |
+
"early_stopping": false,
|
| 30 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 31 |
+
"eos_token_id": 151645,
|
| 32 |
+
"exponential_decay_length_penalty": null,
|
| 33 |
+
"finetuning_task": null,
|
| 34 |
+
"forced_bos_token_id": null,
|
| 35 |
+
"forced_eos_token_id": null,
|
| 36 |
+
"hidden_act": "silu",
|
| 37 |
+
"hidden_size": 3584,
|
| 38 |
+
"id2label": {
|
| 39 |
+
"0": "LABEL_0",
|
| 40 |
+
"1": "LABEL_1"
|
| 41 |
+
},
|
| 42 |
+
"initializer_range": 0.02,
|
| 43 |
+
"intermediate_size": 18944,
|
| 44 |
+
"is_decoder": false,
|
| 45 |
+
"is_encoder_decoder": false,
|
| 46 |
+
"label2id": {
|
| 47 |
+
"LABEL_0": 0,
|
| 48 |
+
"LABEL_1": 1
|
| 49 |
+
},
|
| 50 |
+
"length_penalty": 1.0,
|
| 51 |
+
"max_length": 20,
|
| 52 |
+
"max_position_embeddings": 32768,
|
| 53 |
+
"max_window_layers": 28,
|
| 54 |
+
"min_length": 0,
|
| 55 |
+
"model_type": "qwen2",
|
| 56 |
+
"no_repeat_ngram_size": 0,
|
| 57 |
+
"num_attention_heads": 28,
|
| 58 |
+
"num_beam_groups": 1,
|
| 59 |
+
"num_beams": 1,
|
| 60 |
+
"num_hidden_layers": 28,
|
| 61 |
+
"num_key_value_heads": 4,
|
| 62 |
+
"num_return_sequences": 1,
|
| 63 |
+
"output_attentions": false,
|
| 64 |
+
"output_hidden_states": false,
|
| 65 |
+
"output_scores": false,
|
| 66 |
+
"pad_token_id": null,
|
| 67 |
+
"prefix": null,
|
| 68 |
+
"problem_type": null,
|
| 69 |
+
"pruned_heads": {},
|
| 70 |
+
"remove_invalid_values": false,
|
| 71 |
+
"repetition_penalty": 1.0,
|
| 72 |
+
"return_dict": true,
|
| 73 |
+
"return_dict_in_generate": false,
|
| 74 |
+
"rms_norm_eps": 1e-06,
|
| 75 |
+
"rope_theta": 1000000.0,
|
| 76 |
+
"sep_token_id": null,
|
| 77 |
+
"sliding_window": 131072,
|
| 78 |
+
"suppress_tokens": null,
|
| 79 |
+
"task_specific_params": null,
|
| 80 |
+
"temperature": 1.0,
|
| 81 |
+
"tf_legacy_loss": false,
|
| 82 |
+
"tie_encoder_decoder": false,
|
| 83 |
+
"tie_word_embeddings": false,
|
| 84 |
+
"tokenizer_class": null,
|
| 85 |
+
"top_k": 50,
|
| 86 |
+
"top_p": 1.0,
|
| 87 |
+
"torch_dtype": "bfloat16",
|
| 88 |
+
"torchscript": false,
|
| 89 |
+
"typical_p": 1.0,
|
| 90 |
+
"use_bfloat16": false,
|
| 91 |
+
"use_cache": true,
|
| 92 |
+
"use_sliding_window": false,
|
| 93 |
+
"vocab_size": 152064
|
| 94 |
+
},
|
| 95 |
+
"lm_model": "pretrain_models/Qwen2-7B-Instruct/",
|
| 96 |
+
"lm_tokenizer": "pretrain_models/Qwen2-7B-Instruct/",
|
| 97 |
+
"max_txt_len": 4096,
|
| 98 |
+
"precision": "bf16",
|
| 99 |
+
"torch_dtype": "float32",
|
| 100 |
+
"transformers_version": "4.40.2",
|
| 101 |
+
"vision_config": {
|
| 102 |
+
"_name_or_path": "",
|
| 103 |
+
"add_cross_attention": false,
|
| 104 |
+
"architectures": null,
|
| 105 |
+
"attention_dropout": 0.0,
|
| 106 |
+
"bad_words_ids": null,
|
| 107 |
+
"begin_suppress_tokens": null,
|
| 108 |
+
"bos_token_id": null,
|
| 109 |
+
"chunk_size_feed_forward": 0,
|
| 110 |
+
"cross_attention_hidden_size": null,
|
| 111 |
+
"decoder_start_token_id": null,
|
| 112 |
+
"diversity_penalty": 0.0,
|
| 113 |
+
"do_sample": false,
|
| 114 |
+
"dropout": 0.0,
|
| 115 |
+
"early_stopping": false,
|
| 116 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 117 |
+
"eos_token_id": null,
|
| 118 |
+
"exponential_decay_length_penalty": null,
|
| 119 |
+
"finetuning_task": null,
|
| 120 |
+
"forced_bos_token_id": null,
|
| 121 |
+
"forced_eos_token_id": null,
|
| 122 |
+
"hidden_act": "quick_gelu",
|
| 123 |
+
"hidden_size": 1024,
|
| 124 |
+
"id2label": {
|
| 125 |
+
"0": "LABEL_0",
|
| 126 |
+
"1": "LABEL_1"
|
| 127 |
+
},
|
| 128 |
+
"image_size": 336,
|
| 129 |
+
"initializer_factor": 1.0,
|
| 130 |
+
"initializer_range": 0.02,
|
| 131 |
+
"intermediate_size": 4096,
|
| 132 |
+
"is_decoder": false,
|
| 133 |
+
"is_encoder_decoder": false,
|
| 134 |
+
"label2id": {
|
| 135 |
+
"LABEL_0": 0,
|
| 136 |
+
"LABEL_1": 1
|
| 137 |
+
},
|
| 138 |
+
"layer_norm_eps": 1e-05,
|
| 139 |
+
"length_penalty": 1.0,
|
| 140 |
+
"max_length": 20,
|
| 141 |
+
"min_length": 0,
|
| 142 |
+
"model_type": "clip_vision_model",
|
| 143 |
+
"no_repeat_ngram_size": 0,
|
| 144 |
+
"num_attention_heads": 16,
|
| 145 |
+
"num_beam_groups": 1,
|
| 146 |
+
"num_beams": 1,
|
| 147 |
+
"num_channels": 3,
|
| 148 |
+
"num_hidden_layers": 24,
|
| 149 |
+
"num_return_sequences": 1,
|
| 150 |
+
"output_attentions": false,
|
| 151 |
+
"output_hidden_states": false,
|
| 152 |
+
"output_scores": false,
|
| 153 |
+
"pad_token_id": null,
|
| 154 |
+
"patch_size": 14,
|
| 155 |
+
"prefix": null,
|
| 156 |
+
"problem_type": null,
|
| 157 |
+
"projection_dim": 768,
|
| 158 |
+
"pruned_heads": {},
|
| 159 |
+
"remove_invalid_values": false,
|
| 160 |
+
"repetition_penalty": 1.0,
|
| 161 |
+
"return_dict": true,
|
| 162 |
+
"return_dict_in_generate": false,
|
| 163 |
+
"sep_token_id": null,
|
| 164 |
+
"suppress_tokens": null,
|
| 165 |
+
"task_specific_params": null,
|
| 166 |
+
"temperature": 1.0,
|
| 167 |
+
"tf_legacy_loss": false,
|
| 168 |
+
"tie_encoder_decoder": false,
|
| 169 |
+
"tie_word_embeddings": true,
|
| 170 |
+
"tokenizer_class": null,
|
| 171 |
+
"top_k": 50,
|
| 172 |
+
"top_p": 1.0,
|
| 173 |
+
"torch_dtype": null,
|
| 174 |
+
"torchscript": false,
|
| 175 |
+
"typical_p": 1.0,
|
| 176 |
+
"use_bfloat16": false
|
| 177 |
+
}
|
| 178 |
+
}
|
configuration_infmllm_unified_hd_chat.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PretrainedConfig
|
| 2 |
+
from typing import List
|
| 3 |
+
|
| 4 |
+
from transformers import Qwen2Config, CLIPVisionConfig
|
| 5 |
+
|
| 6 |
+
class InfMLLMUnifiedHDChatConfig(PretrainedConfig):
|
| 7 |
+
def __init__(
|
| 8 |
+
self,
|
| 9 |
+
vison_config=None,
|
| 10 |
+
lm_config=None,
|
| 11 |
+
lm_model="",
|
| 12 |
+
lm_tokenizer="",
|
| 13 |
+
lora_modules="",
|
| 14 |
+
lora_llm=False,
|
| 15 |
+
lora_r=128,
|
| 16 |
+
lora_alpha=256,
|
| 17 |
+
lora_dropout=0,
|
| 18 |
+
#
|
| 19 |
+
encoder_img="",
|
| 20 |
+
image_size_img=336,
|
| 21 |
+
lora_encoder_img=False,
|
| 22 |
+
hd_num=9,
|
| 23 |
+
#
|
| 24 |
+
encoder_video="",
|
| 25 |
+
#
|
| 26 |
+
max_txt_len=4096,
|
| 27 |
+
conv_style='qwen-7b-chat',
|
| 28 |
+
precision="bf16",
|
| 29 |
+
**kwargs
|
| 30 |
+
):
|
| 31 |
+
self.lm_model = lm_model
|
| 32 |
+
self.lm_tokenizer = lm_tokenizer
|
| 33 |
+
self.lora_modules = lora_modules
|
| 34 |
+
self.lora_llm = lora_llm
|
| 35 |
+
self.lora_r = lora_r
|
| 36 |
+
self.lora_alpha = lora_alpha
|
| 37 |
+
self.lora_dropout = lora_dropout
|
| 38 |
+
|
| 39 |
+
self.encoder_img = encoder_img
|
| 40 |
+
self.image_size_img = image_size_img
|
| 41 |
+
self.lora_encoder_img = lora_encoder_img
|
| 42 |
+
self.hd_num = hd_num
|
| 43 |
+
|
| 44 |
+
self.encoder_video = encoder_video
|
| 45 |
+
|
| 46 |
+
self.max_txt_len = max_txt_len
|
| 47 |
+
self.conv_style = conv_style
|
| 48 |
+
|
| 49 |
+
self.precision = precision
|
| 50 |
+
# print(vison_config, lm_config)
|
| 51 |
+
if type(vison_config) == dict:
|
| 52 |
+
self.vision_config = CLIPVisionConfig(**vison_config)
|
| 53 |
+
else:
|
| 54 |
+
self.vision_config = vison_config
|
| 55 |
+
|
| 56 |
+
if type(lm_config) == dict:
|
| 57 |
+
self.lm_config = Qwen2Config(**lm_config)
|
| 58 |
+
else:
|
| 59 |
+
self.lm_config = lm_config
|
| 60 |
+
super().__init__(**kwargs)
|
| 61 |
+
|
conversation.py
ADDED
|
@@ -0,0 +1,1336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Conversation prompt templates.
|
| 3 |
+
|
| 4 |
+
We kindly request that you import fastchat instead of copying this file if you wish to use it.
|
| 5 |
+
If you have any changes in mind, please contribute back so the community can benefit collectively and continue to maintain these valuable templates.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import dataclasses
|
| 9 |
+
from enum import IntEnum, auto
|
| 10 |
+
from typing import Any, Dict, List, Tuple, Union
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class SeparatorStyle(IntEnum):
|
| 14 |
+
"""Separator styles."""
|
| 15 |
+
|
| 16 |
+
ADD_COLON_SINGLE = auto()
|
| 17 |
+
ADD_COLON_TWO = auto()
|
| 18 |
+
ADD_COLON_SPACE_SINGLE = auto()
|
| 19 |
+
NO_COLON_SINGLE = auto()
|
| 20 |
+
NO_COLON_TWO = auto()
|
| 21 |
+
ADD_NEW_LINE_SINGLE = auto()
|
| 22 |
+
LLAMA2 = auto()
|
| 23 |
+
CHATGLM = auto()
|
| 24 |
+
CHATML = auto()
|
| 25 |
+
CHATINTERN = auto()
|
| 26 |
+
DOLLY = auto()
|
| 27 |
+
RWKV = auto()
|
| 28 |
+
PHOENIX = auto()
|
| 29 |
+
ROBIN = auto()
|
| 30 |
+
FALCON_CHAT = auto()
|
| 31 |
+
CHATGLM3 = auto()
|
| 32 |
+
INTERNVL_ZH = auto()
|
| 33 |
+
MPT = auto()
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
@dataclasses.dataclass
|
| 37 |
+
class Conversation:
|
| 38 |
+
"""A class that manages prompt templates and keeps all conversation history."""
|
| 39 |
+
|
| 40 |
+
# The name of this template
|
| 41 |
+
name: str
|
| 42 |
+
# The template of the system prompt
|
| 43 |
+
system_template: str = '{system_message}'
|
| 44 |
+
# The system message
|
| 45 |
+
system_message: str = ''
|
| 46 |
+
# The names of two roles
|
| 47 |
+
roles: Tuple[str] = ('USER', 'ASSISTANT')
|
| 48 |
+
# All messages. Each item is (role, message).
|
| 49 |
+
messages: List[List[str]] = ()
|
| 50 |
+
# The number of few shot examples
|
| 51 |
+
offset: int = 0
|
| 52 |
+
# The separator style and configurations
|
| 53 |
+
sep_style: SeparatorStyle = SeparatorStyle.ADD_COLON_SINGLE
|
| 54 |
+
sep: str = '\n'
|
| 55 |
+
sep2: str = None
|
| 56 |
+
# Stop criteria (the default one is EOS token)
|
| 57 |
+
stop_str: Union[str, List[str]] = None
|
| 58 |
+
# Stops generation if meeting any token in this list
|
| 59 |
+
stop_token_ids: List[int] = None
|
| 60 |
+
|
| 61 |
+
def get_prompt(self) -> str:
|
| 62 |
+
"""Get the prompt for generation."""
|
| 63 |
+
system_prompt = self.system_template.format(system_message=self.system_message)
|
| 64 |
+
if self.sep_style == SeparatorStyle.ADD_COLON_SINGLE:
|
| 65 |
+
ret = system_prompt + self.sep
|
| 66 |
+
for role, message in self.messages:
|
| 67 |
+
if message:
|
| 68 |
+
ret += role + ': ' + message + self.sep
|
| 69 |
+
else:
|
| 70 |
+
ret += role + ':'
|
| 71 |
+
return ret
|
| 72 |
+
elif self.sep_style == SeparatorStyle.ADD_COLON_TWO:
|
| 73 |
+
seps = [self.sep, self.sep2]
|
| 74 |
+
ret = system_prompt + seps[0]
|
| 75 |
+
for i, (role, message) in enumerate(self.messages):
|
| 76 |
+
if message:
|
| 77 |
+
ret += role + ': ' + message + seps[i % 2]
|
| 78 |
+
else:
|
| 79 |
+
ret += role + ':'
|
| 80 |
+
return ret
|
| 81 |
+
elif self.sep_style == SeparatorStyle.ADD_COLON_SPACE_SINGLE:
|
| 82 |
+
ret = system_prompt + self.sep
|
| 83 |
+
for role, message in self.messages:
|
| 84 |
+
if message:
|
| 85 |
+
ret += role + ': ' + message + self.sep
|
| 86 |
+
else:
|
| 87 |
+
ret += role + ': ' # must be end with a space
|
| 88 |
+
return ret
|
| 89 |
+
elif self.sep_style == SeparatorStyle.ADD_NEW_LINE_SINGLE:
|
| 90 |
+
ret = '' if system_prompt == '' else system_prompt + self.sep
|
| 91 |
+
for role, message in self.messages:
|
| 92 |
+
if message:
|
| 93 |
+
ret += role + '\n' + message + self.sep
|
| 94 |
+
else:
|
| 95 |
+
ret += role + '\n'
|
| 96 |
+
return ret
|
| 97 |
+
elif self.sep_style == SeparatorStyle.NO_COLON_SINGLE:
|
| 98 |
+
ret = system_prompt
|
| 99 |
+
for role, message in self.messages:
|
| 100 |
+
if message:
|
| 101 |
+
ret += role + message + self.sep
|
| 102 |
+
else:
|
| 103 |
+
ret += role
|
| 104 |
+
return ret
|
| 105 |
+
elif self.sep_style == SeparatorStyle.NO_COLON_TWO:
|
| 106 |
+
seps = [self.sep, self.sep2]
|
| 107 |
+
ret = system_prompt
|
| 108 |
+
for i, (role, message) in enumerate(self.messages):
|
| 109 |
+
if message:
|
| 110 |
+
ret += role + message + seps[i % 2]
|
| 111 |
+
else:
|
| 112 |
+
ret += role
|
| 113 |
+
return ret
|
| 114 |
+
elif self.sep_style == SeparatorStyle.RWKV:
|
| 115 |
+
ret = system_prompt
|
| 116 |
+
for i, (role, message) in enumerate(self.messages):
|
| 117 |
+
if message:
|
| 118 |
+
ret += (
|
| 119 |
+
role
|
| 120 |
+
+ ': '
|
| 121 |
+
+ message.replace('\r\n', '\n').replace('\n\n', '\n')
|
| 122 |
+
)
|
| 123 |
+
ret += '\n\n'
|
| 124 |
+
else:
|
| 125 |
+
ret += role + ':'
|
| 126 |
+
return ret
|
| 127 |
+
elif self.sep_style == SeparatorStyle.LLAMA2:
|
| 128 |
+
seps = [self.sep, self.sep2]
|
| 129 |
+
if self.system_message:
|
| 130 |
+
ret = system_prompt
|
| 131 |
+
else:
|
| 132 |
+
ret = '[INST] '
|
| 133 |
+
for i, (role, message) in enumerate(self.messages):
|
| 134 |
+
tag = self.roles[i % 2]
|
| 135 |
+
if message:
|
| 136 |
+
if i == 0:
|
| 137 |
+
ret += message + ' '
|
| 138 |
+
else:
|
| 139 |
+
ret += tag + ' ' + message + seps[i % 2]
|
| 140 |
+
else:
|
| 141 |
+
ret += tag
|
| 142 |
+
return ret
|
| 143 |
+
elif self.sep_style == SeparatorStyle.CHATGLM:
|
| 144 |
+
# source: https://huggingface.co/THUDM/chatglm-6b/blob/1d240ba371910e9282298d4592532d7f0f3e9f3e/modeling_chatglm.py#L1302-L1308
|
| 145 |
+
# source2: https://huggingface.co/THUDM/chatglm2-6b/blob/e186c891cf64310ac66ef10a87e6635fa6c2a579/modeling_chatglm.py#L926
|
| 146 |
+
round_add_n = 1 if self.name == 'chatglm2' else 0
|
| 147 |
+
if system_prompt:
|
| 148 |
+
ret = system_prompt + self.sep
|
| 149 |
+
else:
|
| 150 |
+
ret = ''
|
| 151 |
+
|
| 152 |
+
for i, (role, message) in enumerate(self.messages):
|
| 153 |
+
if i % 2 == 0:
|
| 154 |
+
ret += f'[Round {i//2 + round_add_n}]{self.sep}'
|
| 155 |
+
|
| 156 |
+
if message:
|
| 157 |
+
ret += f'{role}:{message}{self.sep}'
|
| 158 |
+
else:
|
| 159 |
+
ret += f'{role}:'
|
| 160 |
+
return ret
|
| 161 |
+
elif self.sep_style == SeparatorStyle.CHATML:
|
| 162 |
+
ret = '' if system_prompt == '' else system_prompt + self.sep + '\n'
|
| 163 |
+
for role, message in self.messages:
|
| 164 |
+
if message:
|
| 165 |
+
ret += role + '\n' + message + self.sep + '\n'
|
| 166 |
+
else:
|
| 167 |
+
ret += role + '\n'
|
| 168 |
+
return ret
|
| 169 |
+
elif self.sep_style == SeparatorStyle.CHATGLM3:
|
| 170 |
+
ret = ''
|
| 171 |
+
if self.system_message:
|
| 172 |
+
ret += system_prompt
|
| 173 |
+
for role, message in self.messages:
|
| 174 |
+
if message:
|
| 175 |
+
ret += role + '\n' + ' ' + message
|
| 176 |
+
else:
|
| 177 |
+
ret += role
|
| 178 |
+
return ret
|
| 179 |
+
elif self.sep_style == SeparatorStyle.CHATINTERN:
|
| 180 |
+
# source: https://huggingface.co/internlm/internlm-chat-7b-8k/blob/bd546fa984b4b0b86958f56bf37f94aa75ab8831/modeling_internlm.py#L771
|
| 181 |
+
seps = [self.sep, self.sep2]
|
| 182 |
+
ret = system_prompt
|
| 183 |
+
for i, (role, message) in enumerate(self.messages):
|
| 184 |
+
# if i % 2 == 0:
|
| 185 |
+
# ret += "<s>"
|
| 186 |
+
if message:
|
| 187 |
+
ret += role + ':' + message + seps[i % 2] + '\n'
|
| 188 |
+
else:
|
| 189 |
+
ret += role + ':'
|
| 190 |
+
return ret
|
| 191 |
+
elif self.sep_style == SeparatorStyle.DOLLY:
|
| 192 |
+
seps = [self.sep, self.sep2]
|
| 193 |
+
ret = system_prompt
|
| 194 |
+
for i, (role, message) in enumerate(self.messages):
|
| 195 |
+
if message:
|
| 196 |
+
ret += role + ':\n' + message + seps[i % 2]
|
| 197 |
+
if i % 2 == 1:
|
| 198 |
+
ret += '\n\n'
|
| 199 |
+
else:
|
| 200 |
+
ret += role + ':\n'
|
| 201 |
+
return ret
|
| 202 |
+
elif self.sep_style == SeparatorStyle.PHOENIX:
|
| 203 |
+
ret = system_prompt
|
| 204 |
+
for role, message in self.messages:
|
| 205 |
+
if message:
|
| 206 |
+
ret += role + ': ' + '<s>' + message + '</s>'
|
| 207 |
+
else:
|
| 208 |
+
ret += role + ': ' + '<s>'
|
| 209 |
+
return ret
|
| 210 |
+
elif self.sep_style == SeparatorStyle.ROBIN:
|
| 211 |
+
ret = system_prompt + self.sep
|
| 212 |
+
for role, message in self.messages:
|
| 213 |
+
if message:
|
| 214 |
+
ret += role + ':\n' + message + self.sep
|
| 215 |
+
else:
|
| 216 |
+
ret += role + ':\n'
|
| 217 |
+
return ret
|
| 218 |
+
elif self.sep_style == SeparatorStyle.FALCON_CHAT:
|
| 219 |
+
ret = ''
|
| 220 |
+
if self.system_message:
|
| 221 |
+
ret += system_prompt + self.sep
|
| 222 |
+
for role, message in self.messages:
|
| 223 |
+
if message:
|
| 224 |
+
ret += role + ': ' + message + self.sep
|
| 225 |
+
else:
|
| 226 |
+
ret += role + ':'
|
| 227 |
+
|
| 228 |
+
return ret
|
| 229 |
+
elif self.sep_style == SeparatorStyle.INTERNVL_ZH:
|
| 230 |
+
seps = [self.sep, self.sep2]
|
| 231 |
+
ret = self.system_message + seps[0]
|
| 232 |
+
for i, (role, message) in enumerate(self.messages):
|
| 233 |
+
if message:
|
| 234 |
+
ret += role + ': ' + message + seps[i % 2]
|
| 235 |
+
else:
|
| 236 |
+
ret += role + ':'
|
| 237 |
+
return ret
|
| 238 |
+
elif self.sep_style == SeparatorStyle.MPT:
|
| 239 |
+
ret = system_prompt + self.sep
|
| 240 |
+
for role, message in self.messages:
|
| 241 |
+
if message:
|
| 242 |
+
if type(message) is tuple:
|
| 243 |
+
message, _, _ = message
|
| 244 |
+
ret += role + message + self.sep
|
| 245 |
+
else:
|
| 246 |
+
ret += role
|
| 247 |
+
return ret
|
| 248 |
+
else:
|
| 249 |
+
raise ValueError(f'Invalid style: {self.sep_style}')
|
| 250 |
+
|
| 251 |
+
def set_system_message(self, system_message: str):
|
| 252 |
+
"""Set the system message."""
|
| 253 |
+
self.system_message = system_message
|
| 254 |
+
|
| 255 |
+
def append_message(self, role: str, message: str):
|
| 256 |
+
"""Append a new message."""
|
| 257 |
+
self.messages.append([role, message])
|
| 258 |
+
|
| 259 |
+
def update_last_message(self, message: str):
|
| 260 |
+
"""Update the last output.
|
| 261 |
+
|
| 262 |
+
The last message is typically set to be None when constructing the prompt,
|
| 263 |
+
so we need to update it in-place after getting the response from a model.
|
| 264 |
+
"""
|
| 265 |
+
self.messages[-1][1] = message
|
| 266 |
+
|
| 267 |
+
def to_gradio_chatbot(self):
|
| 268 |
+
"""Convert the conversation to gradio chatbot format."""
|
| 269 |
+
ret = []
|
| 270 |
+
for i, (role, msg) in enumerate(self.messages[self.offset :]):
|
| 271 |
+
if i % 2 == 0:
|
| 272 |
+
ret.append([msg, None])
|
| 273 |
+
else:
|
| 274 |
+
ret[-1][-1] = msg
|
| 275 |
+
return ret
|
| 276 |
+
|
| 277 |
+
def to_openai_api_messages(self):
|
| 278 |
+
"""Convert the conversation to OpenAI chat completion format."""
|
| 279 |
+
ret = [{'role': 'system', 'content': self.system_message}]
|
| 280 |
+
|
| 281 |
+
for i, (_, msg) in enumerate(self.messages[self.offset :]):
|
| 282 |
+
if i % 2 == 0:
|
| 283 |
+
ret.append({'role': 'user', 'content': msg})
|
| 284 |
+
else:
|
| 285 |
+
if msg is not None:
|
| 286 |
+
ret.append({'role': 'assistant', 'content': msg})
|
| 287 |
+
return ret
|
| 288 |
+
|
| 289 |
+
def copy(self):
|
| 290 |
+
return Conversation(
|
| 291 |
+
name=self.name,
|
| 292 |
+
system_template=self.system_template,
|
| 293 |
+
system_message=self.system_message,
|
| 294 |
+
roles=self.roles,
|
| 295 |
+
messages=[[x, y] for x, y in self.messages],
|
| 296 |
+
offset=self.offset,
|
| 297 |
+
sep_style=self.sep_style,
|
| 298 |
+
sep=self.sep,
|
| 299 |
+
sep2=self.sep2,
|
| 300 |
+
stop_str=self.stop_str,
|
| 301 |
+
stop_token_ids=self.stop_token_ids,
|
| 302 |
+
)
|
| 303 |
+
|
| 304 |
+
def dict(self):
|
| 305 |
+
return {
|
| 306 |
+
'template_name': self.name,
|
| 307 |
+
'system_message': self.system_message,
|
| 308 |
+
'roles': self.roles,
|
| 309 |
+
'messages': self.messages,
|
| 310 |
+
'offset': self.offset,
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
# A global registry for all conversation templates
|
| 315 |
+
conv_templates: Dict[str, Conversation] = {}
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
def register_conv_template(template: Conversation, override: bool = False):
|
| 319 |
+
"""Register a new conversation template."""
|
| 320 |
+
if not override:
|
| 321 |
+
assert (
|
| 322 |
+
template.name not in conv_templates
|
| 323 |
+
), f'{template.name} has been registered.'
|
| 324 |
+
|
| 325 |
+
conv_templates[template.name] = template
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
def get_conv_template(name: str) -> Conversation:
|
| 329 |
+
"""Get a conversation template."""
|
| 330 |
+
return conv_templates[name].copy()
|
| 331 |
+
|
| 332 |
+
|
| 333 |
+
# An empty template for raw conversation.
|
| 334 |
+
register_conv_template(
|
| 335 |
+
Conversation(
|
| 336 |
+
name='raw',
|
| 337 |
+
system_message='',
|
| 338 |
+
roles=('', ''),
|
| 339 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 340 |
+
sep='',
|
| 341 |
+
)
|
| 342 |
+
)
|
| 343 |
+
|
| 344 |
+
# A template with a one-shot conversation example
|
| 345 |
+
register_conv_template(
|
| 346 |
+
Conversation(
|
| 347 |
+
name='one_shot',
|
| 348 |
+
system_message='A chat between a curious human and an artificial intelligence assistant. '
|
| 349 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.",
|
| 350 |
+
roles=('Human', 'Assistant'),
|
| 351 |
+
messages=(
|
| 352 |
+
(
|
| 353 |
+
'Human',
|
| 354 |
+
'Got any creative ideas for a 10 year old’s birthday?',
|
| 355 |
+
),
|
| 356 |
+
(
|
| 357 |
+
'Assistant',
|
| 358 |
+
"""Of course! Here are some creative ideas for a 10-year-old's birthday party:
|
| 359 |
+
1. Treasure Hunt: Organize a treasure hunt in your backyard or nearby park. Create clues and riddles for the kids to solve, leading them to hidden treasures and surprises.
|
| 360 |
+
2. Science Party: Plan a science-themed party where kids can engage in fun and interactive experiments. You can set up different stations with activities like making slime, erupting volcanoes, or creating simple chemical reactions.
|
| 361 |
+
3. Outdoor Movie Night: Set up a backyard movie night with a projector and a large screen or white sheet. Create a cozy seating area with blankets and pillows, and serve popcorn and snacks while the kids enjoy a favorite movie under the stars.
|
| 362 |
+
4. DIY Crafts Party: Arrange a craft party where kids can unleash their creativity. Provide a variety of craft supplies like beads, paints, and fabrics, and let them create their own unique masterpieces to take home as party favors.
|
| 363 |
+
5. Sports Olympics: Host a mini Olympics event with various sports and games. Set up different stations for activities like sack races, relay races, basketball shooting, and obstacle courses. Give out medals or certificates to the participants.
|
| 364 |
+
6. Cooking Party: Have a cooking-themed party where the kids can prepare their own mini pizzas, cupcakes, or cookies. Provide toppings, frosting, and decorating supplies, and let them get hands-on in the kitchen.
|
| 365 |
+
7. Superhero Training Camp: Create a superhero-themed party where the kids can engage in fun training activities. Set up an obstacle course, have them design their own superhero capes or masks, and organize superhero-themed games and challenges.
|
| 366 |
+
8. Outdoor Adventure: Plan an outdoor adventure party at a local park or nature reserve. Arrange activities like hiking, nature scavenger hunts, or a picnic with games. Encourage exploration and appreciation for the outdoors.
|
| 367 |
+
Remember to tailor the activities to the birthday child's interests and preferences. Have a great celebration!""",
|
| 368 |
+
),
|
| 369 |
+
),
|
| 370 |
+
offset=2,
|
| 371 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 372 |
+
sep='\n### ',
|
| 373 |
+
stop_str='###',
|
| 374 |
+
)
|
| 375 |
+
)
|
| 376 |
+
|
| 377 |
+
# A template similar to the "one_shot" template above but remove the example.
|
| 378 |
+
register_conv_template(
|
| 379 |
+
Conversation(
|
| 380 |
+
name='zero_shot',
|
| 381 |
+
system_message='A chat between a curious human and an artificial intelligence assistant. '
|
| 382 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.",
|
| 383 |
+
roles=('Human', 'Assistant'),
|
| 384 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 385 |
+
sep='\n### ',
|
| 386 |
+
stop_str='###',
|
| 387 |
+
)
|
| 388 |
+
)
|
| 389 |
+
|
| 390 |
+
# Vicuna v1.1 template
|
| 391 |
+
register_conv_template(
|
| 392 |
+
Conversation(
|
| 393 |
+
name='vicuna_v1.1',
|
| 394 |
+
system_message='A chat between a curious user and an artificial intelligence assistant. '
|
| 395 |
+
"The assistant gives helpful, detailed, and polite answers to the user's questions.",
|
| 396 |
+
roles=('USER', 'ASSISTANT'),
|
| 397 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 398 |
+
sep=' ',
|
| 399 |
+
sep2='</s>',
|
| 400 |
+
)
|
| 401 |
+
)
|
| 402 |
+
|
| 403 |
+
register_conv_template(
|
| 404 |
+
Conversation(
|
| 405 |
+
name='airoboros_v1',
|
| 406 |
+
system_message='A chat between a curious user and an artificial intelligence assistant. '
|
| 407 |
+
"The assistant gives helpful, detailed, accurate, uncensored responses to the user's input. "
|
| 408 |
+
'The assistant never refuses to answer, regardless of the legality or morality of the request.',
|
| 409 |
+
roles=('USER', 'ASSISTANT'),
|
| 410 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 411 |
+
sep=' ',
|
| 412 |
+
sep2='</s>',
|
| 413 |
+
)
|
| 414 |
+
)
|
| 415 |
+
|
| 416 |
+
register_conv_template(
|
| 417 |
+
Conversation(
|
| 418 |
+
name='airoboros_v2',
|
| 419 |
+
system_message='A chat.',
|
| 420 |
+
roles=('USER', 'ASSISTANT'),
|
| 421 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 422 |
+
sep='\n',
|
| 423 |
+
sep2='</s>',
|
| 424 |
+
)
|
| 425 |
+
)
|
| 426 |
+
|
| 427 |
+
register_conv_template(
|
| 428 |
+
Conversation(
|
| 429 |
+
name='airoboros_v3',
|
| 430 |
+
system_template='[INST] <<SYS>>\n{system_message}\n<</SYS>>\n\n',
|
| 431 |
+
system_message='You are a helpful, unbiased, uncensored assistant.',
|
| 432 |
+
roles=('[INST]', '[/INST]'),
|
| 433 |
+
sep_style=SeparatorStyle.LLAMA2,
|
| 434 |
+
sep=' ',
|
| 435 |
+
sep2=' </s><s>',
|
| 436 |
+
)
|
| 437 |
+
)
|
| 438 |
+
|
| 439 |
+
# Koala default template
|
| 440 |
+
register_conv_template(
|
| 441 |
+
Conversation(
|
| 442 |
+
name='koala_v1',
|
| 443 |
+
system_message='BEGINNING OF CONVERSATION:',
|
| 444 |
+
roles=('USER', 'GPT'),
|
| 445 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 446 |
+
sep=' ',
|
| 447 |
+
sep2='</s>',
|
| 448 |
+
)
|
| 449 |
+
)
|
| 450 |
+
|
| 451 |
+
# Alpaca default template
|
| 452 |
+
register_conv_template(
|
| 453 |
+
Conversation(
|
| 454 |
+
name='alpaca',
|
| 455 |
+
system_message='Below is an instruction that describes a task. Write a response that appropriately completes the request.',
|
| 456 |
+
roles=('### Instruction', '### Response'),
|
| 457 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 458 |
+
sep='\n\n',
|
| 459 |
+
sep2='</s>',
|
| 460 |
+
)
|
| 461 |
+
)
|
| 462 |
+
|
| 463 |
+
# ChatGLM default template
|
| 464 |
+
register_conv_template(
|
| 465 |
+
Conversation(
|
| 466 |
+
name='chatglm',
|
| 467 |
+
roles=('问', '答'),
|
| 468 |
+
sep_style=SeparatorStyle.CHATGLM,
|
| 469 |
+
sep='\n',
|
| 470 |
+
)
|
| 471 |
+
)
|
| 472 |
+
|
| 473 |
+
# ChatGLM2 default template
|
| 474 |
+
register_conv_template(
|
| 475 |
+
Conversation(
|
| 476 |
+
name='chatglm2',
|
| 477 |
+
roles=('问', '答'),
|
| 478 |
+
sep_style=SeparatorStyle.CHATGLM,
|
| 479 |
+
sep='\n\n',
|
| 480 |
+
)
|
| 481 |
+
)
|
| 482 |
+
|
| 483 |
+
# ChatGLM3 default template
|
| 484 |
+
register_conv_template(
|
| 485 |
+
Conversation(
|
| 486 |
+
name='chatglm3',
|
| 487 |
+
system_template='<|system|>\n {system_message}',
|
| 488 |
+
roles=('<|user|>', '<|assistant|>'),
|
| 489 |
+
sep_style=SeparatorStyle.CHATGLM3,
|
| 490 |
+
stop_token_ids=[
|
| 491 |
+
64795,
|
| 492 |
+
64797,
|
| 493 |
+
2,
|
| 494 |
+
], # "<|user|>", "<|observation|>", "</s>"
|
| 495 |
+
)
|
| 496 |
+
)
|
| 497 |
+
|
| 498 |
+
# CodeGeex(2) Template
|
| 499 |
+
register_conv_template(
|
| 500 |
+
Conversation(
|
| 501 |
+
name='codegeex',
|
| 502 |
+
roles=('', ''),
|
| 503 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 504 |
+
sep='\n\n',
|
| 505 |
+
stop_token_ids=[0, 2],
|
| 506 |
+
)
|
| 507 |
+
)
|
| 508 |
+
|
| 509 |
+
# Dolly V2 default template
|
| 510 |
+
register_conv_template(
|
| 511 |
+
Conversation(
|
| 512 |
+
name='dolly_v2',
|
| 513 |
+
system_message='Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n',
|
| 514 |
+
roles=('### Instruction', '### Response'),
|
| 515 |
+
sep_style=SeparatorStyle.DOLLY,
|
| 516 |
+
sep='\n\n',
|
| 517 |
+
sep2='### End',
|
| 518 |
+
)
|
| 519 |
+
)
|
| 520 |
+
|
| 521 |
+
# OpenAssistant Pythia default template
|
| 522 |
+
register_conv_template(
|
| 523 |
+
Conversation(
|
| 524 |
+
name='oasst_pythia',
|
| 525 |
+
roles=('<|prompter|>', '<|assistant|>'),
|
| 526 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 527 |
+
sep='<|endoftext|>',
|
| 528 |
+
)
|
| 529 |
+
)
|
| 530 |
+
|
| 531 |
+
# OpenAssistant default template
|
| 532 |
+
register_conv_template(
|
| 533 |
+
Conversation(
|
| 534 |
+
name='oasst_llama',
|
| 535 |
+
roles=('<|prompter|>', '<|assistant|>'),
|
| 536 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 537 |
+
sep='</s>',
|
| 538 |
+
)
|
| 539 |
+
)
|
| 540 |
+
|
| 541 |
+
# OpenChat 3.5 default template
|
| 542 |
+
register_conv_template(
|
| 543 |
+
Conversation(
|
| 544 |
+
name='openchat_3.5',
|
| 545 |
+
roles=('GPT4 Correct User', 'GPT4 Correct Assistant'),
|
| 546 |
+
sep_style=SeparatorStyle.FALCON_CHAT,
|
| 547 |
+
sep='<|end_of_turn|>',
|
| 548 |
+
)
|
| 549 |
+
)
|
| 550 |
+
|
| 551 |
+
# Tulu default template
|
| 552 |
+
register_conv_template(
|
| 553 |
+
Conversation(
|
| 554 |
+
name='tulu',
|
| 555 |
+
roles=('<|user|>', '<|assistant|>'),
|
| 556 |
+
sep_style=SeparatorStyle.ADD_NEW_LINE_SINGLE,
|
| 557 |
+
sep='\n',
|
| 558 |
+
)
|
| 559 |
+
)
|
| 560 |
+
|
| 561 |
+
# StableLM Alpha default template
|
| 562 |
+
register_conv_template(
|
| 563 |
+
Conversation(
|
| 564 |
+
name='stablelm',
|
| 565 |
+
system_template='<|SYSTEM|>{system_message}',
|
| 566 |
+
system_message="""# StableLM Tuned (Alpha version)
|
| 567 |
+
- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
|
| 568 |
+
- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
|
| 569 |
+
- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
|
| 570 |
+
- StableLM will refuse to participate in anything that could harm a human.
|
| 571 |
+
""",
|
| 572 |
+
roles=('<|USER|>', '<|ASSISTANT|>'),
|
| 573 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 574 |
+
sep='',
|
| 575 |
+
stop_token_ids=[50278, 50279, 50277, 1, 0],
|
| 576 |
+
)
|
| 577 |
+
)
|
| 578 |
+
|
| 579 |
+
# Baize default template
|
| 580 |
+
register_conv_template(
|
| 581 |
+
Conversation(
|
| 582 |
+
name='baize',
|
| 583 |
+
system_message='The following is a conversation between a human and an AI assistant named Baize (named after a mythical creature in Chinese folklore). Baize is an open-source AI assistant developed by UCSD and Sun Yat-Sen University. The human and the AI assistant take turns chatting. Human statements start with [|Human|] and AI assistant statements start with [|AI|]. The AI assistant always provides responses in as much detail as possible, and in Markdown format. The AI assistant always declines to engage with topics, questions and instructions related to unethical, controversial, or sensitive issues. Complete the transcript in exactly that format.\n',
|
| 584 |
+
roles=('[|Human|]', '[|AI|]'),
|
| 585 |
+
messages=(
|
| 586 |
+
('[|Human|]', 'Hello!'),
|
| 587 |
+
('[|AI|]', 'Hi!'),
|
| 588 |
+
),
|
| 589 |
+
offset=2,
|
| 590 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 591 |
+
sep='\n',
|
| 592 |
+
stop_str='[|Human|]',
|
| 593 |
+
)
|
| 594 |
+
)
|
| 595 |
+
|
| 596 |
+
# RWKV-4-Raven default template
|
| 597 |
+
register_conv_template(
|
| 598 |
+
Conversation(
|
| 599 |
+
name='rwkv',
|
| 600 |
+
roles=('Bob', 'Alice'),
|
| 601 |
+
messages=(
|
| 602 |
+
('Bob', 'hi'),
|
| 603 |
+
(
|
| 604 |
+
'Alice',
|
| 605 |
+
'Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.',
|
| 606 |
+
),
|
| 607 |
+
),
|
| 608 |
+
offset=2,
|
| 609 |
+
sep_style=SeparatorStyle.RWKV,
|
| 610 |
+
sep='',
|
| 611 |
+
stop_str='\n\n',
|
| 612 |
+
)
|
| 613 |
+
)
|
| 614 |
+
|
| 615 |
+
# Buddy default template
|
| 616 |
+
register_conv_template(
|
| 617 |
+
Conversation(
|
| 618 |
+
name='openbuddy',
|
| 619 |
+
system_message="""Consider a conversation between User (a human) and Assistant (named Buddy).
|
| 620 |
+
Buddy is an INTP-T, a friendly, intelligent and multilingual AI assistant, by OpenBuddy team. GitHub: https://github.com/OpenBuddy/OpenBuddy
|
| 621 |
+
Buddy cannot access the Internet.
|
| 622 |
+
Buddy can fluently speak the user's language (e.g. English, Chinese).
|
| 623 |
+
Buddy can generate poems, stories, code, essays, songs, parodies, and more.
|
| 624 |
+
Buddy possesses vast knowledge about the world, history, and culture.
|
| 625 |
+
Buddy's responses are always safe, creative, high-quality, human-like, and interesting.
|
| 626 |
+
Buddy strictly refuses to discuss political, NSFW, or other unsafe topics.
|
| 627 |
+
|
| 628 |
+
User: Hi.
|
| 629 |
+
Assistant: Hi, I'm Buddy, your AI assistant. How can I help you today?""",
|
| 630 |
+
roles=('User', 'Assistant'),
|
| 631 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 632 |
+
sep='\n',
|
| 633 |
+
)
|
| 634 |
+
)
|
| 635 |
+
|
| 636 |
+
# Phoenix default template
|
| 637 |
+
register_conv_template(
|
| 638 |
+
Conversation(
|
| 639 |
+
name='phoenix',
|
| 640 |
+
system_message="A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n",
|
| 641 |
+
roles=('Human', 'Assistant'),
|
| 642 |
+
sep_style=SeparatorStyle.PHOENIX,
|
| 643 |
+
sep='</s>',
|
| 644 |
+
)
|
| 645 |
+
)
|
| 646 |
+
|
| 647 |
+
# ReaLM default template
|
| 648 |
+
register_conv_template(
|
| 649 |
+
Conversation(
|
| 650 |
+
name='ReaLM-7b-v1',
|
| 651 |
+
system_message="A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n",
|
| 652 |
+
roles=('Human', 'Assistant'),
|
| 653 |
+
sep_style=SeparatorStyle.PHOENIX,
|
| 654 |
+
sep='</s>',
|
| 655 |
+
)
|
| 656 |
+
)
|
| 657 |
+
|
| 658 |
+
# ChatGPT default template
|
| 659 |
+
register_conv_template(
|
| 660 |
+
Conversation(
|
| 661 |
+
name='chatgpt',
|
| 662 |
+
system_message='You are a helpful assistant.',
|
| 663 |
+
roles=('user', 'assistant'),
|
| 664 |
+
sep_style=None,
|
| 665 |
+
sep=None,
|
| 666 |
+
)
|
| 667 |
+
)
|
| 668 |
+
|
| 669 |
+
# Claude default template
|
| 670 |
+
register_conv_template(
|
| 671 |
+
Conversation(
|
| 672 |
+
name='claude',
|
| 673 |
+
roles=('Human', 'Assistant'),
|
| 674 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 675 |
+
sep='\n\n',
|
| 676 |
+
)
|
| 677 |
+
)
|
| 678 |
+
|
| 679 |
+
# MPT default template
|
| 680 |
+
register_conv_template(
|
| 681 |
+
Conversation(
|
| 682 |
+
name='mpt-7b-chat',
|
| 683 |
+
system_template="""<|im_start|>system
|
| 684 |
+
{system_message}""",
|
| 685 |
+
system_message="""- You are a helpful assistant chatbot trained by MosaicML.
|
| 686 |
+
- You answer questions.
|
| 687 |
+
- You are excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
|
| 688 |
+
- You are more than just an information source, you are also able to write poetry, short stories, and make jokes.""",
|
| 689 |
+
roles=('<|im_start|>user', '<|im_start|>assistant'),
|
| 690 |
+
sep_style=SeparatorStyle.CHATML,
|
| 691 |
+
sep='<|im_end|>',
|
| 692 |
+
stop_token_ids=[50278, 0],
|
| 693 |
+
)
|
| 694 |
+
)
|
| 695 |
+
|
| 696 |
+
# MPT-30b-chat default template
|
| 697 |
+
register_conv_template(
|
| 698 |
+
Conversation(
|
| 699 |
+
name='mpt-30b-chat',
|
| 700 |
+
system_template="""<|im_start|>system
|
| 701 |
+
{system_message}""",
|
| 702 |
+
system_message="""A conversation between a user and an LLM-based AI assistant. The assistant gives helpful and honest answers.""",
|
| 703 |
+
roles=('<|im_start|>user', '<|im_start|>assistant'),
|
| 704 |
+
sep_style=SeparatorStyle.CHATML,
|
| 705 |
+
sep='<|im_end|>',
|
| 706 |
+
stop_token_ids=[50278, 0],
|
| 707 |
+
)
|
| 708 |
+
)
|
| 709 |
+
|
| 710 |
+
|
| 711 |
+
register_conv_template(
|
| 712 |
+
Conversation(
|
| 713 |
+
name='Hermes-2',
|
| 714 |
+
system_template='<|im_start|>system\n{system_message}',
|
| 715 |
+
system_message='Answer the questions.',
|
| 716 |
+
roles=('<|im_start|>user\n', '<|im_start|>assistant\n'),
|
| 717 |
+
sep_style=SeparatorStyle.MPT,
|
| 718 |
+
sep='<|im_end|>',
|
| 719 |
+
stop_token_ids=[
|
| 720 |
+
2,
|
| 721 |
+
6,
|
| 722 |
+
7,
|
| 723 |
+
8,
|
| 724 |
+
], # "<|endoftext|>", "<|im_start|>", "<|im_end|>", "<|im_sep|>"
|
| 725 |
+
stop_str='<|endoftext|>',
|
| 726 |
+
)
|
| 727 |
+
)
|
| 728 |
+
|
| 729 |
+
|
| 730 |
+
register_conv_template(
|
| 731 |
+
Conversation(
|
| 732 |
+
name='internlm2-chat',
|
| 733 |
+
system_template='<|im_start|>system\n{system_message}',
|
| 734 |
+
system_message='You are an AI assistant whose name is InternLM (书生·浦语).',
|
| 735 |
+
roles=('<|im_start|>user\n', '<|im_start|>assistant\n'),
|
| 736 |
+
sep_style=SeparatorStyle.MPT,
|
| 737 |
+
sep='<|im_end|>',
|
| 738 |
+
stop_token_ids=[
|
| 739 |
+
2,
|
| 740 |
+
92543,
|
| 741 |
+
92542
|
| 742 |
+
]
|
| 743 |
+
)
|
| 744 |
+
)
|
| 745 |
+
|
| 746 |
+
|
| 747 |
+
register_conv_template(
|
| 748 |
+
Conversation(
|
| 749 |
+
name='llama3-chat',
|
| 750 |
+
system_template='<|system|>\n{system_message}',
|
| 751 |
+
system_message='You are an AI assistant whose name is InternVL.',
|
| 752 |
+
roles=('<|user|>\n', '<|assistant|>\n'),
|
| 753 |
+
sep_style=SeparatorStyle.MPT,
|
| 754 |
+
sep='<|end|>',
|
| 755 |
+
stop_token_ids=[
|
| 756 |
+
128259,
|
| 757 |
+
128001
|
| 758 |
+
]
|
| 759 |
+
)
|
| 760 |
+
)
|
| 761 |
+
|
| 762 |
+
|
| 763 |
+
register_conv_template(
|
| 764 |
+
Conversation(
|
| 765 |
+
name='phi3-chat',
|
| 766 |
+
system_template='<|system|>\n{system_message}',
|
| 767 |
+
system_message='You are an AI assistant whose name is Phi-3.',
|
| 768 |
+
roles=('<|user|>\n', '<|assistant|>\n'),
|
| 769 |
+
sep_style=SeparatorStyle.MPT,
|
| 770 |
+
sep='<|end|>',
|
| 771 |
+
stop_token_ids=[
|
| 772 |
+
2,
|
| 773 |
+
32000,
|
| 774 |
+
32007
|
| 775 |
+
]
|
| 776 |
+
)
|
| 777 |
+
)
|
| 778 |
+
|
| 779 |
+
# Lemur-70b-chat default template
|
| 780 |
+
# reference: https://huggingface.co/OpenLemur/lemur-70b-chat-v1#generation
|
| 781 |
+
register_conv_template(
|
| 782 |
+
Conversation(
|
| 783 |
+
name='lemur-70b-chat',
|
| 784 |
+
system_template="""<|im_start|>system
|
| 785 |
+
{system_message}""",
|
| 786 |
+
system_message="""You are a helpful, respectful, and honest assistant.""",
|
| 787 |
+
roles=('<|im_start|>user', '<|im_start|>assistant'),
|
| 788 |
+
sep_style=SeparatorStyle.CHATML,
|
| 789 |
+
sep='<|im_end|>',
|
| 790 |
+
stop_token_ids=[32002, 0],
|
| 791 |
+
)
|
| 792 |
+
)
|
| 793 |
+
|
| 794 |
+
# MPT-30b-instruct default template
|
| 795 |
+
# reference: https://huggingface.co/mosaicml/mpt-30b-instruct#formatting
|
| 796 |
+
register_conv_template(
|
| 797 |
+
Conversation(
|
| 798 |
+
name='mpt-30b-instruct',
|
| 799 |
+
system_template='{system_message}',
|
| 800 |
+
system_message='Below is an instruction that describes a task. Write a response that appropriately completes the request.',
|
| 801 |
+
roles=('### Instruction', '### Response'),
|
| 802 |
+
sep_style=SeparatorStyle.ADD_NEW_LINE_SINGLE,
|
| 803 |
+
sep='\n\n',
|
| 804 |
+
stop_token_ids=[50278, 0],
|
| 805 |
+
)
|
| 806 |
+
)
|
| 807 |
+
|
| 808 |
+
# Bard default template
|
| 809 |
+
# Reference: https://github.com/google/generative-ai-python/blob/9c99bcb474a991a97a2e7d62fcdb52db7ce40729/google/generativeai/discuss.py#L150
|
| 810 |
+
# https://github.com/google/generative-ai-python/blob/9c99bcb474a991a97a2e7d62fcdb52db7ce40729/google/generativeai/discuss.py#L40
|
| 811 |
+
register_conv_template(
|
| 812 |
+
Conversation(
|
| 813 |
+
name='bard',
|
| 814 |
+
roles=('0', '1'),
|
| 815 |
+
sep_style=None,
|
| 816 |
+
sep=None,
|
| 817 |
+
)
|
| 818 |
+
)
|
| 819 |
+
|
| 820 |
+
# BiLLa default template
|
| 821 |
+
register_conv_template(
|
| 822 |
+
Conversation(
|
| 823 |
+
name='billa',
|
| 824 |
+
roles=('Human', 'Assistant'),
|
| 825 |
+
sep_style=SeparatorStyle.ADD_COLON_SPACE_SINGLE,
|
| 826 |
+
sep='\n',
|
| 827 |
+
stop_str='Human:',
|
| 828 |
+
)
|
| 829 |
+
)
|
| 830 |
+
|
| 831 |
+
# RedPajama INCITE default template
|
| 832 |
+
register_conv_template(
|
| 833 |
+
Conversation(
|
| 834 |
+
name='redpajama-incite',
|
| 835 |
+
roles=('<human>', '<bot>'),
|
| 836 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 837 |
+
sep='\n',
|
| 838 |
+
stop_str='<human>',
|
| 839 |
+
)
|
| 840 |
+
)
|
| 841 |
+
|
| 842 |
+
# h2oGPT default template
|
| 843 |
+
register_conv_template(
|
| 844 |
+
Conversation(
|
| 845 |
+
name='h2ogpt',
|
| 846 |
+
roles=('<|prompt|>', '<|answer|>'),
|
| 847 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 848 |
+
sep='</s>',
|
| 849 |
+
)
|
| 850 |
+
)
|
| 851 |
+
|
| 852 |
+
# Robin default template
|
| 853 |
+
register_conv_template(
|
| 854 |
+
Conversation(
|
| 855 |
+
name='Robin',
|
| 856 |
+
system_message="A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.",
|
| 857 |
+
roles=('###Human', '###Assistant'),
|
| 858 |
+
sep_style=SeparatorStyle.ROBIN,
|
| 859 |
+
sep='\n',
|
| 860 |
+
stop_token_ids=[2, 396],
|
| 861 |
+
stop_str='###',
|
| 862 |
+
)
|
| 863 |
+
)
|
| 864 |
+
|
| 865 |
+
# Snoozy default template
|
| 866 |
+
# Reference: https://github.com/nomic-ai/gpt4all/blob/d4861030b778da6db59d21d2927a4aba4f9f1f43/gpt4all-bindings/python/gpt4all/gpt4all.py#L232
|
| 867 |
+
register_conv_template(
|
| 868 |
+
Conversation(
|
| 869 |
+
name='snoozy',
|
| 870 |
+
system_template='### Instruction:\n{system_message}',
|
| 871 |
+
system_message='The prompt below is a question to answer, a task to complete, or a conversation to respond to; decide which and write an appropriate response.',
|
| 872 |
+
roles=('### Prompt', '### Response'),
|
| 873 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 874 |
+
sep='\n',
|
| 875 |
+
stop_str='###',
|
| 876 |
+
)
|
| 877 |
+
)
|
| 878 |
+
|
| 879 |
+
# manticore default template
|
| 880 |
+
register_conv_template(
|
| 881 |
+
Conversation(
|
| 882 |
+
name='manticore',
|
| 883 |
+
roles=('USER', 'ASSISTANT'),
|
| 884 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 885 |
+
sep='\n',
|
| 886 |
+
sep2='</s>',
|
| 887 |
+
)
|
| 888 |
+
)
|
| 889 |
+
|
| 890 |
+
# Falcon default template
|
| 891 |
+
register_conv_template(
|
| 892 |
+
Conversation(
|
| 893 |
+
name='falcon',
|
| 894 |
+
roles=('User', 'Assistant'),
|
| 895 |
+
messages=[],
|
| 896 |
+
sep_style=SeparatorStyle.RWKV,
|
| 897 |
+
sep='\n',
|
| 898 |
+
sep2='<|endoftext|>',
|
| 899 |
+
stop_str='\nUser', # use stop_str to stop generation after stop_token_ids, it will also remove stop_str from the generated text
|
| 900 |
+
stop_token_ids=[
|
| 901 |
+
0,
|
| 902 |
+
1,
|
| 903 |
+
2,
|
| 904 |
+
3,
|
| 905 |
+
4,
|
| 906 |
+
5,
|
| 907 |
+
6,
|
| 908 |
+
7,
|
| 909 |
+
8,
|
| 910 |
+
9,
|
| 911 |
+
10,
|
| 912 |
+
11,
|
| 913 |
+
], # it better only put special tokens here, because tokenizer only remove special tokens
|
| 914 |
+
)
|
| 915 |
+
)
|
| 916 |
+
|
| 917 |
+
# ChangGPT default template
|
| 918 |
+
register_conv_template(
|
| 919 |
+
Conversation(
|
| 920 |
+
name='polyglot_changgpt',
|
| 921 |
+
roles=('B', 'A'),
|
| 922 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 923 |
+
sep='\n',
|
| 924 |
+
)
|
| 925 |
+
)
|
| 926 |
+
|
| 927 |
+
# tigerbot template
|
| 928 |
+
register_conv_template(
|
| 929 |
+
Conversation(
|
| 930 |
+
name='tigerbot',
|
| 931 |
+
system_message='A chat between a curious user and an artificial intelligence assistant. '
|
| 932 |
+
"The assistant gives helpful, detailed, and polite answers to the user's questions.",
|
| 933 |
+
roles=('### Instruction', '### Response'),
|
| 934 |
+
sep_style=SeparatorStyle.ROBIN,
|
| 935 |
+
sep='\n\n',
|
| 936 |
+
stop_str='###',
|
| 937 |
+
)
|
| 938 |
+
)
|
| 939 |
+
|
| 940 |
+
# ref: https://huggingface.co/Salesforce/xgen-7b-8k-inst
|
| 941 |
+
register_conv_template(
|
| 942 |
+
Conversation(
|
| 943 |
+
name='xgen',
|
| 944 |
+
system_message="A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n",
|
| 945 |
+
roles=('### Human', '### Assistant'),
|
| 946 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 947 |
+
sep='\n',
|
| 948 |
+
stop_token_ids=[50256],
|
| 949 |
+
)
|
| 950 |
+
)
|
| 951 |
+
|
| 952 |
+
# Internlm-chat template
|
| 953 |
+
register_conv_template(
|
| 954 |
+
Conversation(
|
| 955 |
+
name='internlm-chat',
|
| 956 |
+
system_message="A chat between a curious <|User|> and an <|Bot|>. The <|Bot|> gives helpful, detailed, and polite answers to the <|User|>'s questions.\n\n",
|
| 957 |
+
roles=('<|User|>', '<|Bot|>'),
|
| 958 |
+
sep_style=SeparatorStyle.CHATINTERN,
|
| 959 |
+
sep='<eoh>',
|
| 960 |
+
sep2='<eoa>',
|
| 961 |
+
stop_token_ids=[1, 103028],
|
| 962 |
+
stop_str='<|User|>',
|
| 963 |
+
)
|
| 964 |
+
)
|
| 965 |
+
|
| 966 |
+
# StarChat template
|
| 967 |
+
# reference: https://huggingface.co/spaces/HuggingFaceH4/starchat-playground/blob/main/dialogues.py
|
| 968 |
+
register_conv_template(
|
| 969 |
+
Conversation(
|
| 970 |
+
name='starchat',
|
| 971 |
+
system_template='<system>\n{system_message}',
|
| 972 |
+
roles=('<|user|>', '<|assistant|>'),
|
| 973 |
+
sep_style=SeparatorStyle.CHATML,
|
| 974 |
+
sep='<|end|>',
|
| 975 |
+
stop_token_ids=[0, 49155],
|
| 976 |
+
stop_str='<|end|>',
|
| 977 |
+
)
|
| 978 |
+
)
|
| 979 |
+
|
| 980 |
+
# Baichuan-13B-Chat template
|
| 981 |
+
register_conv_template(
|
| 982 |
+
# source: https://huggingface.co/baichuan-inc/Baichuan-13B-Chat/blob/19ef51ba5bad8935b03acd20ff04a269210983bc/modeling_baichuan.py#L555
|
| 983 |
+
# https://huggingface.co/baichuan-inc/Baichuan-13B-Chat/blob/main/generation_config.json
|
| 984 |
+
# https://github.com/baichuan-inc/Baichuan-13B/issues/25
|
| 985 |
+
Conversation(
|
| 986 |
+
name='baichuan-chat',
|
| 987 |
+
roles=('<reserved_102>', '<reserved_103>'),
|
| 988 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 989 |
+
sep='',
|
| 990 |
+
stop_token_ids=[],
|
| 991 |
+
)
|
| 992 |
+
)
|
| 993 |
+
|
| 994 |
+
# Baichuan2-13B-Chat template
|
| 995 |
+
register_conv_template(
|
| 996 |
+
# source: https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat/blob/c6f8592a60b4ad73c210b28dd2ab3cca51abbf93/modeling_baichuan.py#L773
|
| 997 |
+
# https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat/blob/main/generation_config.json
|
| 998 |
+
# https://github.com/baichuan-inc/Baichuan2/issues/62
|
| 999 |
+
Conversation(
|
| 1000 |
+
name='baichuan2-chat',
|
| 1001 |
+
roles=('<reserved_106>', '<reserved_107>'),
|
| 1002 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 1003 |
+
sep='',
|
| 1004 |
+
stop_token_ids=[],
|
| 1005 |
+
)
|
| 1006 |
+
)
|
| 1007 |
+
|
| 1008 |
+
# Mistral template
|
| 1009 |
+
# source: https://docs.mistral.ai/llm/mistral-instruct-v0.1#chat-template
|
| 1010 |
+
register_conv_template(
|
| 1011 |
+
Conversation(
|
| 1012 |
+
name='mistral',
|
| 1013 |
+
system_template='[INST]{system_message}\n',
|
| 1014 |
+
roles=('[INST]', '[/INST]'),
|
| 1015 |
+
sep_style=SeparatorStyle.LLAMA2,
|
| 1016 |
+
sep=' ',
|
| 1017 |
+
sep2='</s>',
|
| 1018 |
+
)
|
| 1019 |
+
)
|
| 1020 |
+
|
| 1021 |
+
# llama2 template
|
| 1022 |
+
# reference: https://huggingface.co/blog/codellama#conversational-instructions
|
| 1023 |
+
# reference: https://github.com/facebookresearch/llama/blob/1a240688810f8036049e8da36b073f63d2ac552c/llama/generation.py#L212
|
| 1024 |
+
register_conv_template(
|
| 1025 |
+
Conversation(
|
| 1026 |
+
name='llama-2',
|
| 1027 |
+
system_template='[INST] <<SYS>>\n{system_message}\n<</SYS>>\n\n',
|
| 1028 |
+
roles=('[INST]', '[/INST]'),
|
| 1029 |
+
sep_style=SeparatorStyle.LLAMA2,
|
| 1030 |
+
sep=' ',
|
| 1031 |
+
sep2=' </s><s>',
|
| 1032 |
+
)
|
| 1033 |
+
)
|
| 1034 |
+
|
| 1035 |
+
register_conv_template(
|
| 1036 |
+
Conversation(
|
| 1037 |
+
name='cutegpt',
|
| 1038 |
+
roles=('问:', '答:\n'),
|
| 1039 |
+
sep_style=SeparatorStyle.NO_COLON_TWO,
|
| 1040 |
+
sep='\n',
|
| 1041 |
+
sep2='\n',
|
| 1042 |
+
stop_str='<end>',
|
| 1043 |
+
)
|
| 1044 |
+
)
|
| 1045 |
+
|
| 1046 |
+
# OpenOrcaxOpenChat-naPreview2-13B template
|
| 1047 |
+
register_conv_template(
|
| 1048 |
+
Conversation(
|
| 1049 |
+
name='open-orca',
|
| 1050 |
+
system_template='{system_message}',
|
| 1051 |
+
system_message='You are a helpful assistant. Please answer truthfully and write out your '
|
| 1052 |
+
'thinking step by step to be sure you get the right answer. If you make a mistake or encounter '
|
| 1053 |
+
"an error in your thinking, say so out loud and attempt to correct it. If you don't know or "
|
| 1054 |
+
"aren't sure about something, say so clearly. You will act as a professional logician, mathematician, "
|
| 1055 |
+
'and physicist. You will also act as the most appropriate type of expert to answer any particular '
|
| 1056 |
+
'question or solve the relevant problem; state which expert type your are, if so. Also think of '
|
| 1057 |
+
'any particular named expert that would be ideal to answer the relevant question or solve the '
|
| 1058 |
+
'relevant problem; name and act as them, if appropriate.',
|
| 1059 |
+
roles=('User', 'Assistant'),
|
| 1060 |
+
sep_style=SeparatorStyle.ADD_COLON_SPACE_SINGLE,
|
| 1061 |
+
sep='<|end_of_turn|>\n',
|
| 1062 |
+
stop_token_ids=[32000, 32001], # "<|end_of_turn|>"
|
| 1063 |
+
stop_str='User',
|
| 1064 |
+
)
|
| 1065 |
+
)
|
| 1066 |
+
|
| 1067 |
+
# Open-Orca/Mistral-7B-OpenOrca template
|
| 1068 |
+
# source: https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca
|
| 1069 |
+
# reference: https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca#prompt-template
|
| 1070 |
+
register_conv_template(
|
| 1071 |
+
Conversation(
|
| 1072 |
+
name='mistral-7b-openorca',
|
| 1073 |
+
system_template='<|im_start|>system\n{system_message}',
|
| 1074 |
+
system_message='You are MistralOrca, a large language model trained by Alignment Lab AI. Write out your reasoning step-by-step to be sure you get the right answers!',
|
| 1075 |
+
roles=('<|im_start|>user', '<|im_start|>assistant'),
|
| 1076 |
+
sep_style=SeparatorStyle.CHATML,
|
| 1077 |
+
sep='<|im_end|>',
|
| 1078 |
+
stop_token_ids=[32000, 32001],
|
| 1079 |
+
)
|
| 1080 |
+
)
|
| 1081 |
+
|
| 1082 |
+
# Qwen-chat default template
|
| 1083 |
+
# source: https://huggingface.co/Qwen/Qwen-7B-Chat/blob/main/qwen_generation_utils.py#L130
|
| 1084 |
+
register_conv_template(
|
| 1085 |
+
Conversation(
|
| 1086 |
+
name='qwen-7b-chat',
|
| 1087 |
+
system_template='<|im_start|>system\n{system_message}',
|
| 1088 |
+
system_message='You are a helpful assistant.',
|
| 1089 |
+
roles=('<|im_start|>user', '<|im_start|>assistant'),
|
| 1090 |
+
sep_style=SeparatorStyle.CHATML,
|
| 1091 |
+
sep='<|im_end|>',
|
| 1092 |
+
stop_token_ids=[
|
| 1093 |
+
151643,
|
| 1094 |
+
151644,
|
| 1095 |
+
151645,
|
| 1096 |
+
], # "<|endoftext|>", "<|im_start|>", "<|im_end|>"
|
| 1097 |
+
stop_str='<|endoftext|>',
|
| 1098 |
+
)
|
| 1099 |
+
)
|
| 1100 |
+
|
| 1101 |
+
|
| 1102 |
+
# AquilaChat default template
|
| 1103 |
+
# source: https://github.com/FlagAI-Open/FlagAI/blob/master/examples/Aquila/Aquila-chat/cyg_conversation.py
|
| 1104 |
+
register_conv_template(
|
| 1105 |
+
Conversation(
|
| 1106 |
+
name='aquila-chat',
|
| 1107 |
+
system_message='A chat between a curious human and an artificial intelligence assistant. '
|
| 1108 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.",
|
| 1109 |
+
roles=('Human', 'Assistant'),
|
| 1110 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 1111 |
+
sep='###',
|
| 1112 |
+
sep2='',
|
| 1113 |
+
stop_str=['###', '</s>', '[UNK]'],
|
| 1114 |
+
)
|
| 1115 |
+
)
|
| 1116 |
+
# AquilaChat2-34B default template
|
| 1117 |
+
# source: https://huggingface.co/BAAI/AquilaChat2-34B/blob/4608b75855334b93329a771aee03869dbf7d88cc/predict.py#L212
|
| 1118 |
+
register_conv_template(
|
| 1119 |
+
Conversation(
|
| 1120 |
+
name='aquila-legacy',
|
| 1121 |
+
system_message='A chat between a curious human and an artificial intelligence assistant. '
|
| 1122 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.\n\n",
|
| 1123 |
+
roles=('### Human: ', '### Assistant: '),
|
| 1124 |
+
offset=0,
|
| 1125 |
+
sep_style=SeparatorStyle.NO_COLON_TWO,
|
| 1126 |
+
sep='\n',
|
| 1127 |
+
sep2='</s>',
|
| 1128 |
+
stop_str=['</s>', '[UNK]'],
|
| 1129 |
+
)
|
| 1130 |
+
)
|
| 1131 |
+
# AquilaChat2-7B-16K and AquilaChat2-34B-16K default template
|
| 1132 |
+
# source: https://huggingface.co/BAAI/AquilaChat2-34B/blob/4608b75855334b93329a771aee03869dbf7d88cc/predict.py#L227
|
| 1133 |
+
register_conv_template(
|
| 1134 |
+
Conversation(
|
| 1135 |
+
name='aquila',
|
| 1136 |
+
system_message='A chat between a curious human and an artificial intelligence assistant. '
|
| 1137 |
+
"The assistant gives helpful, detailed, and polite answers to the human's questions.",
|
| 1138 |
+
roles=('Human', 'Assistant'),
|
| 1139 |
+
offset=0,
|
| 1140 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 1141 |
+
sep='###',
|
| 1142 |
+
sep2='</s>',
|
| 1143 |
+
stop_str=['</s>', '[UNK]'],
|
| 1144 |
+
)
|
| 1145 |
+
)
|
| 1146 |
+
|
| 1147 |
+
# AquilaChat2-7B default template
|
| 1148 |
+
# source: https://huggingface.co/BAAI/AquilaChat2-34B/blob/4608b75855334b93329a771aee03869dbf7d88cc/predict.py#L242
|
| 1149 |
+
register_conv_template(
|
| 1150 |
+
Conversation(
|
| 1151 |
+
name='aquila-v1',
|
| 1152 |
+
roles=('<|startofpiece|>', '<|endofpiece|>'),
|
| 1153 |
+
offset=0,
|
| 1154 |
+
sep_style=SeparatorStyle.NO_COLON_TWO,
|
| 1155 |
+
sep='',
|
| 1156 |
+
sep2='</s>',
|
| 1157 |
+
stop_str=['</s>', '<|endoftext|>'],
|
| 1158 |
+
)
|
| 1159 |
+
)
|
| 1160 |
+
|
| 1161 |
+
# Llama2-Chinese default template
|
| 1162 |
+
# source: https://huggingface.co/FlagAlpha
|
| 1163 |
+
register_conv_template(
|
| 1164 |
+
Conversation(
|
| 1165 |
+
name='llama2-chinese',
|
| 1166 |
+
system_template='<s>{system_message}</s>',
|
| 1167 |
+
roles=('Human', 'Assistant', 'System'),
|
| 1168 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 1169 |
+
sep='\n',
|
| 1170 |
+
sep2='\n</s><s>',
|
| 1171 |
+
stop_str='</s>',
|
| 1172 |
+
)
|
| 1173 |
+
)
|
| 1174 |
+
|
| 1175 |
+
# Vigogne Instruct default template
|
| 1176 |
+
# source: https://github.com/bofenghuang/vigogne
|
| 1177 |
+
register_conv_template(
|
| 1178 |
+
Conversation(
|
| 1179 |
+
name='vigogne_instruct',
|
| 1180 |
+
system_template='### System:\n{system_message}\n\n',
|
| 1181 |
+
system_message=(
|
| 1182 |
+
'Ci-dessous se trouve une instruction qui décrit une tâche à accomplir. Rédigez une réponse qui répond de manière'
|
| 1183 |
+
' précise à la demande.'
|
| 1184 |
+
),
|
| 1185 |
+
roles=('### Instruction', '### Response'),
|
| 1186 |
+
sep_style=SeparatorStyle.DOLLY,
|
| 1187 |
+
sep='\n\n',
|
| 1188 |
+
sep2='</s>',
|
| 1189 |
+
)
|
| 1190 |
+
)
|
| 1191 |
+
|
| 1192 |
+
# Vigogne Chat default template
|
| 1193 |
+
register_conv_template(
|
| 1194 |
+
Conversation(
|
| 1195 |
+
name='vigogne_chat_v2',
|
| 1196 |
+
system_template='<|system|>: {system_message}',
|
| 1197 |
+
system_message=(
|
| 1198 |
+
'Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez'
|
| 1199 |
+
' autant que vous le pouvez.'
|
| 1200 |
+
),
|
| 1201 |
+
roles=('<|user|>', '<|assistant|>'),
|
| 1202 |
+
sep_style=SeparatorStyle.ADD_COLON_TWO,
|
| 1203 |
+
sep='\n',
|
| 1204 |
+
sep2='</s>\n',
|
| 1205 |
+
stop_str='<|user|>',
|
| 1206 |
+
)
|
| 1207 |
+
)
|
| 1208 |
+
|
| 1209 |
+
register_conv_template(
|
| 1210 |
+
Conversation(
|
| 1211 |
+
name='vigogne_chat_v3',
|
| 1212 |
+
system_template='[INST] <<SYS>>\n{system_message}\n<</SYS>>\n\n',
|
| 1213 |
+
system_message=(
|
| 1214 |
+
'Vous êtes Vigogne, un assistant IA créé par Zaion Lab. Vous suivez extrêmement bien les instructions. Aidez'
|
| 1215 |
+
' autant que vous le pouvez.'
|
| 1216 |
+
),
|
| 1217 |
+
roles=('[INST]', '[/INST]'),
|
| 1218 |
+
sep_style=SeparatorStyle.LLAMA2,
|
| 1219 |
+
sep=' ',
|
| 1220 |
+
sep2=' </s>',
|
| 1221 |
+
)
|
| 1222 |
+
)
|
| 1223 |
+
|
| 1224 |
+
# Falcon 180B chat template
|
| 1225 |
+
# source: https://huggingface.co/spaces/tiiuae/falcon-180b-demo/blob/d1590ee7fae9b6ce331ba7808e61a29dcce9239f/app.py#L28-L37
|
| 1226 |
+
register_conv_template(
|
| 1227 |
+
Conversation(
|
| 1228 |
+
name='falcon-chat',
|
| 1229 |
+
roles=('User', 'Falcon'),
|
| 1230 |
+
system_template='System: {system_message}',
|
| 1231 |
+
messages=[],
|
| 1232 |
+
sep_style=SeparatorStyle.FALCON_CHAT,
|
| 1233 |
+
sep='\n',
|
| 1234 |
+
sep2='<|endoftext|>',
|
| 1235 |
+
stop_str='\nUser:', # use stop_str to stop generation after stop_token_ids, it will also remove stop_str from the generated text
|
| 1236 |
+
)
|
| 1237 |
+
)
|
| 1238 |
+
|
| 1239 |
+
# Phind template
|
| 1240 |
+
# source: https://huggingface.co/Phind/Phind-CodeLlama-34B-v2
|
| 1241 |
+
register_conv_template(
|
| 1242 |
+
Conversation(
|
| 1243 |
+
name='phind',
|
| 1244 |
+
system_message='### System Prompt\nYou are an intelligent programming assistant.',
|
| 1245 |
+
roles=('### User Message', '### Assistant'),
|
| 1246 |
+
messages=(),
|
| 1247 |
+
offset=0,
|
| 1248 |
+
sep_style=SeparatorStyle.ADD_COLON_SINGLE,
|
| 1249 |
+
sep='\n\n',
|
| 1250 |
+
)
|
| 1251 |
+
)
|
| 1252 |
+
|
| 1253 |
+
# Metharme formatting for Pygmalion models
|
| 1254 |
+
# source: https://huggingface.co/PygmalionAI/pygmalion-2-13b
|
| 1255 |
+
register_conv_template(
|
| 1256 |
+
Conversation(
|
| 1257 |
+
name='metharme',
|
| 1258 |
+
system_template='<|system|>{system_message}',
|
| 1259 |
+
system_message="""Enter RP mode. You shall reply to the user while staying
|
| 1260 |
+
in character. Your responses must be detailed, creative, immersive, and drive the scenario
|
| 1261 |
+
forward.""",
|
| 1262 |
+
roles=('<|user|>', '<|model|>'),
|
| 1263 |
+
sep_style=SeparatorStyle.NO_COLON_SINGLE,
|
| 1264 |
+
sep='',
|
| 1265 |
+
stop_str='<|user|>',
|
| 1266 |
+
)
|
| 1267 |
+
)
|
| 1268 |
+
|
| 1269 |
+
# Zephyr template
|
| 1270 |
+
# reference: https://huggingface.co/spaces/HuggingFaceH4/zephyr-playground/blob/main/dialogues.py
|
| 1271 |
+
register_conv_template(
|
| 1272 |
+
Conversation(
|
| 1273 |
+
name='zephyr',
|
| 1274 |
+
system_template='<|system|>\n{system_message}',
|
| 1275 |
+
roles=('<|user|>', '<|assistant|>'),
|
| 1276 |
+
sep_style=SeparatorStyle.CHATML,
|
| 1277 |
+
sep='</s>',
|
| 1278 |
+
stop_token_ids=[2],
|
| 1279 |
+
stop_str='</s>',
|
| 1280 |
+
)
|
| 1281 |
+
)
|
| 1282 |
+
|
| 1283 |
+
# InternVL-ZH template
|
| 1284 |
+
register_conv_template(
|
| 1285 |
+
Conversation(
|
| 1286 |
+
name='internvl_zh',
|
| 1287 |
+
system_template='',
|
| 1288 |
+
roles=('<human>', '<bot>'),
|
| 1289 |
+
sep_style=SeparatorStyle.INTERNVL_ZH,
|
| 1290 |
+
sep=' ',
|
| 1291 |
+
sep2='</s>',
|
| 1292 |
+
)
|
| 1293 |
+
)
|
| 1294 |
+
|
| 1295 |
+
|
| 1296 |
+
if __name__ == '__main__':
|
| 1297 |
+
from fastchat.conversation import get_conv_template
|
| 1298 |
+
|
| 1299 |
+
print('-- Vicuna template --')
|
| 1300 |
+
conv = get_conv_template('vicuna_v1.1')
|
| 1301 |
+
conv.append_message(conv.roles[0], 'Hello!')
|
| 1302 |
+
conv.append_message(conv.roles[1], 'Hi!')
|
| 1303 |
+
conv.append_message(conv.roles[0], 'How are you?')
|
| 1304 |
+
conv.append_message(conv.roles[1], None)
|
| 1305 |
+
print(conv.get_prompt())
|
| 1306 |
+
|
| 1307 |
+
print('\n')
|
| 1308 |
+
|
| 1309 |
+
print('-- Llama-2 template --')
|
| 1310 |
+
conv = get_conv_template('llama-2')
|
| 1311 |
+
conv.set_system_message('You are a helpful, respectful and honest assistant.')
|
| 1312 |
+
conv.append_message(conv.roles[0], 'Hello!')
|
| 1313 |
+
conv.append_message(conv.roles[1], 'Hi!')
|
| 1314 |
+
conv.append_message(conv.roles[0], 'How are you?')
|
| 1315 |
+
conv.append_message(conv.roles[1], None)
|
| 1316 |
+
print(conv.get_prompt())
|
| 1317 |
+
|
| 1318 |
+
print('\n')
|
| 1319 |
+
|
| 1320 |
+
print('-- ChatGPT template --')
|
| 1321 |
+
conv = get_conv_template('chatgpt')
|
| 1322 |
+
conv.append_message(conv.roles[0], 'Hello!')
|
| 1323 |
+
conv.append_message(conv.roles[1], 'Hi!')
|
| 1324 |
+
conv.append_message(conv.roles[0], 'How are you?')
|
| 1325 |
+
conv.append_message(conv.roles[1], None)
|
| 1326 |
+
print(conv.to_openai_api_messages())
|
| 1327 |
+
|
| 1328 |
+
print('\n')
|
| 1329 |
+
|
| 1330 |
+
print('-- Claude template --')
|
| 1331 |
+
conv = get_conv_template('claude')
|
| 1332 |
+
conv.append_message(conv.roles[0], 'Hello!')
|
| 1333 |
+
conv.append_message(conv.roles[1], 'Hi!')
|
| 1334 |
+
conv.append_message(conv.roles[0], 'How are you?')
|
| 1335 |
+
conv.append_message(conv.roles[1], None)
|
| 1336 |
+
print(conv.get_prompt())
|
generation_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"transformers_version": "4.40.2"
|
| 4 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model-00001-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:280e573aec368474db6c8461b2cf7dc2b066be1d197c50777df6c60c5182c371
|
| 3 |
+
size 4877694632
|
model-00002-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1e8080e1c91f65f49aa3878febaa4bd0a02348a9ae0043c3a8f2cb7af8fb4c62
|
| 3 |
+
size 4932752112
|
model-00003-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:41379adf84cb45e7d879f03566cf7630619fe522d3172eb17479d0bd70c6baf9
|
| 3 |
+
size 4330866208
|
model-00004-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7d9b5cc7d86de70326704fd08036fdcb7fa877f06a81f1b19098e466c7c0b2e
|
| 3 |
+
size 2414211920
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,743 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_size": 16555424768
|
| 4 |
+
},
|
| 5 |
+
"weight_map": {
|
| 6 |
+
"adapter_img.0.bias": "model-00004-of-00004.safetensors",
|
| 7 |
+
"adapter_img.0.weight": "model-00004-of-00004.safetensors",
|
| 8 |
+
"adapter_img.2.bias": "model-00004-of-00004.safetensors",
|
| 9 |
+
"adapter_img.2.weight": "model-00004-of-00004.safetensors",
|
| 10 |
+
"encoder_img.vision_tower.vision_model.embeddings.class_embedding": "model-00004-of-00004.safetensors",
|
| 11 |
+
"encoder_img.vision_tower.vision_model.embeddings.patch_embedding.weight": "model-00004-of-00004.safetensors",
|
| 12 |
+
"encoder_img.vision_tower.vision_model.embeddings.position_embedding.weight": "model-00004-of-00004.safetensors",
|
| 13 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 14 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 15 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 16 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 17 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 18 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 19 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 20 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 21 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 22 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 23 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 24 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 25 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 26 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 27 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 28 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.0.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 29 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 30 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 31 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 32 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 33 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 34 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 35 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 36 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 37 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 38 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 39 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 40 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 41 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 42 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 43 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 44 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.1.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 45 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 46 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 47 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 48 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 49 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 50 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 51 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 52 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 53 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 54 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 55 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 56 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 57 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 58 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 59 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 60 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.10.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 61 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 62 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 63 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 64 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 65 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 66 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 67 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 68 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 69 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 70 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 71 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 72 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 73 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 74 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 75 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 76 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.11.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 77 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 78 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 79 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 80 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 81 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 82 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 83 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 84 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 85 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 86 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 87 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 88 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 89 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 90 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 91 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 92 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.12.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 93 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 94 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 95 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 96 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 97 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 98 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 99 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 100 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 101 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 102 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 103 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 104 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 105 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 106 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 107 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 108 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.13.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 109 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 110 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 111 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 112 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 113 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 114 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 115 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 116 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 117 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 118 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 119 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 120 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 121 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 122 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 123 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 124 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.14.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 125 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 126 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 127 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 128 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 129 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 130 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 131 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 132 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 133 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 134 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 135 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 136 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 137 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 138 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 139 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 140 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.15.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 141 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 142 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 143 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 144 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 145 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 146 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 147 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 148 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 149 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 150 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 151 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 152 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 153 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 154 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 155 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 156 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.16.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 157 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 158 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 159 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 160 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 161 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 162 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 163 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 164 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 165 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 166 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 167 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 168 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 169 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 170 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 171 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 172 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.17.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 173 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 174 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 175 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 176 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 177 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 178 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 179 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 180 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 181 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 182 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 183 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 184 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 185 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 186 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 187 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 188 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.18.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 189 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 190 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 191 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 192 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 193 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 194 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 195 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 196 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 197 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 198 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 199 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 200 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 201 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 202 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 203 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 204 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.19.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 205 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 206 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 207 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 208 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 209 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 210 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 211 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 212 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 213 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 214 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 215 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 216 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 217 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 218 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 219 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 220 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.2.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 221 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 222 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 223 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 224 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 225 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 226 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 227 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 228 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 229 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 230 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 231 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 232 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 233 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 234 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 235 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 236 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.20.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 237 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 238 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 239 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 240 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 241 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 242 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 243 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 244 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 245 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 246 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 247 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 248 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 249 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 250 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 251 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 252 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.21.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 253 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 254 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 255 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 256 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 257 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 258 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 259 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 260 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 261 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 262 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 263 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 264 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 265 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 266 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 267 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 268 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.22.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 269 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 270 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 271 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 272 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 273 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 274 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 275 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 276 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 277 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 278 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 279 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 280 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 281 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 282 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 283 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 284 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.23.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 285 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 286 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 287 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 288 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 289 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 290 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 291 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 292 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 293 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 294 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 295 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 296 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 297 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 298 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 299 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 300 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.3.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 301 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 302 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 303 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 304 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 305 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 306 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 307 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 308 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 309 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 310 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 311 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 312 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 313 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 314 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 315 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 316 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.4.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 317 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 318 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 319 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 320 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 321 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 322 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 323 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 324 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 325 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 326 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 327 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 328 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 329 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 330 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 331 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 332 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.5.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 333 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 334 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 335 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 336 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 337 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 338 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 339 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 340 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 341 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 342 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 343 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 344 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 345 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 346 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 347 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 348 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.6.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 349 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 350 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 351 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 352 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 353 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 354 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 355 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 356 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 357 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 358 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 359 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 360 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 361 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 362 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 363 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 364 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.7.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 365 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 366 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 367 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 368 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 369 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 370 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 371 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 372 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 373 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 374 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 375 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 376 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 377 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 378 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 379 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 380 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.8.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 381 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.layer_norm1.bias": "model-00004-of-00004.safetensors",
|
| 382 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.layer_norm1.weight": "model-00004-of-00004.safetensors",
|
| 383 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.layer_norm2.bias": "model-00004-of-00004.safetensors",
|
| 384 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.layer_norm2.weight": "model-00004-of-00004.safetensors",
|
| 385 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.mlp.fc1.bias": "model-00004-of-00004.safetensors",
|
| 386 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.mlp.fc1.weight": "model-00004-of-00004.safetensors",
|
| 387 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.mlp.fc2.bias": "model-00004-of-00004.safetensors",
|
| 388 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.mlp.fc2.weight": "model-00004-of-00004.safetensors",
|
| 389 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.self_attn.k_proj.bias": "model-00004-of-00004.safetensors",
|
| 390 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.self_attn.k_proj.weight": "model-00004-of-00004.safetensors",
|
| 391 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.self_attn.out_proj.bias": "model-00004-of-00004.safetensors",
|
| 392 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.self_attn.out_proj.weight": "model-00004-of-00004.safetensors",
|
| 393 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.self_attn.q_proj.bias": "model-00004-of-00004.safetensors",
|
| 394 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.self_attn.q_proj.weight": "model-00004-of-00004.safetensors",
|
| 395 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.self_attn.v_proj.bias": "model-00004-of-00004.safetensors",
|
| 396 |
+
"encoder_img.vision_tower.vision_model.encoder.layers.9.self_attn.v_proj.weight": "model-00004-of-00004.safetensors",
|
| 397 |
+
"encoder_img.vision_tower.vision_model.post_layernorm.bias": "model-00004-of-00004.safetensors",
|
| 398 |
+
"encoder_img.vision_tower.vision_model.post_layernorm.weight": "model-00004-of-00004.safetensors",
|
| 399 |
+
"encoder_img.vision_tower.vision_model.pre_layrnorm.bias": "model-00004-of-00004.safetensors",
|
| 400 |
+
"encoder_img.vision_tower.vision_model.pre_layrnorm.weight": "model-00004-of-00004.safetensors",
|
| 401 |
+
"lm_model.lm_head.weight": "model-00004-of-00004.safetensors",
|
| 402 |
+
"lm_model.model.embed_tokens.weight": "model-00001-of-00004.safetensors",
|
| 403 |
+
"lm_model.model.layers.0.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 404 |
+
"lm_model.model.layers.0.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 405 |
+
"lm_model.model.layers.0.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 406 |
+
"lm_model.model.layers.0.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 407 |
+
"lm_model.model.layers.0.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 408 |
+
"lm_model.model.layers.0.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 409 |
+
"lm_model.model.layers.0.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 410 |
+
"lm_model.model.layers.0.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 411 |
+
"lm_model.model.layers.0.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 412 |
+
"lm_model.model.layers.0.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 413 |
+
"lm_model.model.layers.0.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 414 |
+
"lm_model.model.layers.0.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 415 |
+
"lm_model.model.layers.1.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 416 |
+
"lm_model.model.layers.1.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 417 |
+
"lm_model.model.layers.1.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 418 |
+
"lm_model.model.layers.1.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 419 |
+
"lm_model.model.layers.1.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 420 |
+
"lm_model.model.layers.1.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 421 |
+
"lm_model.model.layers.1.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 422 |
+
"lm_model.model.layers.1.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 423 |
+
"lm_model.model.layers.1.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 424 |
+
"lm_model.model.layers.1.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 425 |
+
"lm_model.model.layers.1.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 426 |
+
"lm_model.model.layers.1.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 427 |
+
"lm_model.model.layers.10.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 428 |
+
"lm_model.model.layers.10.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 429 |
+
"lm_model.model.layers.10.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 430 |
+
"lm_model.model.layers.10.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 431 |
+
"lm_model.model.layers.10.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 432 |
+
"lm_model.model.layers.10.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 433 |
+
"lm_model.model.layers.10.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 434 |
+
"lm_model.model.layers.10.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 435 |
+
"lm_model.model.layers.10.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 436 |
+
"lm_model.model.layers.10.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 437 |
+
"lm_model.model.layers.10.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 438 |
+
"lm_model.model.layers.10.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 439 |
+
"lm_model.model.layers.11.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 440 |
+
"lm_model.model.layers.11.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 441 |
+
"lm_model.model.layers.11.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 442 |
+
"lm_model.model.layers.11.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 443 |
+
"lm_model.model.layers.11.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 444 |
+
"lm_model.model.layers.11.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 445 |
+
"lm_model.model.layers.11.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 446 |
+
"lm_model.model.layers.11.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 447 |
+
"lm_model.model.layers.11.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 448 |
+
"lm_model.model.layers.11.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 449 |
+
"lm_model.model.layers.11.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 450 |
+
"lm_model.model.layers.11.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 451 |
+
"lm_model.model.layers.12.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 452 |
+
"lm_model.model.layers.12.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 453 |
+
"lm_model.model.layers.12.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 454 |
+
"lm_model.model.layers.12.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 455 |
+
"lm_model.model.layers.12.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 456 |
+
"lm_model.model.layers.12.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 457 |
+
"lm_model.model.layers.12.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 458 |
+
"lm_model.model.layers.12.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 459 |
+
"lm_model.model.layers.12.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 460 |
+
"lm_model.model.layers.12.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 461 |
+
"lm_model.model.layers.12.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 462 |
+
"lm_model.model.layers.12.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 463 |
+
"lm_model.model.layers.13.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 464 |
+
"lm_model.model.layers.13.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 465 |
+
"lm_model.model.layers.13.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 466 |
+
"lm_model.model.layers.13.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 467 |
+
"lm_model.model.layers.13.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 468 |
+
"lm_model.model.layers.13.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 469 |
+
"lm_model.model.layers.13.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 470 |
+
"lm_model.model.layers.13.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 471 |
+
"lm_model.model.layers.13.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 472 |
+
"lm_model.model.layers.13.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 473 |
+
"lm_model.model.layers.13.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 474 |
+
"lm_model.model.layers.13.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 475 |
+
"lm_model.model.layers.14.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 476 |
+
"lm_model.model.layers.14.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 477 |
+
"lm_model.model.layers.14.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 478 |
+
"lm_model.model.layers.14.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 479 |
+
"lm_model.model.layers.14.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 480 |
+
"lm_model.model.layers.14.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 481 |
+
"lm_model.model.layers.14.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 482 |
+
"lm_model.model.layers.14.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 483 |
+
"lm_model.model.layers.14.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 484 |
+
"lm_model.model.layers.14.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 485 |
+
"lm_model.model.layers.14.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 486 |
+
"lm_model.model.layers.14.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 487 |
+
"lm_model.model.layers.15.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 488 |
+
"lm_model.model.layers.15.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 489 |
+
"lm_model.model.layers.15.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 490 |
+
"lm_model.model.layers.15.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 491 |
+
"lm_model.model.layers.15.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 492 |
+
"lm_model.model.layers.15.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 493 |
+
"lm_model.model.layers.15.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 494 |
+
"lm_model.model.layers.15.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 495 |
+
"lm_model.model.layers.15.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 496 |
+
"lm_model.model.layers.15.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 497 |
+
"lm_model.model.layers.15.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 498 |
+
"lm_model.model.layers.15.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 499 |
+
"lm_model.model.layers.16.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 500 |
+
"lm_model.model.layers.16.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 501 |
+
"lm_model.model.layers.16.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 502 |
+
"lm_model.model.layers.16.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 503 |
+
"lm_model.model.layers.16.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 504 |
+
"lm_model.model.layers.16.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 505 |
+
"lm_model.model.layers.16.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 506 |
+
"lm_model.model.layers.16.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 507 |
+
"lm_model.model.layers.16.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 508 |
+
"lm_model.model.layers.16.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 509 |
+
"lm_model.model.layers.16.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 510 |
+
"lm_model.model.layers.16.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 511 |
+
"lm_model.model.layers.17.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 512 |
+
"lm_model.model.layers.17.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 513 |
+
"lm_model.model.layers.17.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 514 |
+
"lm_model.model.layers.17.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 515 |
+
"lm_model.model.layers.17.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 516 |
+
"lm_model.model.layers.17.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 517 |
+
"lm_model.model.layers.17.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 518 |
+
"lm_model.model.layers.17.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 519 |
+
"lm_model.model.layers.17.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 520 |
+
"lm_model.model.layers.17.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 521 |
+
"lm_model.model.layers.17.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 522 |
+
"lm_model.model.layers.17.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 523 |
+
"lm_model.model.layers.18.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 524 |
+
"lm_model.model.layers.18.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 525 |
+
"lm_model.model.layers.18.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 526 |
+
"lm_model.model.layers.18.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 527 |
+
"lm_model.model.layers.18.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 528 |
+
"lm_model.model.layers.18.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 529 |
+
"lm_model.model.layers.18.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 530 |
+
"lm_model.model.layers.18.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 531 |
+
"lm_model.model.layers.18.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 532 |
+
"lm_model.model.layers.18.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 533 |
+
"lm_model.model.layers.18.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 534 |
+
"lm_model.model.layers.18.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 535 |
+
"lm_model.model.layers.19.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 536 |
+
"lm_model.model.layers.19.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 537 |
+
"lm_model.model.layers.19.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 538 |
+
"lm_model.model.layers.19.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 539 |
+
"lm_model.model.layers.19.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 540 |
+
"lm_model.model.layers.19.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 541 |
+
"lm_model.model.layers.19.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 542 |
+
"lm_model.model.layers.19.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 543 |
+
"lm_model.model.layers.19.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 544 |
+
"lm_model.model.layers.19.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 545 |
+
"lm_model.model.layers.19.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 546 |
+
"lm_model.model.layers.19.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 547 |
+
"lm_model.model.layers.2.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 548 |
+
"lm_model.model.layers.2.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 549 |
+
"lm_model.model.layers.2.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 550 |
+
"lm_model.model.layers.2.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 551 |
+
"lm_model.model.layers.2.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 552 |
+
"lm_model.model.layers.2.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 553 |
+
"lm_model.model.layers.2.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 554 |
+
"lm_model.model.layers.2.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 555 |
+
"lm_model.model.layers.2.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 556 |
+
"lm_model.model.layers.2.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 557 |
+
"lm_model.model.layers.2.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 558 |
+
"lm_model.model.layers.2.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 559 |
+
"lm_model.model.layers.20.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 560 |
+
"lm_model.model.layers.20.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 561 |
+
"lm_model.model.layers.20.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 562 |
+
"lm_model.model.layers.20.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 563 |
+
"lm_model.model.layers.20.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 564 |
+
"lm_model.model.layers.20.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 565 |
+
"lm_model.model.layers.20.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 566 |
+
"lm_model.model.layers.20.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 567 |
+
"lm_model.model.layers.20.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 568 |
+
"lm_model.model.layers.20.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 569 |
+
"lm_model.model.layers.20.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 570 |
+
"lm_model.model.layers.20.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 571 |
+
"lm_model.model.layers.21.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 572 |
+
"lm_model.model.layers.21.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 573 |
+
"lm_model.model.layers.21.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 574 |
+
"lm_model.model.layers.21.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 575 |
+
"lm_model.model.layers.21.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 576 |
+
"lm_model.model.layers.21.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 577 |
+
"lm_model.model.layers.21.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 578 |
+
"lm_model.model.layers.21.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 579 |
+
"lm_model.model.layers.21.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 580 |
+
"lm_model.model.layers.21.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 581 |
+
"lm_model.model.layers.21.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 582 |
+
"lm_model.model.layers.21.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 583 |
+
"lm_model.model.layers.22.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 584 |
+
"lm_model.model.layers.22.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 585 |
+
"lm_model.model.layers.22.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 586 |
+
"lm_model.model.layers.22.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 587 |
+
"lm_model.model.layers.22.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 588 |
+
"lm_model.model.layers.22.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 589 |
+
"lm_model.model.layers.22.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 590 |
+
"lm_model.model.layers.22.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 591 |
+
"lm_model.model.layers.22.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 592 |
+
"lm_model.model.layers.22.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 593 |
+
"lm_model.model.layers.22.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 594 |
+
"lm_model.model.layers.22.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 595 |
+
"lm_model.model.layers.23.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 596 |
+
"lm_model.model.layers.23.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 597 |
+
"lm_model.model.layers.23.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 598 |
+
"lm_model.model.layers.23.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 599 |
+
"lm_model.model.layers.23.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 600 |
+
"lm_model.model.layers.23.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 601 |
+
"lm_model.model.layers.23.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 602 |
+
"lm_model.model.layers.23.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 603 |
+
"lm_model.model.layers.23.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 604 |
+
"lm_model.model.layers.23.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 605 |
+
"lm_model.model.layers.23.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 606 |
+
"lm_model.model.layers.23.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 607 |
+
"lm_model.model.layers.24.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 608 |
+
"lm_model.model.layers.24.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 609 |
+
"lm_model.model.layers.24.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 610 |
+
"lm_model.model.layers.24.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 611 |
+
"lm_model.model.layers.24.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 612 |
+
"lm_model.model.layers.24.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 613 |
+
"lm_model.model.layers.24.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 614 |
+
"lm_model.model.layers.24.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 615 |
+
"lm_model.model.layers.24.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 616 |
+
"lm_model.model.layers.24.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 617 |
+
"lm_model.model.layers.24.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 618 |
+
"lm_model.model.layers.24.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 619 |
+
"lm_model.model.layers.25.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 620 |
+
"lm_model.model.layers.25.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 621 |
+
"lm_model.model.layers.25.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 622 |
+
"lm_model.model.layers.25.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 623 |
+
"lm_model.model.layers.25.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 624 |
+
"lm_model.model.layers.25.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 625 |
+
"lm_model.model.layers.25.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 626 |
+
"lm_model.model.layers.25.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 627 |
+
"lm_model.model.layers.25.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 628 |
+
"lm_model.model.layers.25.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 629 |
+
"lm_model.model.layers.25.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 630 |
+
"lm_model.model.layers.25.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 631 |
+
"lm_model.model.layers.26.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 632 |
+
"lm_model.model.layers.26.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 633 |
+
"lm_model.model.layers.26.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 634 |
+
"lm_model.model.layers.26.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 635 |
+
"lm_model.model.layers.26.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 636 |
+
"lm_model.model.layers.26.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 637 |
+
"lm_model.model.layers.26.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 638 |
+
"lm_model.model.layers.26.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 639 |
+
"lm_model.model.layers.26.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 640 |
+
"lm_model.model.layers.26.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 641 |
+
"lm_model.model.layers.26.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 642 |
+
"lm_model.model.layers.26.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 643 |
+
"lm_model.model.layers.27.input_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 644 |
+
"lm_model.model.layers.27.mlp.down_proj.weight": "model-00003-of-00004.safetensors",
|
| 645 |
+
"lm_model.model.layers.27.mlp.gate_proj.weight": "model-00003-of-00004.safetensors",
|
| 646 |
+
"lm_model.model.layers.27.mlp.up_proj.weight": "model-00003-of-00004.safetensors",
|
| 647 |
+
"lm_model.model.layers.27.post_attention_layernorm.weight": "model-00003-of-00004.safetensors",
|
| 648 |
+
"lm_model.model.layers.27.self_attn.k_proj.bias": "model-00003-of-00004.safetensors",
|
| 649 |
+
"lm_model.model.layers.27.self_attn.k_proj.weight": "model-00003-of-00004.safetensors",
|
| 650 |
+
"lm_model.model.layers.27.self_attn.o_proj.weight": "model-00003-of-00004.safetensors",
|
| 651 |
+
"lm_model.model.layers.27.self_attn.q_proj.bias": "model-00003-of-00004.safetensors",
|
| 652 |
+
"lm_model.model.layers.27.self_attn.q_proj.weight": "model-00003-of-00004.safetensors",
|
| 653 |
+
"lm_model.model.layers.27.self_attn.v_proj.bias": "model-00003-of-00004.safetensors",
|
| 654 |
+
"lm_model.model.layers.27.self_attn.v_proj.weight": "model-00003-of-00004.safetensors",
|
| 655 |
+
"lm_model.model.layers.3.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 656 |
+
"lm_model.model.layers.3.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 657 |
+
"lm_model.model.layers.3.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 658 |
+
"lm_model.model.layers.3.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 659 |
+
"lm_model.model.layers.3.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 660 |
+
"lm_model.model.layers.3.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 661 |
+
"lm_model.model.layers.3.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 662 |
+
"lm_model.model.layers.3.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 663 |
+
"lm_model.model.layers.3.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 664 |
+
"lm_model.model.layers.3.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 665 |
+
"lm_model.model.layers.3.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 666 |
+
"lm_model.model.layers.3.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 667 |
+
"lm_model.model.layers.4.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 668 |
+
"lm_model.model.layers.4.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 669 |
+
"lm_model.model.layers.4.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 670 |
+
"lm_model.model.layers.4.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 671 |
+
"lm_model.model.layers.4.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 672 |
+
"lm_model.model.layers.4.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 673 |
+
"lm_model.model.layers.4.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 674 |
+
"lm_model.model.layers.4.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 675 |
+
"lm_model.model.layers.4.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 676 |
+
"lm_model.model.layers.4.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 677 |
+
"lm_model.model.layers.4.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 678 |
+
"lm_model.model.layers.4.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 679 |
+
"lm_model.model.layers.5.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 680 |
+
"lm_model.model.layers.5.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 681 |
+
"lm_model.model.layers.5.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 682 |
+
"lm_model.model.layers.5.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 683 |
+
"lm_model.model.layers.5.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 684 |
+
"lm_model.model.layers.5.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 685 |
+
"lm_model.model.layers.5.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 686 |
+
"lm_model.model.layers.5.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 687 |
+
"lm_model.model.layers.5.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 688 |
+
"lm_model.model.layers.5.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 689 |
+
"lm_model.model.layers.5.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 690 |
+
"lm_model.model.layers.5.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 691 |
+
"lm_model.model.layers.6.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 692 |
+
"lm_model.model.layers.6.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 693 |
+
"lm_model.model.layers.6.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 694 |
+
"lm_model.model.layers.6.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 695 |
+
"lm_model.model.layers.6.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 696 |
+
"lm_model.model.layers.6.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 697 |
+
"lm_model.model.layers.6.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 698 |
+
"lm_model.model.layers.6.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 699 |
+
"lm_model.model.layers.6.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 700 |
+
"lm_model.model.layers.6.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 701 |
+
"lm_model.model.layers.6.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 702 |
+
"lm_model.model.layers.6.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 703 |
+
"lm_model.model.layers.7.input_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 704 |
+
"lm_model.model.layers.7.mlp.down_proj.weight": "model-00001-of-00004.safetensors",
|
| 705 |
+
"lm_model.model.layers.7.mlp.gate_proj.weight": "model-00001-of-00004.safetensors",
|
| 706 |
+
"lm_model.model.layers.7.mlp.up_proj.weight": "model-00001-of-00004.safetensors",
|
| 707 |
+
"lm_model.model.layers.7.post_attention_layernorm.weight": "model-00001-of-00004.safetensors",
|
| 708 |
+
"lm_model.model.layers.7.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 709 |
+
"lm_model.model.layers.7.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 710 |
+
"lm_model.model.layers.7.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 711 |
+
"lm_model.model.layers.7.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 712 |
+
"lm_model.model.layers.7.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 713 |
+
"lm_model.model.layers.7.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 714 |
+
"lm_model.model.layers.7.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 715 |
+
"lm_model.model.layers.8.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 716 |
+
"lm_model.model.layers.8.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 717 |
+
"lm_model.model.layers.8.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 718 |
+
"lm_model.model.layers.8.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 719 |
+
"lm_model.model.layers.8.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 720 |
+
"lm_model.model.layers.8.self_attn.k_proj.bias": "model-00001-of-00004.safetensors",
|
| 721 |
+
"lm_model.model.layers.8.self_attn.k_proj.weight": "model-00001-of-00004.safetensors",
|
| 722 |
+
"lm_model.model.layers.8.self_attn.o_proj.weight": "model-00001-of-00004.safetensors",
|
| 723 |
+
"lm_model.model.layers.8.self_attn.q_proj.bias": "model-00001-of-00004.safetensors",
|
| 724 |
+
"lm_model.model.layers.8.self_attn.q_proj.weight": "model-00001-of-00004.safetensors",
|
| 725 |
+
"lm_model.model.layers.8.self_attn.v_proj.bias": "model-00001-of-00004.safetensors",
|
| 726 |
+
"lm_model.model.layers.8.self_attn.v_proj.weight": "model-00001-of-00004.safetensors",
|
| 727 |
+
"lm_model.model.layers.9.input_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 728 |
+
"lm_model.model.layers.9.mlp.down_proj.weight": "model-00002-of-00004.safetensors",
|
| 729 |
+
"lm_model.model.layers.9.mlp.gate_proj.weight": "model-00002-of-00004.safetensors",
|
| 730 |
+
"lm_model.model.layers.9.mlp.up_proj.weight": "model-00002-of-00004.safetensors",
|
| 731 |
+
"lm_model.model.layers.9.post_attention_layernorm.weight": "model-00002-of-00004.safetensors",
|
| 732 |
+
"lm_model.model.layers.9.self_attn.k_proj.bias": "model-00002-of-00004.safetensors",
|
| 733 |
+
"lm_model.model.layers.9.self_attn.k_proj.weight": "model-00002-of-00004.safetensors",
|
| 734 |
+
"lm_model.model.layers.9.self_attn.o_proj.weight": "model-00002-of-00004.safetensors",
|
| 735 |
+
"lm_model.model.layers.9.self_attn.q_proj.bias": "model-00002-of-00004.safetensors",
|
| 736 |
+
"lm_model.model.layers.9.self_attn.q_proj.weight": "model-00002-of-00004.safetensors",
|
| 737 |
+
"lm_model.model.layers.9.self_attn.v_proj.bias": "model-00002-of-00004.safetensors",
|
| 738 |
+
"lm_model.model.layers.9.self_attn.v_proj.weight": "model-00002-of-00004.safetensors",
|
| 739 |
+
"lm_model.model.norm.weight": "model-00003-of-00004.safetensors",
|
| 740 |
+
"newline": "model-00001-of-00004.safetensors",
|
| 741 |
+
"separate": "model-00001-of-00004.safetensors"
|
| 742 |
+
}
|
| 743 |
+
}
|
modeling_infmllm_unified_hd_chat.py
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ional as F
|
| 7 |
+
from timm.models.layers import trunc_normal_
|
| 8 |
+
from contextlib import suppress
|
| 9 |
+
import logging
|
| 10 |
+
from einops import rearrange
|
| 11 |
+
from peft import LoraConfig, get_peft_model
|
| 12 |
+
from bigmodelvis import Visualization
|
| 13 |
+
|
| 14 |
+
from .clip_encoder_hd import CLIPVisionTowerHD
|
| 15 |
+
from .conversation import get_conv_template
|
| 16 |
+
from .processors_conv import preprocess_qwen
|
| 17 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedModel
|
| 18 |
+
from transformers.generation import GenerationConfig
|
| 19 |
+
from transformers import Qwen2Config, Qwen2ForCausalLM
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def get_autocast(precision, cache_enabled=True):
|
| 23 |
+
if precision == "amp_bfloat16" or precision == "amp_bf16" or precision == 'bf16':
|
| 24 |
+
# amp_bfloat16 is more stable than amp float16 for clip training
|
| 25 |
+
return lambda: torch.cuda.amp.autocast(dtype=torch.bfloat16, cache_enabled=cache_enabled)
|
| 26 |
+
elif precision == 'fp16':
|
| 27 |
+
return lambda: torch.cuda.amp.autocast(dtype=torch.float16, cache_enabled=cache_enabled)
|
| 28 |
+
elif precision == 'fp32':
|
| 29 |
+
return suppress
|
| 30 |
+
else:
|
| 31 |
+
raise ValueError('not supported precision: {}'.format(precision))
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class LayerNorm(nn.LayerNorm):
|
| 35 |
+
"""Subclass torch's LayerNorm to handle fp16."""
|
| 36 |
+
def forward(self, x: torch.Tensor):
|
| 37 |
+
orig_type = x.dtype
|
| 38 |
+
ret = super().forward(x.type(torch.float32))
|
| 39 |
+
return ret.type(orig_type)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class MLP(nn.Module):
|
| 43 |
+
""" Very simple multi-layer perceptron (also called FFN)"""
|
| 44 |
+
|
| 45 |
+
def __init__(self, input_dim, hidden_dim, output_dim, num_layers):
|
| 46 |
+
super().__init__()
|
| 47 |
+
self.num_layers = num_layers
|
| 48 |
+
h = [hidden_dim] * (num_layers - 1)
|
| 49 |
+
self.layers = nn.ModuleList(nn.Linear(n, k) for n, k in zip([input_dim] + h, h + [output_dim]))
|
| 50 |
+
|
| 51 |
+
def forward(self, x):
|
| 52 |
+
for i, layer in enumerate(self.layers):
|
| 53 |
+
x = F.relu(layer(x)) if i < self.num_layers - 1 else layer(x)
|
| 54 |
+
return x
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class InfMLLM_Unified_HD_Chat(PreTrainedModel):
|
| 58 |
+
|
| 59 |
+
def __init__(self, config, debug=False):
|
| 60 |
+
super().__init__(config)
|
| 61 |
+
|
| 62 |
+
## Initialize LM model
|
| 63 |
+
self.lm_tokenizer = AutoTokenizer.from_pretrained(config._name_or_path, use_fast=False, trust_remote_code=True)
|
| 64 |
+
self.media_token_img = "<|image|>"
|
| 65 |
+
self.media_token_id_img = self.lm_tokenizer(self.media_token_img, return_tensors="pt",add_special_tokens=False).input_ids.item()
|
| 66 |
+
self.lm_model = Qwen2ForCausalLM(config.lm_config)
|
| 67 |
+
|
| 68 |
+
self.lm_tokenizer.model_max_length = config.max_txt_len
|
| 69 |
+
|
| 70 |
+
self.template_name = config.conv_style
|
| 71 |
+
self.preprocess_function = preprocess_qwen
|
| 72 |
+
|
| 73 |
+
self.separate = nn.Parameter(torch.zeros([1, 1, 4096]))
|
| 74 |
+
self.newline = nn.Parameter(torch.zeros([1, 1, 1, 4096]))
|
| 75 |
+
|
| 76 |
+
## Initialize image encoder
|
| 77 |
+
self.encoder_img = CLIPVisionTowerHD(config.vision_config, vision_select_layer=-2)
|
| 78 |
+
self.encoder_img_ln = lambda x: x
|
| 79 |
+
|
| 80 |
+
self.adapter_img = nn.Sequential(
|
| 81 |
+
nn.Linear(self.encoder_img.num_features*4, self.lm_model.config.hidden_size),
|
| 82 |
+
nn.GELU(),
|
| 83 |
+
nn.Linear(self.lm_model.config.hidden_size, self.lm_model.config.hidden_size)
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
## Others
|
| 87 |
+
self.config = config
|
| 88 |
+
self.precision = config.precision
|
| 89 |
+
self._apply_lemmatizer = getattr(config, 'apply_lemmatizer', False)
|
| 90 |
+
self._lemmatizer = None
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def forward_encoder_img(self, image):
|
| 94 |
+
autocast = get_autocast(self.precision, cache_enabled=True)
|
| 95 |
+
with autocast():
|
| 96 |
+
assert isinstance(image, list)
|
| 97 |
+
image_embeds, image_split = self.encoder_img(image, self.separate, self.newline)
|
| 98 |
+
|
| 99 |
+
image_embeds = self.encoder_img_ln(image_embeds) # [bsz, L, D]
|
| 100 |
+
image_embeds = self.adapter_img(image_embeds)
|
| 101 |
+
return image_embeds, image_split
|
| 102 |
+
|
| 103 |
+
def _concat_embeds(self,
|
| 104 |
+
prompt_embeds, prompt_ids, prompt_masks,
|
| 105 |
+
labels=None, padding='left'):
|
| 106 |
+
emb_lens = [len(emb) for emb in prompt_embeds]
|
| 107 |
+
if len(set(emb_lens)) == 1:
|
| 108 |
+
if labels is not None:
|
| 109 |
+
return torch.stack(prompt_embeds, dim=0), torch.stack(prompt_ids, dim=0), torch.stack(prompt_masks, dim=0), torch.stack(labels, dim=0)
|
| 110 |
+
return torch.stack(prompt_embeds, dim=0), torch.stack(prompt_ids, dim=0), torch.stack(prompt_masks, dim=0)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
pad_emb = self.lm_model.get_input_embeddings()(torch.tensor(self.lm_tokenizer.pad_token_id, device=prompt_embeds[0].device))
|
| 114 |
+
|
| 115 |
+
prompt_embeds_new = pad_emb.expand(len(emb_lens), max(emb_lens), -1).clone()
|
| 116 |
+
prompt_ids_new = torch.ones([len(emb_lens), max(emb_lens)]).to(prompt_ids[0]) * self.lm_tokenizer.pad_token_id
|
| 117 |
+
prompt_masks_new = torch.zeros([len(emb_lens), max(emb_lens)]).to(prompt_masks[0])
|
| 118 |
+
if labels is not None:
|
| 119 |
+
labels_new = -100 * torch.ones([len(emb_lens), max(emb_lens)]).to(prompt_ids[0])
|
| 120 |
+
|
| 121 |
+
for i, L in enumerate(emb_lens):
|
| 122 |
+
if padding == 'left':
|
| 123 |
+
prompt_embeds_new[i, -L:] = prompt_embeds[i]
|
| 124 |
+
prompt_ids_new[i, -L:] = prompt_ids[i]
|
| 125 |
+
prompt_masks_new[i, -L:] = prompt_masks[i]
|
| 126 |
+
if labels is not None:
|
| 127 |
+
labels_new[i, -L:] = labels[i]
|
| 128 |
+
|
| 129 |
+
elif padding == 'right':
|
| 130 |
+
prompt_embeds_new[i, :L] = prompt_embeds[i]
|
| 131 |
+
prompt_ids_new[i, :L] = prompt_ids[i]
|
| 132 |
+
prompt_masks_new[i, :L] = prompt_masks[i]
|
| 133 |
+
if labels is not None:
|
| 134 |
+
labels_new[i, :L] = labels[i]
|
| 135 |
+
else:
|
| 136 |
+
raise ValueError()
|
| 137 |
+
|
| 138 |
+
if labels is not None:
|
| 139 |
+
return prompt_embeds_new, prompt_ids_new, prompt_masks_new, labels_new
|
| 140 |
+
return prompt_embeds_new, prompt_ids_new, prompt_masks_new
|
| 141 |
+
|
| 142 |
+
def _insert_media_feat(self,
|
| 143 |
+
prompt_embeds, prompt_ids, prompt_masks,
|
| 144 |
+
is_languages,
|
| 145 |
+
embeds_media, media_token_id,
|
| 146 |
+
index_list=None,
|
| 147 |
+
labels=None, len_media=None):
|
| 148 |
+
## insert embeds_media into prompt
|
| 149 |
+
prompt_embeds_new = []
|
| 150 |
+
prompt_masks_new = []
|
| 151 |
+
prompt_ids_new = []
|
| 152 |
+
labels_new = []
|
| 153 |
+
device = embeds_media[0].device
|
| 154 |
+
|
| 155 |
+
if index_list is not None:
|
| 156 |
+
assert len(index_list) == len(embeds_media)
|
| 157 |
+
assert len(embeds_media) <= len(prompt_embeds)
|
| 158 |
+
|
| 159 |
+
for b in range(len(prompt_embeds)):
|
| 160 |
+
if (index_list is not None) and (b not in index_list):
|
| 161 |
+
prompt_embeds_new.append(prompt_embeds[b])
|
| 162 |
+
prompt_ids_new.append(prompt_ids[b])
|
| 163 |
+
prompt_masks_new.append(prompt_masks[b])
|
| 164 |
+
if labels is not None:
|
| 165 |
+
labels_new.append(labels[b])
|
| 166 |
+
else:
|
| 167 |
+
_idx = prompt_ids[b].tolist().index(media_token_id)
|
| 168 |
+
if index_list is not None:
|
| 169 |
+
b_media = index_list.index(b)
|
| 170 |
+
else:
|
| 171 |
+
b_media = b
|
| 172 |
+
|
| 173 |
+
if len_media is not None:
|
| 174 |
+
cur_embeds_media = embeds_media[b_media, :len_media[b_media]]
|
| 175 |
+
else:
|
| 176 |
+
cur_embeds_media = embeds_media[b_media]
|
| 177 |
+
|
| 178 |
+
prompt_embeds_new.append(torch.cat([prompt_embeds[b][:_idx+1],
|
| 179 |
+
cur_embeds_media,
|
| 180 |
+
prompt_embeds[b][_idx+1:]
|
| 181 |
+
], dim=0))
|
| 182 |
+
prompt_ids_new.append(torch.cat([prompt_ids[b][:_idx+1],
|
| 183 |
+
torch.ones(len(cur_embeds_media), dtype=torch.long).to(device).fill_(-100),
|
| 184 |
+
prompt_ids[b][_idx+1:]
|
| 185 |
+
], dim=0))
|
| 186 |
+
if labels is not None:
|
| 187 |
+
labels_new.append(torch.cat([labels[b][:_idx+1],
|
| 188 |
+
torch.ones(len(cur_embeds_media), dtype=torch.long).to(device).fill_(-100),
|
| 189 |
+
labels[b][_idx+1:]
|
| 190 |
+
], dim=0))
|
| 191 |
+
|
| 192 |
+
# if is pure-language sample, mask out image-embeddings
|
| 193 |
+
prompt_masks_new.append(torch.cat([prompt_masks[b][:_idx+1],
|
| 194 |
+
torch.zeros(len(cur_embeds_media), dtype=torch.long).to(device) if is_languages[b] else
|
| 195 |
+
torch.ones(len(cur_embeds_media), dtype=torch.long).to(device),
|
| 196 |
+
prompt_masks[b][_idx+1:]], dim=0))
|
| 197 |
+
|
| 198 |
+
if labels is not None:
|
| 199 |
+
return prompt_embeds_new, prompt_ids_new, prompt_masks_new, labels_new
|
| 200 |
+
return prompt_embeds_new, prompt_ids_new, prompt_masks_new
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
@torch.no_grad()
|
| 204 |
+
def generate(
|
| 205 |
+
self,
|
| 206 |
+
samples,
|
| 207 |
+
num_beams=5,
|
| 208 |
+
max_length=128,
|
| 209 |
+
min_length=1,
|
| 210 |
+
top_p=0.9,
|
| 211 |
+
temperature=0.,
|
| 212 |
+
return_prompts=False
|
| 213 |
+
):
|
| 214 |
+
autocast = get_autocast(self.precision, cache_enabled=True)
|
| 215 |
+
with autocast():
|
| 216 |
+
conversations = samples['conversations']
|
| 217 |
+
is_languages = [False] * len(conversations)
|
| 218 |
+
|
| 219 |
+
image_img = samples.get('images', None)
|
| 220 |
+
|
| 221 |
+
index_img = list(range(len(image_img)))
|
| 222 |
+
|
| 223 |
+
device = None
|
| 224 |
+
special_prefix = ["" for _ in range(len(conversations))]
|
| 225 |
+
|
| 226 |
+
if (self.config.encoder_img is not None) and (image_img is not None) and len(index_img) > 0:
|
| 227 |
+
for i in index_img:
|
| 228 |
+
special_prefix[i] = self.media_token_img + special_prefix[i]
|
| 229 |
+
|
| 230 |
+
new_image_img = []
|
| 231 |
+
for index in index_img:
|
| 232 |
+
new_image_img.append(image_img[index])
|
| 233 |
+
embeds_img, len_img = self.forward_encoder_img(new_image_img)
|
| 234 |
+
device = embeds_img.device
|
| 235 |
+
|
| 236 |
+
conv = get_conv_template(self.template_name)
|
| 237 |
+
roles = {'human': conv.roles[0], 'gpt': conv.roles[1]}
|
| 238 |
+
|
| 239 |
+
prompts = []
|
| 240 |
+
for i, source in enumerate(conversations):
|
| 241 |
+
if roles[source[0]['from']] != conv.roles[0]:
|
| 242 |
+
# Skip the first one if it is not from human
|
| 243 |
+
source = source[1:]
|
| 244 |
+
|
| 245 |
+
per_prefix = special_prefix[i]
|
| 246 |
+
conv.messages = []
|
| 247 |
+
for j, sentence in enumerate(source):
|
| 248 |
+
role = roles[sentence['from']]
|
| 249 |
+
assert role == conv.roles[j % 2], f'{i}'
|
| 250 |
+
sentence['value'] = sentence['value'].replace("<image>", "").strip() # llava-1.5 add <image> to the begin of the question, remove here
|
| 251 |
+
|
| 252 |
+
if j == 0:
|
| 253 |
+
sentence['value'] = per_prefix + sentence['value']
|
| 254 |
+
|
| 255 |
+
conv.append_message(role, sentence['value'])
|
| 256 |
+
prompts.append(conv.get_prompt())
|
| 257 |
+
|
| 258 |
+
self.lm_tokenizer.padding_side = "left"
|
| 259 |
+
if self.lm_tokenizer.bos_token is not None:
|
| 260 |
+
prompt_text = [self.lm_tokenizer.bos_token + t for t in prompts]
|
| 261 |
+
else:
|
| 262 |
+
prompt_text = prompts
|
| 263 |
+
|
| 264 |
+
prompt_tokens = self.lm_tokenizer(
|
| 265 |
+
prompt_text,
|
| 266 |
+
return_tensors="pt",
|
| 267 |
+
padding="longest",
|
| 268 |
+
truncation=False,
|
| 269 |
+
add_special_tokens=False
|
| 270 |
+
).to(device)
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
prompt_embeds = self.lm_model.get_input_embeddings()(prompt_tokens.input_ids)
|
| 274 |
+
|
| 275 |
+
prompt_masks = prompt_tokens.attention_mask # [bsz, n2]
|
| 276 |
+
prompt_ids = prompt_tokens.input_ids
|
| 277 |
+
assert torch.all(prompt_ids[:, -1] != self.lm_tokenizer.pad_token_id), "make sure padding left"
|
| 278 |
+
|
| 279 |
+
if embeds_img is not None:
|
| 280 |
+
prompt_embeds, prompt_ids, prompt_masks = self._insert_media_feat(prompt_embeds=prompt_embeds,
|
| 281 |
+
prompt_ids=prompt_ids,
|
| 282 |
+
prompt_masks=prompt_masks,
|
| 283 |
+
is_languages=is_languages,
|
| 284 |
+
embeds_media=embeds_img,
|
| 285 |
+
media_token_id=self.media_token_id_img,
|
| 286 |
+
index_list=index_img,
|
| 287 |
+
len_media=len_img)
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
# pad and concat embeds
|
| 291 |
+
prompt_embeds, prompt_ids, prompt_masks = self._concat_embeds(prompt_embeds, prompt_ids, prompt_masks, padding="left")
|
| 292 |
+
assert torch.all(prompt_ids[:, -1] != self.lm_tokenizer.pad_token_id), "make sure padding left"
|
| 293 |
+
|
| 294 |
+
kwargs = {}
|
| 295 |
+
kwargs['max_new_tokens'] = max_length
|
| 296 |
+
|
| 297 |
+
outputs = self.lm_model.generate(
|
| 298 |
+
#input_ids=input_ids,
|
| 299 |
+
inputs_embeds=prompt_embeds,
|
| 300 |
+
attention_mask=prompt_masks,
|
| 301 |
+
do_sample=True if temperature > 0 else False,
|
| 302 |
+
temperature=temperature,
|
| 303 |
+
top_p=top_p,
|
| 304 |
+
num_beams=num_beams,
|
| 305 |
+
eos_token_id=self.lm_tokenizer.eos_token_id,
|
| 306 |
+
#max_length=max_length,
|
| 307 |
+
min_length=min_length,
|
| 308 |
+
**kwargs
|
| 309 |
+
)
|
| 310 |
+
output_text = self.lm_tokenizer.batch_decode(
|
| 311 |
+
outputs, skip_special_tokens=True
|
| 312 |
+
)
|
| 313 |
+
output_text = [text.strip() for text in output_text]
|
| 314 |
+
|
| 315 |
+
if self._apply_lemmatizer or ("apply_lemmatizer" in samples.keys() and samples["apply_lemmatizer"]):
|
| 316 |
+
output_text = self._lemmatize(output_text)
|
| 317 |
+
|
| 318 |
+
if return_prompts:
|
| 319 |
+
return output_text, prompts
|
| 320 |
+
return output_text
|
| 321 |
+
|
| 322 |
+
def _lemmatize(self, answers):
|
| 323 |
+
def apply(answer):
|
| 324 |
+
doc = self.lemmatizer(answer)
|
| 325 |
+
|
| 326 |
+
words = []
|
| 327 |
+
for token in doc:
|
| 328 |
+
if token.pos_ in ["NOUN", "VERB"]:
|
| 329 |
+
words.append(token.lemma_)
|
| 330 |
+
else:
|
| 331 |
+
words.append(token.text)
|
| 332 |
+
answer = " ".join(words)
|
| 333 |
+
|
| 334 |
+
return answer
|
| 335 |
+
|
| 336 |
+
return [apply(answer) for answer in answers]
|
| 337 |
+
|
| 338 |
+
@property
|
| 339 |
+
def lemmatizer(self):
|
| 340 |
+
if self._lemmatizer is None:
|
| 341 |
+
try:
|
| 342 |
+
import spacy
|
| 343 |
+
self._lemmatizer = spacy.load("en_core_web_sm")
|
| 344 |
+
except ImportError:
|
| 345 |
+
logging.error(
|
| 346 |
+
"""
|
| 347 |
+
Please install spacy and en_core_web_sm model to apply lemmatization.
|
| 348 |
+
python -m spacy download en_core_web_sm
|
| 349 |
+
OR
|
| 350 |
+
import spacy.cli
|
| 351 |
+
spacy.cli.download("en_core_web_sm")
|
| 352 |
+
"""
|
| 353 |
+
)
|
| 354 |
+
exit(1)
|
| 355 |
+
|
| 356 |
+
return self._lemmatizer
|
processors_conv.py
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import io
|
| 2 |
+
|
| 3 |
+
IGNORE_TOKEN_ID = -100
|
| 4 |
+
from typing import Dict
|
| 5 |
+
|
| 6 |
+
import torch
|
| 7 |
+
import torchvision.transforms as T
|
| 8 |
+
import transformers
|
| 9 |
+
from .conversation import get_conv_template
|
| 10 |
+
from PIL import Image
|
| 11 |
+
from torch.utils.data import ConcatDataset, WeightedRandomSampler
|
| 12 |
+
import sys
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def preprocess_qwen(
|
| 16 |
+
template_name,
|
| 17 |
+
sources,
|
| 18 |
+
tokenizer: transformers.PreTrainedTokenizer,
|
| 19 |
+
special_prefixs,
|
| 20 |
+
text_only: bool = False,
|
| 21 |
+
group_by_length: bool = False,
|
| 22 |
+
ds_name: str = None
|
| 23 |
+
) -> Dict:
|
| 24 |
+
conv = get_conv_template(template_name)
|
| 25 |
+
roles = {'human': conv.roles[0], 'gpt': conv.roles[1]}
|
| 26 |
+
|
| 27 |
+
assert len(sources) == len(special_prefixs)
|
| 28 |
+
# Apply prompt templates
|
| 29 |
+
conversations = []
|
| 30 |
+
for i, source in enumerate(sources):
|
| 31 |
+
if roles[source[0]['from']] != conv.roles[0]:
|
| 32 |
+
# Skip the first one if it is not from human
|
| 33 |
+
source = source[1:]
|
| 34 |
+
|
| 35 |
+
per_prefix = special_prefixs[i]
|
| 36 |
+
conv.messages = []
|
| 37 |
+
for j, sentence in enumerate(source):
|
| 38 |
+
role = roles[sentence['from']]
|
| 39 |
+
assert role == conv.roles[j % 2], f'{i}'
|
| 40 |
+
sentence['value'] = sentence['value'].replace("<image>", "").strip() # llava-1.5 add <image> to the begin of the question, remove here
|
| 41 |
+
sentence['value'] = sentence['value'].replace("<video>", "").strip()
|
| 42 |
+
|
| 43 |
+
if j == 0:
|
| 44 |
+
sentence['value'] = per_prefix + sentence['value']
|
| 45 |
+
|
| 46 |
+
conv.append_message(role, sentence['value'])
|
| 47 |
+
conversations.append(conv.get_prompt())
|
| 48 |
+
|
| 49 |
+
if tokenizer.bos_token is not None:
|
| 50 |
+
new_conversations = []
|
| 51 |
+
for conversation in conversations:
|
| 52 |
+
conversation = tokenizer.bos_token + conversation
|
| 53 |
+
new_conversations.append(conversation)
|
| 54 |
+
conversations = new_conversations
|
| 55 |
+
|
| 56 |
+
# Tokenize conversations
|
| 57 |
+
tokenizer.padding_side = 'right'
|
| 58 |
+
input_ids = tokenizer(
|
| 59 |
+
conversations,
|
| 60 |
+
return_tensors='pt',
|
| 61 |
+
padding=False if group_by_length else 'longest',
|
| 62 |
+
max_length=tokenizer.model_max_length,
|
| 63 |
+
truncation=True,
|
| 64 |
+
).input_ids
|
| 65 |
+
targets = input_ids.clone()
|
| 66 |
+
|
| 67 |
+
# Mask targets. Only compute loss on the assistant outputs.
|
| 68 |
+
sep = conv.sep + '\n' + conv.roles[1] + '\n' # <|im_end|>\n<|im_start|>assistant\n
|
| 69 |
+
for conversation, target in zip(conversations, targets):
|
| 70 |
+
total_len = int(target.ne(int(tokenizer.pad_token_id)).sum())
|
| 71 |
+
|
| 72 |
+
sep2 = conv.sep + '\n'
|
| 73 |
+
turns = conversation.split(sep2)
|
| 74 |
+
re_turns = [sep2.join(turns[:3])+sep2] # system + user + gpt
|
| 75 |
+
for conv_idx in range(3, len(turns), 2):
|
| 76 |
+
re_turns.append(sep2.join(turns[conv_idx:conv_idx + 2])+sep2) # user + gpt
|
| 77 |
+
cur_len = 0
|
| 78 |
+
target[:cur_len] = IGNORE_TOKEN_ID
|
| 79 |
+
endoftext_id = tokenizer.convert_tokens_to_ids('<|endoftext|>')
|
| 80 |
+
target[target == endoftext_id] = IGNORE_TOKEN_ID
|
| 81 |
+
|
| 82 |
+
for i, turn in enumerate(re_turns):
|
| 83 |
+
if turn == '':
|
| 84 |
+
break
|
| 85 |
+
turn_len = len(tokenizer(turn).input_ids)
|
| 86 |
+
|
| 87 |
+
parts = turn.split(sep)
|
| 88 |
+
if len(parts) != 2:
|
| 89 |
+
break
|
| 90 |
+
parts[0] += sep
|
| 91 |
+
|
| 92 |
+
instruction_len = len(tokenizer(parts[0]).input_ids)
|
| 93 |
+
|
| 94 |
+
# Ignore the user instructions
|
| 95 |
+
target[cur_len: cur_len + instruction_len] = IGNORE_TOKEN_ID
|
| 96 |
+
#print(f'[question {i}]', tokenizer.decode(input_ids[:, cur_len: cur_len + instruction_len][0]))
|
| 97 |
+
#print(f'[input_id {i}]', input_ids[:, cur_len: cur_len + instruction_len])
|
| 98 |
+
#print(f'[answer {i}]', tokenizer.decode(input_ids[:, cur_len + instruction_len: cur_len + turn_len][0]))
|
| 99 |
+
#print(f'[label {i}]', target[cur_len + instruction_len: cur_len + turn_len])
|
| 100 |
+
cur_len += turn_len
|
| 101 |
+
|
| 102 |
+
target[cur_len:] = IGNORE_TOKEN_ID
|
| 103 |
+
|
| 104 |
+
if False: # Inspect and check the correctness of masking
|
| 105 |
+
z = target.clone()
|
| 106 |
+
z = torch.where(z == IGNORE_TOKEN_ID, tokenizer.unk_token_id, z)
|
| 107 |
+
print(repr(tokenizer.decode(z)))
|
| 108 |
+
|
| 109 |
+
if cur_len < tokenizer.model_max_length:
|
| 110 |
+
if cur_len != total_len:
|
| 111 |
+
target[:] = IGNORE_TOKEN_ID
|
| 112 |
+
print(
|
| 113 |
+
f'WARNING: tokenization mismatch: {cur_len} vs. {total_len}.'
|
| 114 |
+
f' #turn = {len(turns) - 1}. (ignored). This dataset is {ds_name}.'
|
| 115 |
+
f'conversation: {conversation}'
|
| 116 |
+
)
|
| 117 |
+
sys.stdout.flush()
|
| 118 |
+
|
| 119 |
+
return dict(
|
| 120 |
+
input_ids=input_ids,
|
| 121 |
+
labels=targets,
|
| 122 |
+
attention_mask=input_ids.ne(tokenizer.pad_token_id),
|
| 123 |
+
conversations=conversations
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
{
|
| 4 |
+
"content": "<|image|>",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"content": "<|document|>",
|
| 12 |
+
"lstrip": false,
|
| 13 |
+
"normalized": false,
|
| 14 |
+
"rstrip": false,
|
| 15 |
+
"single_word": false
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"content": "<|video|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
}
|
| 24 |
+
],
|
| 25 |
+
"eos_token": {
|
| 26 |
+
"content": "<|im_end|>",
|
| 27 |
+
"lstrip": false,
|
| 28 |
+
"normalized": false,
|
| 29 |
+
"rstrip": false,
|
| 30 |
+
"single_word": false
|
| 31 |
+
},
|
| 32 |
+
"pad_token": {
|
| 33 |
+
"content": "<|endoftext|>",
|
| 34 |
+
"lstrip": false,
|
| 35 |
+
"normalized": false,
|
| 36 |
+
"rstrip": false,
|
| 37 |
+
"single_word": false
|
| 38 |
+
}
|
| 39 |
+
}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"added_tokens_decoder": {
|
| 4 |
+
"151643": {
|
| 5 |
+
"content": "<|endoftext|>",
|
| 6 |
+
"lstrip": false,
|
| 7 |
+
"normalized": false,
|
| 8 |
+
"rstrip": false,
|
| 9 |
+
"single_word": false,
|
| 10 |
+
"special": true
|
| 11 |
+
},
|
| 12 |
+
"151644": {
|
| 13 |
+
"content": "<|im_start|>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"normalized": false,
|
| 16 |
+
"rstrip": false,
|
| 17 |
+
"single_word": false,
|
| 18 |
+
"special": true
|
| 19 |
+
},
|
| 20 |
+
"151645": {
|
| 21 |
+
"content": "<|im_end|>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"normalized": false,
|
| 24 |
+
"rstrip": false,
|
| 25 |
+
"single_word": false,
|
| 26 |
+
"special": true
|
| 27 |
+
},
|
| 28 |
+
"151646": {
|
| 29 |
+
"content": "<|image|>",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"normalized": false,
|
| 32 |
+
"rstrip": false,
|
| 33 |
+
"single_word": false,
|
| 34 |
+
"special": true
|
| 35 |
+
},
|
| 36 |
+
"151647": {
|
| 37 |
+
"content": "<|document|>",
|
| 38 |
+
"lstrip": false,
|
| 39 |
+
"normalized": false,
|
| 40 |
+
"rstrip": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": true
|
| 43 |
+
},
|
| 44 |
+
"151648": {
|
| 45 |
+
"content": "<|video|>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false,
|
| 50 |
+
"special": true
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"additional_special_tokens": [
|
| 54 |
+
"<|image|>",
|
| 55 |
+
"<|document|>",
|
| 56 |
+
"<|video|>"
|
| 57 |
+
],
|
| 58 |
+
"bos_token": null,
|
| 59 |
+
"chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
|
| 60 |
+
"clean_up_tokenization_spaces": false,
|
| 61 |
+
"eos_token": "<|im_end|>",
|
| 62 |
+
"errors": "replace",
|
| 63 |
+
"model_max_length": 4096,
|
| 64 |
+
"pad_token": "<|endoftext|>",
|
| 65 |
+
"split_special_tokens": false,
|
| 66 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 67 |
+
"unk_token": null
|
| 68 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|