Hon-Wong commited on
Commit
b92bd4e
·
verified ·
1 Parent(s): 00d8f13

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
added_tokens.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<tool_call>": 151657,
4
+ "<|box_end|>": 151649,
5
+ "<|box_start|>": 151648,
6
+ "<|endoftext|>": 151643,
7
+ "<|file_sep|>": 151664,
8
+ "<|fim_middle|>": 151660,
9
+ "<|fim_pad|>": 151662,
10
+ "<|fim_prefix|>": 151659,
11
+ "<|fim_suffix|>": 151661,
12
+ "<|im_end|>": 151645,
13
+ "<|im_start|>": 151644,
14
+ "<|image_pad|>": 151655,
15
+ "<|object_ref_end|>": 151647,
16
+ "<|object_ref_start|>": 151646,
17
+ "<|quad_end|>": 151651,
18
+ "<|quad_start|>": 151650,
19
+ "<|repo_name|>": 151663,
20
+ "<|video_pad|>": 151656,
21
+ "<|vision_end|>": 151653,
22
+ "<|vision_pad|>": 151654,
23
+ "<|vision_start|>": 151652
24
+ }
attention_mask.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Optional
2
+
3
+ import torch
4
+
5
+
6
+ def _make_causal_mask(
7
+ attention_mask: torch.Tensor, dtype: torch.dtype, device: torch.device
8
+ ):
9
+ """
10
+ Make causal mask used for bi-directional self-attention.
11
+ """
12
+ bsz, tgt_len = attention_mask.shape
13
+ mask = torch.full((tgt_len, tgt_len), torch.tensor(torch.finfo(dtype).min, device=device), device=device)
14
+ mask_cond = torch.arange(mask.size(-1), device=device)
15
+ mask.masked_fill_(mask_cond < (mask_cond + 1).view(mask.size(-1), 1), 0)
16
+ mask = mask.to(dtype)
17
+
18
+ return mask[None, None, :, :].expand(bsz, 1, tgt_len, tgt_len)
19
+
20
+
21
+ def _make_2dvison_mask(column_mask, dtype: torch.dtype, device: torch.device):
22
+ """
23
+ """
24
+ bsz, seq_length = column_mask.shape
25
+ cross_mask = torch.zeros((bsz, 1, seq_length, seq_length), dtype=dtype, device=device)
26
+
27
+ # 找到连续的 1 的区间
28
+ start = None
29
+ for bsz_idx in range(bsz):
30
+ for i in range(seq_length):
31
+ if column_mask[bsz_idx, i] == 1:
32
+ if start is None:
33
+ start = i
34
+ else:
35
+ if start is not None:
36
+ # 填充区间
37
+ cross_mask[bsz_idx, 0, start:i, start:i] = 1
38
+ start = None
39
+
40
+ # 处理最后一个区间
41
+ if start is not None:
42
+ cross_mask[bsz_idx, 0, start:seq_length, start:seq_length] = 1
43
+
44
+ return cross_mask
45
+
46
+
47
+ def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
48
+ """
49
+ Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
50
+ """
51
+ bsz, src_len = mask.size()
52
+ tgt_len = tgt_len if tgt_len is not None else src_len
53
+
54
+ expanded_mask = mask[:, None, None, :].expand(bsz, 1, tgt_len, src_len).to(dtype)
55
+
56
+ inverted_mask = 1.0 - expanded_mask
57
+
58
+ return inverted_mask.masked_fill_(inverted_mask.to(torch.bool), torch.finfo(dtype).min)
59
+
60
+
61
+ def make_mask(attention_mask: torch.Tensor, dtype: torch.dtype=None, device: torch.device=None, mode: str="default", vision_mask: torch.Tensor=None, ):
62
+ if dtype is None:
63
+ dtype = attention_mask.dtype
64
+ if device is None:
65
+ device = attention_mask.device
66
+ expanded_attn_mask = _expand_mask(attention_mask, dtype).to(device)
67
+ causal_mask = _make_causal_mask(attention_mask, dtype, device).to(device)
68
+ if mode == "default":
69
+ return attention_mask
70
+ else:
71
+ assert vision_mask is not None, "vision_mask is None"
72
+ vision_mask = vision_mask.to(device)
73
+ bsz, seq_length = attention_mask.shape
74
+ vision_mask_bg = vision_mask[:, None, :, None]
75
+ vision_mask_2d = _make_2dvison_mask(vision_mask, dtype, device)
76
+ if mode == "bidirectional":
77
+ mask = expanded_attn_mask + causal_mask
78
+ mask = mask.clone().masked_fill_(vision_mask_2d.to(torch.bool), 0)
79
+ return mask
80
+ else:
81
+ raise NotImplementedError(f"mode {mode} is not implemented")
chat_template.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"
3
+ }
config.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "VoRAForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration_vora.VoRAConfig",
8
+ "AutoModelForCausalLM": "modeling_vora.VoRAForCausalLM"
9
+ },
10
+ "aux_vision": "",
11
+ "bos_token_id": 151643,
12
+ "eos_token_id": 151645,
13
+ "hidden_act": "silu",
14
+ "hidden_size": 3584,
15
+ "image_size": 448,
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 18944,
18
+ "llm": "/mnt/bn/wh-data/data/models/Qwen2.5-7B-Instruct",
19
+ "lora": {
20
+ "layers": 24,
21
+ "r": 1024,
22
+ "target_modules": [
23
+ "self_attn.q_proj",
24
+ "self_attn.k_proj",
25
+ "self_attn.v_proj",
26
+ "self_attn.o_proj",
27
+ "mlp.up_proj",
28
+ "mlp.gate_proj",
29
+ "mlp.down_proj"
30
+ ]
31
+ },
32
+ "max_position_embeddings": 32768,
33
+ "max_window_layers": 28,
34
+ "model_type": "vora",
35
+ "num_attention_heads": 28,
36
+ "num_hidden_layers": 28,
37
+ "num_key_value_heads": 4,
38
+ "patch_size": 14,
39
+ "rms_norm_eps": 1e-06,
40
+ "rope_scaling": null,
41
+ "rope_theta": 1000000.0,
42
+ "sliding_window": 131072,
43
+ "tie_word_embeddings": false,
44
+ "torch_dtype": "float32",
45
+ "transformers_version": "4.50.3",
46
+ "use_cache": true,
47
+ "use_sliding_window": false,
48
+ "vision_attention_mask": "bidirectional",
49
+ "vision_embedding_intermediate_size": 1536,
50
+ "vision_embedding_type": "AIMv2",
51
+ "vocab_size": 152064
52
+ }
configuration_vora.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ from transformers.configuration_utils import PretrainedConfig
4
+
5
+ __all__ = ["VoRAConfig"]
6
+
7
+
8
+ class VoRAConfig(PretrainedConfig):
9
+ model_type = "vora"
10
+ _auto_class = "AutoConfig"
11
+
12
+ def __init__(
13
+ self,
14
+ llm: str = "",
15
+ aux_vision: str = "",
16
+ lora: dict = {},
17
+ image_size: int = 448,
18
+ vision_embedding_type: str = "",
19
+ vision_embedding_intermediate_size: int = 1536,
20
+ patch_size: int = 14,
21
+ vision_attention_mask: str = "bidirectional",
22
+ rms_norm_eps: float = 1e-5,
23
+ **kwargs: Any,
24
+ ):
25
+ super().__init__(**kwargs)
26
+ self.llm = llm
27
+ self.aux_vision = aux_vision
28
+ self.lora = lora
29
+ self.image_size = image_size
30
+ self.vision_embedding_type = vision_embedding_type
31
+ self.vision_embedding_intermediate_size = vision_embedding_intermediate_size
32
+ self.patch_size = patch_size
33
+ self.vision_attention_mask = vision_attention_mask
34
+ self.rms_norm_eps = rms_norm_eps
35
+
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "pad_token_id": 151643,
4
+ "do_sample": true,
5
+ "eos_token_id": [
6
+ 151645,
7
+ 151643
8
+ ],
9
+ "repetition_penalty": 1.05,
10
+ "temperature": 0.7,
11
+ "top_p": 0.8,
12
+ "top_k": 20,
13
+ "transformers_version": "4.37.0"
14
+ }
lora.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import types
3
+ import math
4
+ from torch import nn
5
+ import torch.nn.functional as F
6
+
7
+
8
+ QWEN2_TARGET_MODULES = [
9
+ "self_attn.q_proj",
10
+ "self_attn.k_proj",
11
+ "self_attn.v_proj",
12
+ "self_attn.o_proj",
13
+ "mlp.up_proj",
14
+ "mlp.gate_proj",
15
+ "mlp.down_proj",
16
+ ]
17
+
18
+
19
+ class LoRALayer(nn.Linear):
20
+ def __init__(
21
+ self,
22
+ in_features: int,
23
+ out_features: int,
24
+ r: int = 1024,
25
+ **kwargs
26
+ ):
27
+ nn.Linear.__init__(self, in_features, out_features)
28
+ if r < 0:
29
+ self.forward = self.naive_forward
30
+ else:
31
+ # we elimate lora_alpha here bc we find it unnecessary in VoRA
32
+ self.lora_A = nn.Linear(in_features, r, bias=False)
33
+ self.lora_B = nn.Linear(r, out_features, bias=False)
34
+ nn.init.kaiming_uniform_(self.lora_A.weight, a=math.sqrt(5))
35
+ nn.init.zeros_(self.lora_B.weight)
36
+
37
+ def forward(self, x: torch.Tensor):
38
+ intermediate = F.linear(x, self.weight, bias=self.bias)
39
+ result = intermediate + self.lora_B(self.lora_A(x))
40
+ return result
41
+
42
+ def naive_forward(self, x: torch.Tensor):
43
+ return F.linear(x, self.weight, bias=self.bias)
44
+
45
+ def _get_submodules(self, key):
46
+ parent = self.get_submodule(".".join(key.split(".")[:-1]))
47
+ target_name = key.split(".")[-1]
48
+ target = self.get_submodule(key)
49
+ return parent, target, target_name
50
+
51
+ def _find_and_replace(self, lora_params):
52
+ target_modules = lora_params["target_modules"]
53
+
54
+ for llm_module_name in target_modules:
55
+ parent, target, target_name = self._get_submodules(llm_module_name)
56
+ vora_layer = LoRALayer(
57
+ target.in_features,
58
+ target.out_features,
59
+ **lora_params
60
+ )
61
+ self._replace_module(parent, target_name, vora_layer, target)
62
+
63
+ def _replace_module(self, parent_module, child_name, new_module, old_module):
64
+ setattr(parent_module, child_name, new_module)
65
+ new_module.weight = old_module.weight
66
+ if old_module.bias is not None:
67
+ new_module.bias = old_module.bias
68
+ if getattr(old_module, "state", None) is not None:
69
+ new_module.state = old_module.state
70
+ new_module.to(old_module.weight.device)
71
+
72
+ def apply_lora(llm, lora_params={"layers": "all", "r": 1024, "target_modules": QWEN2_TARGET_MODULES}):
73
+ llm_num_layers = llm.config.num_hidden_layers
74
+ total_layers = lora_params.get("layers", "all")
75
+
76
+ # -------------------- validation check ---------------------
77
+ if isinstance(total_layers, str):
78
+ if total_layers.lower() == "all":
79
+ total_layers = list(range(llm_num_layers))
80
+ else:
81
+ assert isinstance(total_layers, int), "total_layers must be an integer or 'all'"
82
+ total_layers = list(range(total_layers))
83
+ # -------------------- validation check ---------------------
84
+
85
+ # -------------------- replace llm layers ---------------------
86
+ for i in total_layers:
87
+ llm_layer = llm.model.layers[i]
88
+ llm_layer._get_submodules = types.MethodType(_get_submodules, llm_layer)
89
+ llm_layer._find_and_replace = types.MethodType(_find_and_replace, llm_layer)
90
+ llm_layer._replace_module = types.MethodType(_replace_module, llm_layer)
91
+ llm_layer._find_and_replace(lora_params)
model-00001-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7bc0d77ce24e3ef84b08bfd8cb68b9b5f10593c8e90a7f2c831ce1b8f1c64ab
3
+ size 4992767056
model-00002-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa3913c41aa53f763b71799972a43b29e89088d212de60b57328d72dc8164384
3
+ size 4996305072
model-00003-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d061ca46901d9b802d6cae61c05cf0e01d0f702b65aff76beb8d7e481b051e5
3
+ size 4842155392
model-00004-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c12213603c05c941cf22c9a459fa7010fa401aee14d2a68181b071e4ebe79e9
3
+ size 4842122976
model-00005-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8972ecf7a7a084b3ddebf4c1d5aa47b708a7d8302278f4af8e48de4501fbe548
3
+ size 4842122968
model-00006-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2df88bfb29e9a99186c1c8145eba24ccfa7d7fdf36a219ccb51426e11ee6b031
3
+ size 4996305176
model-00007-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d17e6fb6def043108120fbf6e16519a681d575053466f3da4b0b01f909cef4ee
3
+ size 4954233672
model-00008-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5fcf92c109420554909c069f1d14d8da4b27e8108a7467f1e40391c205f302e2
3
+ size 4891179120
model.safetensors.index.json ADDED
@@ -0,0 +1,783 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 39357097984
4
+ },
5
+ "weight_map": {
6
+ "llm.lm_head.weight": "model-00008-of-00008.safetensors",
7
+ "llm.model.embed_tokens.weight": "model-00001-of-00008.safetensors",
8
+ "llm.model.layers.0.input_layernorm.weight": "model-00001-of-00008.safetensors",
9
+ "llm.model.layers.0.mlp.down_proj.bias": "model-00001-of-00008.safetensors",
10
+ "llm.model.layers.0.mlp.down_proj.lora_A.weight": "model-00001-of-00008.safetensors",
11
+ "llm.model.layers.0.mlp.down_proj.lora_B.weight": "model-00001-of-00008.safetensors",
12
+ "llm.model.layers.0.mlp.down_proj.weight": "model-00001-of-00008.safetensors",
13
+ "llm.model.layers.0.mlp.gate_proj.bias": "model-00001-of-00008.safetensors",
14
+ "llm.model.layers.0.mlp.gate_proj.lora_A.weight": "model-00001-of-00008.safetensors",
15
+ "llm.model.layers.0.mlp.gate_proj.lora_B.weight": "model-00001-of-00008.safetensors",
16
+ "llm.model.layers.0.mlp.gate_proj.weight": "model-00001-of-00008.safetensors",
17
+ "llm.model.layers.0.mlp.up_proj.bias": "model-00001-of-00008.safetensors",
18
+ "llm.model.layers.0.mlp.up_proj.lora_A.weight": "model-00001-of-00008.safetensors",
19
+ "llm.model.layers.0.mlp.up_proj.lora_B.weight": "model-00001-of-00008.safetensors",
20
+ "llm.model.layers.0.mlp.up_proj.weight": "model-00001-of-00008.safetensors",
21
+ "llm.model.layers.0.post_attention_layernorm.weight": "model-00001-of-00008.safetensors",
22
+ "llm.model.layers.0.self_attn.k_proj.bias": "model-00001-of-00008.safetensors",
23
+ "llm.model.layers.0.self_attn.k_proj.lora_A.weight": "model-00001-of-00008.safetensors",
24
+ "llm.model.layers.0.self_attn.k_proj.lora_B.weight": "model-00001-of-00008.safetensors",
25
+ "llm.model.layers.0.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
26
+ "llm.model.layers.0.self_attn.o_proj.bias": "model-00001-of-00008.safetensors",
27
+ "llm.model.layers.0.self_attn.o_proj.lora_A.weight": "model-00001-of-00008.safetensors",
28
+ "llm.model.layers.0.self_attn.o_proj.lora_B.weight": "model-00001-of-00008.safetensors",
29
+ "llm.model.layers.0.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
30
+ "llm.model.layers.0.self_attn.q_proj.bias": "model-00001-of-00008.safetensors",
31
+ "llm.model.layers.0.self_attn.q_proj.lora_A.weight": "model-00001-of-00008.safetensors",
32
+ "llm.model.layers.0.self_attn.q_proj.lora_B.weight": "model-00001-of-00008.safetensors",
33
+ "llm.model.layers.0.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
34
+ "llm.model.layers.0.self_attn.v_proj.bias": "model-00001-of-00008.safetensors",
35
+ "llm.model.layers.0.self_attn.v_proj.lora_A.weight": "model-00001-of-00008.safetensors",
36
+ "llm.model.layers.0.self_attn.v_proj.lora_B.weight": "model-00001-of-00008.safetensors",
37
+ "llm.model.layers.0.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
38
+ "llm.model.layers.1.input_layernorm.weight": "model-00001-of-00008.safetensors",
39
+ "llm.model.layers.1.mlp.down_proj.bias": "model-00001-of-00008.safetensors",
40
+ "llm.model.layers.1.mlp.down_proj.lora_A.weight": "model-00001-of-00008.safetensors",
41
+ "llm.model.layers.1.mlp.down_proj.lora_B.weight": "model-00001-of-00008.safetensors",
42
+ "llm.model.layers.1.mlp.down_proj.weight": "model-00001-of-00008.safetensors",
43
+ "llm.model.layers.1.mlp.gate_proj.bias": "model-00001-of-00008.safetensors",
44
+ "llm.model.layers.1.mlp.gate_proj.lora_A.weight": "model-00001-of-00008.safetensors",
45
+ "llm.model.layers.1.mlp.gate_proj.lora_B.weight": "model-00001-of-00008.safetensors",
46
+ "llm.model.layers.1.mlp.gate_proj.weight": "model-00001-of-00008.safetensors",
47
+ "llm.model.layers.1.mlp.up_proj.bias": "model-00001-of-00008.safetensors",
48
+ "llm.model.layers.1.mlp.up_proj.lora_A.weight": "model-00001-of-00008.safetensors",
49
+ "llm.model.layers.1.mlp.up_proj.lora_B.weight": "model-00001-of-00008.safetensors",
50
+ "llm.model.layers.1.mlp.up_proj.weight": "model-00001-of-00008.safetensors",
51
+ "llm.model.layers.1.post_attention_layernorm.weight": "model-00001-of-00008.safetensors",
52
+ "llm.model.layers.1.self_attn.k_proj.bias": "model-00001-of-00008.safetensors",
53
+ "llm.model.layers.1.self_attn.k_proj.lora_A.weight": "model-00001-of-00008.safetensors",
54
+ "llm.model.layers.1.self_attn.k_proj.lora_B.weight": "model-00001-of-00008.safetensors",
55
+ "llm.model.layers.1.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
56
+ "llm.model.layers.1.self_attn.o_proj.bias": "model-00001-of-00008.safetensors",
57
+ "llm.model.layers.1.self_attn.o_proj.lora_A.weight": "model-00001-of-00008.safetensors",
58
+ "llm.model.layers.1.self_attn.o_proj.lora_B.weight": "model-00001-of-00008.safetensors",
59
+ "llm.model.layers.1.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
60
+ "llm.model.layers.1.self_attn.q_proj.bias": "model-00001-of-00008.safetensors",
61
+ "llm.model.layers.1.self_attn.q_proj.lora_A.weight": "model-00001-of-00008.safetensors",
62
+ "llm.model.layers.1.self_attn.q_proj.lora_B.weight": "model-00001-of-00008.safetensors",
63
+ "llm.model.layers.1.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
64
+ "llm.model.layers.1.self_attn.v_proj.bias": "model-00001-of-00008.safetensors",
65
+ "llm.model.layers.1.self_attn.v_proj.lora_A.weight": "model-00001-of-00008.safetensors",
66
+ "llm.model.layers.1.self_attn.v_proj.lora_B.weight": "model-00001-of-00008.safetensors",
67
+ "llm.model.layers.1.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
68
+ "llm.model.layers.10.input_layernorm.weight": "model-00004-of-00008.safetensors",
69
+ "llm.model.layers.10.mlp.down_proj.bias": "model-00004-of-00008.safetensors",
70
+ "llm.model.layers.10.mlp.down_proj.lora_A.weight": "model-00004-of-00008.safetensors",
71
+ "llm.model.layers.10.mlp.down_proj.lora_B.weight": "model-00004-of-00008.safetensors",
72
+ "llm.model.layers.10.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
73
+ "llm.model.layers.10.mlp.gate_proj.bias": "model-00004-of-00008.safetensors",
74
+ "llm.model.layers.10.mlp.gate_proj.lora_A.weight": "model-00004-of-00008.safetensors",
75
+ "llm.model.layers.10.mlp.gate_proj.lora_B.weight": "model-00004-of-00008.safetensors",
76
+ "llm.model.layers.10.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
77
+ "llm.model.layers.10.mlp.up_proj.bias": "model-00004-of-00008.safetensors",
78
+ "llm.model.layers.10.mlp.up_proj.lora_A.weight": "model-00004-of-00008.safetensors",
79
+ "llm.model.layers.10.mlp.up_proj.lora_B.weight": "model-00004-of-00008.safetensors",
80
+ "llm.model.layers.10.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
81
+ "llm.model.layers.10.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
82
+ "llm.model.layers.10.self_attn.k_proj.bias": "model-00004-of-00008.safetensors",
83
+ "llm.model.layers.10.self_attn.k_proj.lora_A.weight": "model-00004-of-00008.safetensors",
84
+ "llm.model.layers.10.self_attn.k_proj.lora_B.weight": "model-00004-of-00008.safetensors",
85
+ "llm.model.layers.10.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
86
+ "llm.model.layers.10.self_attn.o_proj.bias": "model-00004-of-00008.safetensors",
87
+ "llm.model.layers.10.self_attn.o_proj.lora_A.weight": "model-00004-of-00008.safetensors",
88
+ "llm.model.layers.10.self_attn.o_proj.lora_B.weight": "model-00004-of-00008.safetensors",
89
+ "llm.model.layers.10.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
90
+ "llm.model.layers.10.self_attn.q_proj.bias": "model-00004-of-00008.safetensors",
91
+ "llm.model.layers.10.self_attn.q_proj.lora_A.weight": "model-00004-of-00008.safetensors",
92
+ "llm.model.layers.10.self_attn.q_proj.lora_B.weight": "model-00004-of-00008.safetensors",
93
+ "llm.model.layers.10.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
94
+ "llm.model.layers.10.self_attn.v_proj.bias": "model-00004-of-00008.safetensors",
95
+ "llm.model.layers.10.self_attn.v_proj.lora_A.weight": "model-00004-of-00008.safetensors",
96
+ "llm.model.layers.10.self_attn.v_proj.lora_B.weight": "model-00004-of-00008.safetensors",
97
+ "llm.model.layers.10.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
98
+ "llm.model.layers.11.input_layernorm.weight": "model-00004-of-00008.safetensors",
99
+ "llm.model.layers.11.mlp.down_proj.bias": "model-00004-of-00008.safetensors",
100
+ "llm.model.layers.11.mlp.down_proj.lora_A.weight": "model-00004-of-00008.safetensors",
101
+ "llm.model.layers.11.mlp.down_proj.lora_B.weight": "model-00004-of-00008.safetensors",
102
+ "llm.model.layers.11.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
103
+ "llm.model.layers.11.mlp.gate_proj.bias": "model-00004-of-00008.safetensors",
104
+ "llm.model.layers.11.mlp.gate_proj.lora_A.weight": "model-00004-of-00008.safetensors",
105
+ "llm.model.layers.11.mlp.gate_proj.lora_B.weight": "model-00004-of-00008.safetensors",
106
+ "llm.model.layers.11.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
107
+ "llm.model.layers.11.mlp.up_proj.bias": "model-00004-of-00008.safetensors",
108
+ "llm.model.layers.11.mlp.up_proj.lora_A.weight": "model-00004-of-00008.safetensors",
109
+ "llm.model.layers.11.mlp.up_proj.lora_B.weight": "model-00004-of-00008.safetensors",
110
+ "llm.model.layers.11.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
111
+ "llm.model.layers.11.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
112
+ "llm.model.layers.11.self_attn.k_proj.bias": "model-00004-of-00008.safetensors",
113
+ "llm.model.layers.11.self_attn.k_proj.lora_A.weight": "model-00004-of-00008.safetensors",
114
+ "llm.model.layers.11.self_attn.k_proj.lora_B.weight": "model-00004-of-00008.safetensors",
115
+ "llm.model.layers.11.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
116
+ "llm.model.layers.11.self_attn.o_proj.bias": "model-00004-of-00008.safetensors",
117
+ "llm.model.layers.11.self_attn.o_proj.lora_A.weight": "model-00004-of-00008.safetensors",
118
+ "llm.model.layers.11.self_attn.o_proj.lora_B.weight": "model-00004-of-00008.safetensors",
119
+ "llm.model.layers.11.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
120
+ "llm.model.layers.11.self_attn.q_proj.bias": "model-00004-of-00008.safetensors",
121
+ "llm.model.layers.11.self_attn.q_proj.lora_A.weight": "model-00004-of-00008.safetensors",
122
+ "llm.model.layers.11.self_attn.q_proj.lora_B.weight": "model-00004-of-00008.safetensors",
123
+ "llm.model.layers.11.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
124
+ "llm.model.layers.11.self_attn.v_proj.bias": "model-00004-of-00008.safetensors",
125
+ "llm.model.layers.11.self_attn.v_proj.lora_A.weight": "model-00004-of-00008.safetensors",
126
+ "llm.model.layers.11.self_attn.v_proj.lora_B.weight": "model-00004-of-00008.safetensors",
127
+ "llm.model.layers.11.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
128
+ "llm.model.layers.12.input_layernorm.weight": "model-00004-of-00008.safetensors",
129
+ "llm.model.layers.12.mlp.down_proj.bias": "model-00004-of-00008.safetensors",
130
+ "llm.model.layers.12.mlp.down_proj.lora_A.weight": "model-00004-of-00008.safetensors",
131
+ "llm.model.layers.12.mlp.down_proj.lora_B.weight": "model-00004-of-00008.safetensors",
132
+ "llm.model.layers.12.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
133
+ "llm.model.layers.12.mlp.gate_proj.bias": "model-00004-of-00008.safetensors",
134
+ "llm.model.layers.12.mlp.gate_proj.lora_A.weight": "model-00004-of-00008.safetensors",
135
+ "llm.model.layers.12.mlp.gate_proj.lora_B.weight": "model-00004-of-00008.safetensors",
136
+ "llm.model.layers.12.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
137
+ "llm.model.layers.12.mlp.up_proj.bias": "model-00004-of-00008.safetensors",
138
+ "llm.model.layers.12.mlp.up_proj.lora_A.weight": "model-00004-of-00008.safetensors",
139
+ "llm.model.layers.12.mlp.up_proj.lora_B.weight": "model-00004-of-00008.safetensors",
140
+ "llm.model.layers.12.mlp.up_proj.weight": "model-00004-of-00008.safetensors",
141
+ "llm.model.layers.12.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
142
+ "llm.model.layers.12.self_attn.k_proj.bias": "model-00004-of-00008.safetensors",
143
+ "llm.model.layers.12.self_attn.k_proj.lora_A.weight": "model-00004-of-00008.safetensors",
144
+ "llm.model.layers.12.self_attn.k_proj.lora_B.weight": "model-00004-of-00008.safetensors",
145
+ "llm.model.layers.12.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
146
+ "llm.model.layers.12.self_attn.o_proj.bias": "model-00004-of-00008.safetensors",
147
+ "llm.model.layers.12.self_attn.o_proj.lora_A.weight": "model-00004-of-00008.safetensors",
148
+ "llm.model.layers.12.self_attn.o_proj.lora_B.weight": "model-00004-of-00008.safetensors",
149
+ "llm.model.layers.12.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
150
+ "llm.model.layers.12.self_attn.q_proj.bias": "model-00004-of-00008.safetensors",
151
+ "llm.model.layers.12.self_attn.q_proj.lora_A.weight": "model-00004-of-00008.safetensors",
152
+ "llm.model.layers.12.self_attn.q_proj.lora_B.weight": "model-00004-of-00008.safetensors",
153
+ "llm.model.layers.12.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
154
+ "llm.model.layers.12.self_attn.v_proj.bias": "model-00004-of-00008.safetensors",
155
+ "llm.model.layers.12.self_attn.v_proj.lora_A.weight": "model-00004-of-00008.safetensors",
156
+ "llm.model.layers.12.self_attn.v_proj.lora_B.weight": "model-00004-of-00008.safetensors",
157
+ "llm.model.layers.12.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
158
+ "llm.model.layers.13.input_layernorm.weight": "model-00005-of-00008.safetensors",
159
+ "llm.model.layers.13.mlp.down_proj.bias": "model-00005-of-00008.safetensors",
160
+ "llm.model.layers.13.mlp.down_proj.lora_A.weight": "model-00005-of-00008.safetensors",
161
+ "llm.model.layers.13.mlp.down_proj.lora_B.weight": "model-00005-of-00008.safetensors",
162
+ "llm.model.layers.13.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
163
+ "llm.model.layers.13.mlp.gate_proj.bias": "model-00004-of-00008.safetensors",
164
+ "llm.model.layers.13.mlp.gate_proj.lora_A.weight": "model-00004-of-00008.safetensors",
165
+ "llm.model.layers.13.mlp.gate_proj.lora_B.weight": "model-00004-of-00008.safetensors",
166
+ "llm.model.layers.13.mlp.gate_proj.weight": "model-00004-of-00008.safetensors",
167
+ "llm.model.layers.13.mlp.up_proj.bias": "model-00005-of-00008.safetensors",
168
+ "llm.model.layers.13.mlp.up_proj.lora_A.weight": "model-00005-of-00008.safetensors",
169
+ "llm.model.layers.13.mlp.up_proj.lora_B.weight": "model-00005-of-00008.safetensors",
170
+ "llm.model.layers.13.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
171
+ "llm.model.layers.13.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
172
+ "llm.model.layers.13.self_attn.k_proj.bias": "model-00004-of-00008.safetensors",
173
+ "llm.model.layers.13.self_attn.k_proj.lora_A.weight": "model-00004-of-00008.safetensors",
174
+ "llm.model.layers.13.self_attn.k_proj.lora_B.weight": "model-00004-of-00008.safetensors",
175
+ "llm.model.layers.13.self_attn.k_proj.weight": "model-00004-of-00008.safetensors",
176
+ "llm.model.layers.13.self_attn.o_proj.bias": "model-00004-of-00008.safetensors",
177
+ "llm.model.layers.13.self_attn.o_proj.lora_A.weight": "model-00004-of-00008.safetensors",
178
+ "llm.model.layers.13.self_attn.o_proj.lora_B.weight": "model-00004-of-00008.safetensors",
179
+ "llm.model.layers.13.self_attn.o_proj.weight": "model-00004-of-00008.safetensors",
180
+ "llm.model.layers.13.self_attn.q_proj.bias": "model-00004-of-00008.safetensors",
181
+ "llm.model.layers.13.self_attn.q_proj.lora_A.weight": "model-00004-of-00008.safetensors",
182
+ "llm.model.layers.13.self_attn.q_proj.lora_B.weight": "model-00004-of-00008.safetensors",
183
+ "llm.model.layers.13.self_attn.q_proj.weight": "model-00004-of-00008.safetensors",
184
+ "llm.model.layers.13.self_attn.v_proj.bias": "model-00004-of-00008.safetensors",
185
+ "llm.model.layers.13.self_attn.v_proj.lora_A.weight": "model-00004-of-00008.safetensors",
186
+ "llm.model.layers.13.self_attn.v_proj.lora_B.weight": "model-00004-of-00008.safetensors",
187
+ "llm.model.layers.13.self_attn.v_proj.weight": "model-00004-of-00008.safetensors",
188
+ "llm.model.layers.14.input_layernorm.weight": "model-00005-of-00008.safetensors",
189
+ "llm.model.layers.14.mlp.down_proj.bias": "model-00005-of-00008.safetensors",
190
+ "llm.model.layers.14.mlp.down_proj.lora_A.weight": "model-00005-of-00008.safetensors",
191
+ "llm.model.layers.14.mlp.down_proj.lora_B.weight": "model-00005-of-00008.safetensors",
192
+ "llm.model.layers.14.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
193
+ "llm.model.layers.14.mlp.gate_proj.bias": "model-00005-of-00008.safetensors",
194
+ "llm.model.layers.14.mlp.gate_proj.lora_A.weight": "model-00005-of-00008.safetensors",
195
+ "llm.model.layers.14.mlp.gate_proj.lora_B.weight": "model-00005-of-00008.safetensors",
196
+ "llm.model.layers.14.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
197
+ "llm.model.layers.14.mlp.up_proj.bias": "model-00005-of-00008.safetensors",
198
+ "llm.model.layers.14.mlp.up_proj.lora_A.weight": "model-00005-of-00008.safetensors",
199
+ "llm.model.layers.14.mlp.up_proj.lora_B.weight": "model-00005-of-00008.safetensors",
200
+ "llm.model.layers.14.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
201
+ "llm.model.layers.14.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
202
+ "llm.model.layers.14.self_attn.k_proj.bias": "model-00005-of-00008.safetensors",
203
+ "llm.model.layers.14.self_attn.k_proj.lora_A.weight": "model-00005-of-00008.safetensors",
204
+ "llm.model.layers.14.self_attn.k_proj.lora_B.weight": "model-00005-of-00008.safetensors",
205
+ "llm.model.layers.14.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
206
+ "llm.model.layers.14.self_attn.o_proj.bias": "model-00005-of-00008.safetensors",
207
+ "llm.model.layers.14.self_attn.o_proj.lora_A.weight": "model-00005-of-00008.safetensors",
208
+ "llm.model.layers.14.self_attn.o_proj.lora_B.weight": "model-00005-of-00008.safetensors",
209
+ "llm.model.layers.14.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
210
+ "llm.model.layers.14.self_attn.q_proj.bias": "model-00005-of-00008.safetensors",
211
+ "llm.model.layers.14.self_attn.q_proj.lora_A.weight": "model-00005-of-00008.safetensors",
212
+ "llm.model.layers.14.self_attn.q_proj.lora_B.weight": "model-00005-of-00008.safetensors",
213
+ "llm.model.layers.14.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
214
+ "llm.model.layers.14.self_attn.v_proj.bias": "model-00005-of-00008.safetensors",
215
+ "llm.model.layers.14.self_attn.v_proj.lora_A.weight": "model-00005-of-00008.safetensors",
216
+ "llm.model.layers.14.self_attn.v_proj.lora_B.weight": "model-00005-of-00008.safetensors",
217
+ "llm.model.layers.14.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
218
+ "llm.model.layers.15.input_layernorm.weight": "model-00005-of-00008.safetensors",
219
+ "llm.model.layers.15.mlp.down_proj.bias": "model-00005-of-00008.safetensors",
220
+ "llm.model.layers.15.mlp.down_proj.lora_A.weight": "model-00005-of-00008.safetensors",
221
+ "llm.model.layers.15.mlp.down_proj.lora_B.weight": "model-00005-of-00008.safetensors",
222
+ "llm.model.layers.15.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
223
+ "llm.model.layers.15.mlp.gate_proj.bias": "model-00005-of-00008.safetensors",
224
+ "llm.model.layers.15.mlp.gate_proj.lora_A.weight": "model-00005-of-00008.safetensors",
225
+ "llm.model.layers.15.mlp.gate_proj.lora_B.weight": "model-00005-of-00008.safetensors",
226
+ "llm.model.layers.15.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
227
+ "llm.model.layers.15.mlp.up_proj.bias": "model-00005-of-00008.safetensors",
228
+ "llm.model.layers.15.mlp.up_proj.lora_A.weight": "model-00005-of-00008.safetensors",
229
+ "llm.model.layers.15.mlp.up_proj.lora_B.weight": "model-00005-of-00008.safetensors",
230
+ "llm.model.layers.15.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
231
+ "llm.model.layers.15.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
232
+ "llm.model.layers.15.self_attn.k_proj.bias": "model-00005-of-00008.safetensors",
233
+ "llm.model.layers.15.self_attn.k_proj.lora_A.weight": "model-00005-of-00008.safetensors",
234
+ "llm.model.layers.15.self_attn.k_proj.lora_B.weight": "model-00005-of-00008.safetensors",
235
+ "llm.model.layers.15.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
236
+ "llm.model.layers.15.self_attn.o_proj.bias": "model-00005-of-00008.safetensors",
237
+ "llm.model.layers.15.self_attn.o_proj.lora_A.weight": "model-00005-of-00008.safetensors",
238
+ "llm.model.layers.15.self_attn.o_proj.lora_B.weight": "model-00005-of-00008.safetensors",
239
+ "llm.model.layers.15.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
240
+ "llm.model.layers.15.self_attn.q_proj.bias": "model-00005-of-00008.safetensors",
241
+ "llm.model.layers.15.self_attn.q_proj.lora_A.weight": "model-00005-of-00008.safetensors",
242
+ "llm.model.layers.15.self_attn.q_proj.lora_B.weight": "model-00005-of-00008.safetensors",
243
+ "llm.model.layers.15.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
244
+ "llm.model.layers.15.self_attn.v_proj.bias": "model-00005-of-00008.safetensors",
245
+ "llm.model.layers.15.self_attn.v_proj.lora_A.weight": "model-00005-of-00008.safetensors",
246
+ "llm.model.layers.15.self_attn.v_proj.lora_B.weight": "model-00005-of-00008.safetensors",
247
+ "llm.model.layers.15.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
248
+ "llm.model.layers.16.input_layernorm.weight": "model-00005-of-00008.safetensors",
249
+ "llm.model.layers.16.mlp.down_proj.bias": "model-00005-of-00008.safetensors",
250
+ "llm.model.layers.16.mlp.down_proj.lora_A.weight": "model-00005-of-00008.safetensors",
251
+ "llm.model.layers.16.mlp.down_proj.lora_B.weight": "model-00005-of-00008.safetensors",
252
+ "llm.model.layers.16.mlp.down_proj.weight": "model-00005-of-00008.safetensors",
253
+ "llm.model.layers.16.mlp.gate_proj.bias": "model-00005-of-00008.safetensors",
254
+ "llm.model.layers.16.mlp.gate_proj.lora_A.weight": "model-00005-of-00008.safetensors",
255
+ "llm.model.layers.16.mlp.gate_proj.lora_B.weight": "model-00005-of-00008.safetensors",
256
+ "llm.model.layers.16.mlp.gate_proj.weight": "model-00005-of-00008.safetensors",
257
+ "llm.model.layers.16.mlp.up_proj.bias": "model-00005-of-00008.safetensors",
258
+ "llm.model.layers.16.mlp.up_proj.lora_A.weight": "model-00005-of-00008.safetensors",
259
+ "llm.model.layers.16.mlp.up_proj.lora_B.weight": "model-00005-of-00008.safetensors",
260
+ "llm.model.layers.16.mlp.up_proj.weight": "model-00005-of-00008.safetensors",
261
+ "llm.model.layers.16.post_attention_layernorm.weight": "model-00005-of-00008.safetensors",
262
+ "llm.model.layers.16.self_attn.k_proj.bias": "model-00005-of-00008.safetensors",
263
+ "llm.model.layers.16.self_attn.k_proj.lora_A.weight": "model-00005-of-00008.safetensors",
264
+ "llm.model.layers.16.self_attn.k_proj.lora_B.weight": "model-00005-of-00008.safetensors",
265
+ "llm.model.layers.16.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
266
+ "llm.model.layers.16.self_attn.o_proj.bias": "model-00005-of-00008.safetensors",
267
+ "llm.model.layers.16.self_attn.o_proj.lora_A.weight": "model-00005-of-00008.safetensors",
268
+ "llm.model.layers.16.self_attn.o_proj.lora_B.weight": "model-00005-of-00008.safetensors",
269
+ "llm.model.layers.16.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
270
+ "llm.model.layers.16.self_attn.q_proj.bias": "model-00005-of-00008.safetensors",
271
+ "llm.model.layers.16.self_attn.q_proj.lora_A.weight": "model-00005-of-00008.safetensors",
272
+ "llm.model.layers.16.self_attn.q_proj.lora_B.weight": "model-00005-of-00008.safetensors",
273
+ "llm.model.layers.16.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
274
+ "llm.model.layers.16.self_attn.v_proj.bias": "model-00005-of-00008.safetensors",
275
+ "llm.model.layers.16.self_attn.v_proj.lora_A.weight": "model-00005-of-00008.safetensors",
276
+ "llm.model.layers.16.self_attn.v_proj.lora_B.weight": "model-00005-of-00008.safetensors",
277
+ "llm.model.layers.16.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
278
+ "llm.model.layers.17.input_layernorm.weight": "model-00006-of-00008.safetensors",
279
+ "llm.model.layers.17.mlp.down_proj.bias": "model-00006-of-00008.safetensors",
280
+ "llm.model.layers.17.mlp.down_proj.lora_A.weight": "model-00006-of-00008.safetensors",
281
+ "llm.model.layers.17.mlp.down_proj.lora_B.weight": "model-00006-of-00008.safetensors",
282
+ "llm.model.layers.17.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
283
+ "llm.model.layers.17.mlp.gate_proj.bias": "model-00006-of-00008.safetensors",
284
+ "llm.model.layers.17.mlp.gate_proj.lora_A.weight": "model-00006-of-00008.safetensors",
285
+ "llm.model.layers.17.mlp.gate_proj.lora_B.weight": "model-00006-of-00008.safetensors",
286
+ "llm.model.layers.17.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
287
+ "llm.model.layers.17.mlp.up_proj.bias": "model-00006-of-00008.safetensors",
288
+ "llm.model.layers.17.mlp.up_proj.lora_A.weight": "model-00006-of-00008.safetensors",
289
+ "llm.model.layers.17.mlp.up_proj.lora_B.weight": "model-00006-of-00008.safetensors",
290
+ "llm.model.layers.17.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
291
+ "llm.model.layers.17.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
292
+ "llm.model.layers.17.self_attn.k_proj.bias": "model-00005-of-00008.safetensors",
293
+ "llm.model.layers.17.self_attn.k_proj.lora_A.weight": "model-00005-of-00008.safetensors",
294
+ "llm.model.layers.17.self_attn.k_proj.lora_B.weight": "model-00005-of-00008.safetensors",
295
+ "llm.model.layers.17.self_attn.k_proj.weight": "model-00005-of-00008.safetensors",
296
+ "llm.model.layers.17.self_attn.o_proj.bias": "model-00005-of-00008.safetensors",
297
+ "llm.model.layers.17.self_attn.o_proj.lora_A.weight": "model-00005-of-00008.safetensors",
298
+ "llm.model.layers.17.self_attn.o_proj.lora_B.weight": "model-00005-of-00008.safetensors",
299
+ "llm.model.layers.17.self_attn.o_proj.weight": "model-00005-of-00008.safetensors",
300
+ "llm.model.layers.17.self_attn.q_proj.bias": "model-00005-of-00008.safetensors",
301
+ "llm.model.layers.17.self_attn.q_proj.lora_A.weight": "model-00005-of-00008.safetensors",
302
+ "llm.model.layers.17.self_attn.q_proj.lora_B.weight": "model-00005-of-00008.safetensors",
303
+ "llm.model.layers.17.self_attn.q_proj.weight": "model-00005-of-00008.safetensors",
304
+ "llm.model.layers.17.self_attn.v_proj.bias": "model-00005-of-00008.safetensors",
305
+ "llm.model.layers.17.self_attn.v_proj.lora_A.weight": "model-00005-of-00008.safetensors",
306
+ "llm.model.layers.17.self_attn.v_proj.lora_B.weight": "model-00005-of-00008.safetensors",
307
+ "llm.model.layers.17.self_attn.v_proj.weight": "model-00005-of-00008.safetensors",
308
+ "llm.model.layers.18.input_layernorm.weight": "model-00006-of-00008.safetensors",
309
+ "llm.model.layers.18.mlp.down_proj.bias": "model-00006-of-00008.safetensors",
310
+ "llm.model.layers.18.mlp.down_proj.lora_A.weight": "model-00006-of-00008.safetensors",
311
+ "llm.model.layers.18.mlp.down_proj.lora_B.weight": "model-00006-of-00008.safetensors",
312
+ "llm.model.layers.18.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
313
+ "llm.model.layers.18.mlp.gate_proj.bias": "model-00006-of-00008.safetensors",
314
+ "llm.model.layers.18.mlp.gate_proj.lora_A.weight": "model-00006-of-00008.safetensors",
315
+ "llm.model.layers.18.mlp.gate_proj.lora_B.weight": "model-00006-of-00008.safetensors",
316
+ "llm.model.layers.18.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
317
+ "llm.model.layers.18.mlp.up_proj.bias": "model-00006-of-00008.safetensors",
318
+ "llm.model.layers.18.mlp.up_proj.lora_A.weight": "model-00006-of-00008.safetensors",
319
+ "llm.model.layers.18.mlp.up_proj.lora_B.weight": "model-00006-of-00008.safetensors",
320
+ "llm.model.layers.18.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
321
+ "llm.model.layers.18.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
322
+ "llm.model.layers.18.self_attn.k_proj.bias": "model-00006-of-00008.safetensors",
323
+ "llm.model.layers.18.self_attn.k_proj.lora_A.weight": "model-00006-of-00008.safetensors",
324
+ "llm.model.layers.18.self_attn.k_proj.lora_B.weight": "model-00006-of-00008.safetensors",
325
+ "llm.model.layers.18.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
326
+ "llm.model.layers.18.self_attn.o_proj.bias": "model-00006-of-00008.safetensors",
327
+ "llm.model.layers.18.self_attn.o_proj.lora_A.weight": "model-00006-of-00008.safetensors",
328
+ "llm.model.layers.18.self_attn.o_proj.lora_B.weight": "model-00006-of-00008.safetensors",
329
+ "llm.model.layers.18.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
330
+ "llm.model.layers.18.self_attn.q_proj.bias": "model-00006-of-00008.safetensors",
331
+ "llm.model.layers.18.self_attn.q_proj.lora_A.weight": "model-00006-of-00008.safetensors",
332
+ "llm.model.layers.18.self_attn.q_proj.lora_B.weight": "model-00006-of-00008.safetensors",
333
+ "llm.model.layers.18.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
334
+ "llm.model.layers.18.self_attn.v_proj.bias": "model-00006-of-00008.safetensors",
335
+ "llm.model.layers.18.self_attn.v_proj.lora_A.weight": "model-00006-of-00008.safetensors",
336
+ "llm.model.layers.18.self_attn.v_proj.lora_B.weight": "model-00006-of-00008.safetensors",
337
+ "llm.model.layers.18.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
338
+ "llm.model.layers.19.input_layernorm.weight": "model-00006-of-00008.safetensors",
339
+ "llm.model.layers.19.mlp.down_proj.bias": "model-00006-of-00008.safetensors",
340
+ "llm.model.layers.19.mlp.down_proj.lora_A.weight": "model-00006-of-00008.safetensors",
341
+ "llm.model.layers.19.mlp.down_proj.lora_B.weight": "model-00006-of-00008.safetensors",
342
+ "llm.model.layers.19.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
343
+ "llm.model.layers.19.mlp.gate_proj.bias": "model-00006-of-00008.safetensors",
344
+ "llm.model.layers.19.mlp.gate_proj.lora_A.weight": "model-00006-of-00008.safetensors",
345
+ "llm.model.layers.19.mlp.gate_proj.lora_B.weight": "model-00006-of-00008.safetensors",
346
+ "llm.model.layers.19.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
347
+ "llm.model.layers.19.mlp.up_proj.bias": "model-00006-of-00008.safetensors",
348
+ "llm.model.layers.19.mlp.up_proj.lora_A.weight": "model-00006-of-00008.safetensors",
349
+ "llm.model.layers.19.mlp.up_proj.lora_B.weight": "model-00006-of-00008.safetensors",
350
+ "llm.model.layers.19.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
351
+ "llm.model.layers.19.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
352
+ "llm.model.layers.19.self_attn.k_proj.bias": "model-00006-of-00008.safetensors",
353
+ "llm.model.layers.19.self_attn.k_proj.lora_A.weight": "model-00006-of-00008.safetensors",
354
+ "llm.model.layers.19.self_attn.k_proj.lora_B.weight": "model-00006-of-00008.safetensors",
355
+ "llm.model.layers.19.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
356
+ "llm.model.layers.19.self_attn.o_proj.bias": "model-00006-of-00008.safetensors",
357
+ "llm.model.layers.19.self_attn.o_proj.lora_A.weight": "model-00006-of-00008.safetensors",
358
+ "llm.model.layers.19.self_attn.o_proj.lora_B.weight": "model-00006-of-00008.safetensors",
359
+ "llm.model.layers.19.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
360
+ "llm.model.layers.19.self_attn.q_proj.bias": "model-00006-of-00008.safetensors",
361
+ "llm.model.layers.19.self_attn.q_proj.lora_A.weight": "model-00006-of-00008.safetensors",
362
+ "llm.model.layers.19.self_attn.q_proj.lora_B.weight": "model-00006-of-00008.safetensors",
363
+ "llm.model.layers.19.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
364
+ "llm.model.layers.19.self_attn.v_proj.bias": "model-00006-of-00008.safetensors",
365
+ "llm.model.layers.19.self_attn.v_proj.lora_A.weight": "model-00006-of-00008.safetensors",
366
+ "llm.model.layers.19.self_attn.v_proj.lora_B.weight": "model-00006-of-00008.safetensors",
367
+ "llm.model.layers.19.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
368
+ "llm.model.layers.2.input_layernorm.weight": "model-00002-of-00008.safetensors",
369
+ "llm.model.layers.2.mlp.down_proj.bias": "model-00002-of-00008.safetensors",
370
+ "llm.model.layers.2.mlp.down_proj.lora_A.weight": "model-00002-of-00008.safetensors",
371
+ "llm.model.layers.2.mlp.down_proj.lora_B.weight": "model-00002-of-00008.safetensors",
372
+ "llm.model.layers.2.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
373
+ "llm.model.layers.2.mlp.gate_proj.bias": "model-00002-of-00008.safetensors",
374
+ "llm.model.layers.2.mlp.gate_proj.lora_A.weight": "model-00002-of-00008.safetensors",
375
+ "llm.model.layers.2.mlp.gate_proj.lora_B.weight": "model-00002-of-00008.safetensors",
376
+ "llm.model.layers.2.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
377
+ "llm.model.layers.2.mlp.up_proj.bias": "model-00002-of-00008.safetensors",
378
+ "llm.model.layers.2.mlp.up_proj.lora_A.weight": "model-00002-of-00008.safetensors",
379
+ "llm.model.layers.2.mlp.up_proj.lora_B.weight": "model-00002-of-00008.safetensors",
380
+ "llm.model.layers.2.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
381
+ "llm.model.layers.2.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
382
+ "llm.model.layers.2.self_attn.k_proj.bias": "model-00001-of-00008.safetensors",
383
+ "llm.model.layers.2.self_attn.k_proj.lora_A.weight": "model-00001-of-00008.safetensors",
384
+ "llm.model.layers.2.self_attn.k_proj.lora_B.weight": "model-00001-of-00008.safetensors",
385
+ "llm.model.layers.2.self_attn.k_proj.weight": "model-00001-of-00008.safetensors",
386
+ "llm.model.layers.2.self_attn.o_proj.bias": "model-00001-of-00008.safetensors",
387
+ "llm.model.layers.2.self_attn.o_proj.lora_A.weight": "model-00001-of-00008.safetensors",
388
+ "llm.model.layers.2.self_attn.o_proj.lora_B.weight": "model-00001-of-00008.safetensors",
389
+ "llm.model.layers.2.self_attn.o_proj.weight": "model-00001-of-00008.safetensors",
390
+ "llm.model.layers.2.self_attn.q_proj.bias": "model-00001-of-00008.safetensors",
391
+ "llm.model.layers.2.self_attn.q_proj.lora_A.weight": "model-00001-of-00008.safetensors",
392
+ "llm.model.layers.2.self_attn.q_proj.lora_B.weight": "model-00001-of-00008.safetensors",
393
+ "llm.model.layers.2.self_attn.q_proj.weight": "model-00001-of-00008.safetensors",
394
+ "llm.model.layers.2.self_attn.v_proj.bias": "model-00001-of-00008.safetensors",
395
+ "llm.model.layers.2.self_attn.v_proj.lora_A.weight": "model-00001-of-00008.safetensors",
396
+ "llm.model.layers.2.self_attn.v_proj.lora_B.weight": "model-00001-of-00008.safetensors",
397
+ "llm.model.layers.2.self_attn.v_proj.weight": "model-00001-of-00008.safetensors",
398
+ "llm.model.layers.20.input_layernorm.weight": "model-00006-of-00008.safetensors",
399
+ "llm.model.layers.20.mlp.down_proj.bias": "model-00006-of-00008.safetensors",
400
+ "llm.model.layers.20.mlp.down_proj.lora_A.weight": "model-00006-of-00008.safetensors",
401
+ "llm.model.layers.20.mlp.down_proj.lora_B.weight": "model-00006-of-00008.safetensors",
402
+ "llm.model.layers.20.mlp.down_proj.weight": "model-00006-of-00008.safetensors",
403
+ "llm.model.layers.20.mlp.gate_proj.bias": "model-00006-of-00008.safetensors",
404
+ "llm.model.layers.20.mlp.gate_proj.lora_A.weight": "model-00006-of-00008.safetensors",
405
+ "llm.model.layers.20.mlp.gate_proj.lora_B.weight": "model-00006-of-00008.safetensors",
406
+ "llm.model.layers.20.mlp.gate_proj.weight": "model-00006-of-00008.safetensors",
407
+ "llm.model.layers.20.mlp.up_proj.bias": "model-00006-of-00008.safetensors",
408
+ "llm.model.layers.20.mlp.up_proj.lora_A.weight": "model-00006-of-00008.safetensors",
409
+ "llm.model.layers.20.mlp.up_proj.lora_B.weight": "model-00006-of-00008.safetensors",
410
+ "llm.model.layers.20.mlp.up_proj.weight": "model-00006-of-00008.safetensors",
411
+ "llm.model.layers.20.post_attention_layernorm.weight": "model-00006-of-00008.safetensors",
412
+ "llm.model.layers.20.self_attn.k_proj.bias": "model-00006-of-00008.safetensors",
413
+ "llm.model.layers.20.self_attn.k_proj.lora_A.weight": "model-00006-of-00008.safetensors",
414
+ "llm.model.layers.20.self_attn.k_proj.lora_B.weight": "model-00006-of-00008.safetensors",
415
+ "llm.model.layers.20.self_attn.k_proj.weight": "model-00006-of-00008.safetensors",
416
+ "llm.model.layers.20.self_attn.o_proj.bias": "model-00006-of-00008.safetensors",
417
+ "llm.model.layers.20.self_attn.o_proj.lora_A.weight": "model-00006-of-00008.safetensors",
418
+ "llm.model.layers.20.self_attn.o_proj.lora_B.weight": "model-00006-of-00008.safetensors",
419
+ "llm.model.layers.20.self_attn.o_proj.weight": "model-00006-of-00008.safetensors",
420
+ "llm.model.layers.20.self_attn.q_proj.bias": "model-00006-of-00008.safetensors",
421
+ "llm.model.layers.20.self_attn.q_proj.lora_A.weight": "model-00006-of-00008.safetensors",
422
+ "llm.model.layers.20.self_attn.q_proj.lora_B.weight": "model-00006-of-00008.safetensors",
423
+ "llm.model.layers.20.self_attn.q_proj.weight": "model-00006-of-00008.safetensors",
424
+ "llm.model.layers.20.self_attn.v_proj.bias": "model-00006-of-00008.safetensors",
425
+ "llm.model.layers.20.self_attn.v_proj.lora_A.weight": "model-00006-of-00008.safetensors",
426
+ "llm.model.layers.20.self_attn.v_proj.lora_B.weight": "model-00006-of-00008.safetensors",
427
+ "llm.model.layers.20.self_attn.v_proj.weight": "model-00006-of-00008.safetensors",
428
+ "llm.model.layers.21.input_layernorm.weight": "model-00007-of-00008.safetensors",
429
+ "llm.model.layers.21.mlp.down_proj.bias": "model-00007-of-00008.safetensors",
430
+ "llm.model.layers.21.mlp.down_proj.lora_A.weight": "model-00007-of-00008.safetensors",
431
+ "llm.model.layers.21.mlp.down_proj.lora_B.weight": "model-00007-of-00008.safetensors",
432
+ "llm.model.layers.21.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
433
+ "llm.model.layers.21.mlp.gate_proj.bias": "model-00007-of-00008.safetensors",
434
+ "llm.model.layers.21.mlp.gate_proj.lora_A.weight": "model-00007-of-00008.safetensors",
435
+ "llm.model.layers.21.mlp.gate_proj.lora_B.weight": "model-00007-of-00008.safetensors",
436
+ "llm.model.layers.21.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
437
+ "llm.model.layers.21.mlp.up_proj.bias": "model-00007-of-00008.safetensors",
438
+ "llm.model.layers.21.mlp.up_proj.lora_A.weight": "model-00007-of-00008.safetensors",
439
+ "llm.model.layers.21.mlp.up_proj.lora_B.weight": "model-00007-of-00008.safetensors",
440
+ "llm.model.layers.21.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
441
+ "llm.model.layers.21.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
442
+ "llm.model.layers.21.self_attn.k_proj.bias": "model-00007-of-00008.safetensors",
443
+ "llm.model.layers.21.self_attn.k_proj.lora_A.weight": "model-00007-of-00008.safetensors",
444
+ "llm.model.layers.21.self_attn.k_proj.lora_B.weight": "model-00007-of-00008.safetensors",
445
+ "llm.model.layers.21.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
446
+ "llm.model.layers.21.self_attn.o_proj.bias": "model-00007-of-00008.safetensors",
447
+ "llm.model.layers.21.self_attn.o_proj.lora_A.weight": "model-00007-of-00008.safetensors",
448
+ "llm.model.layers.21.self_attn.o_proj.lora_B.weight": "model-00007-of-00008.safetensors",
449
+ "llm.model.layers.21.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
450
+ "llm.model.layers.21.self_attn.q_proj.bias": "model-00007-of-00008.safetensors",
451
+ "llm.model.layers.21.self_attn.q_proj.lora_A.weight": "model-00007-of-00008.safetensors",
452
+ "llm.model.layers.21.self_attn.q_proj.lora_B.weight": "model-00007-of-00008.safetensors",
453
+ "llm.model.layers.21.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
454
+ "llm.model.layers.21.self_attn.v_proj.bias": "model-00007-of-00008.safetensors",
455
+ "llm.model.layers.21.self_attn.v_proj.lora_A.weight": "model-00007-of-00008.safetensors",
456
+ "llm.model.layers.21.self_attn.v_proj.lora_B.weight": "model-00007-of-00008.safetensors",
457
+ "llm.model.layers.21.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
458
+ "llm.model.layers.22.input_layernorm.weight": "model-00007-of-00008.safetensors",
459
+ "llm.model.layers.22.mlp.down_proj.bias": "model-00007-of-00008.safetensors",
460
+ "llm.model.layers.22.mlp.down_proj.lora_A.weight": "model-00007-of-00008.safetensors",
461
+ "llm.model.layers.22.mlp.down_proj.lora_B.weight": "model-00007-of-00008.safetensors",
462
+ "llm.model.layers.22.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
463
+ "llm.model.layers.22.mlp.gate_proj.bias": "model-00007-of-00008.safetensors",
464
+ "llm.model.layers.22.mlp.gate_proj.lora_A.weight": "model-00007-of-00008.safetensors",
465
+ "llm.model.layers.22.mlp.gate_proj.lora_B.weight": "model-00007-of-00008.safetensors",
466
+ "llm.model.layers.22.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
467
+ "llm.model.layers.22.mlp.up_proj.bias": "model-00007-of-00008.safetensors",
468
+ "llm.model.layers.22.mlp.up_proj.lora_A.weight": "model-00007-of-00008.safetensors",
469
+ "llm.model.layers.22.mlp.up_proj.lora_B.weight": "model-00007-of-00008.safetensors",
470
+ "llm.model.layers.22.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
471
+ "llm.model.layers.22.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
472
+ "llm.model.layers.22.self_attn.k_proj.bias": "model-00007-of-00008.safetensors",
473
+ "llm.model.layers.22.self_attn.k_proj.lora_A.weight": "model-00007-of-00008.safetensors",
474
+ "llm.model.layers.22.self_attn.k_proj.lora_B.weight": "model-00007-of-00008.safetensors",
475
+ "llm.model.layers.22.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
476
+ "llm.model.layers.22.self_attn.o_proj.bias": "model-00007-of-00008.safetensors",
477
+ "llm.model.layers.22.self_attn.o_proj.lora_A.weight": "model-00007-of-00008.safetensors",
478
+ "llm.model.layers.22.self_attn.o_proj.lora_B.weight": "model-00007-of-00008.safetensors",
479
+ "llm.model.layers.22.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
480
+ "llm.model.layers.22.self_attn.q_proj.bias": "model-00007-of-00008.safetensors",
481
+ "llm.model.layers.22.self_attn.q_proj.lora_A.weight": "model-00007-of-00008.safetensors",
482
+ "llm.model.layers.22.self_attn.q_proj.lora_B.weight": "model-00007-of-00008.safetensors",
483
+ "llm.model.layers.22.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
484
+ "llm.model.layers.22.self_attn.v_proj.bias": "model-00007-of-00008.safetensors",
485
+ "llm.model.layers.22.self_attn.v_proj.lora_A.weight": "model-00007-of-00008.safetensors",
486
+ "llm.model.layers.22.self_attn.v_proj.lora_B.weight": "model-00007-of-00008.safetensors",
487
+ "llm.model.layers.22.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
488
+ "llm.model.layers.23.input_layernorm.weight": "model-00007-of-00008.safetensors",
489
+ "llm.model.layers.23.mlp.down_proj.bias": "model-00007-of-00008.safetensors",
490
+ "llm.model.layers.23.mlp.down_proj.lora_A.weight": "model-00007-of-00008.safetensors",
491
+ "llm.model.layers.23.mlp.down_proj.lora_B.weight": "model-00007-of-00008.safetensors",
492
+ "llm.model.layers.23.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
493
+ "llm.model.layers.23.mlp.gate_proj.bias": "model-00007-of-00008.safetensors",
494
+ "llm.model.layers.23.mlp.gate_proj.lora_A.weight": "model-00007-of-00008.safetensors",
495
+ "llm.model.layers.23.mlp.gate_proj.lora_B.weight": "model-00007-of-00008.safetensors",
496
+ "llm.model.layers.23.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
497
+ "llm.model.layers.23.mlp.up_proj.bias": "model-00007-of-00008.safetensors",
498
+ "llm.model.layers.23.mlp.up_proj.lora_A.weight": "model-00007-of-00008.safetensors",
499
+ "llm.model.layers.23.mlp.up_proj.lora_B.weight": "model-00007-of-00008.safetensors",
500
+ "llm.model.layers.23.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
501
+ "llm.model.layers.23.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
502
+ "llm.model.layers.23.self_attn.k_proj.bias": "model-00007-of-00008.safetensors",
503
+ "llm.model.layers.23.self_attn.k_proj.lora_A.weight": "model-00007-of-00008.safetensors",
504
+ "llm.model.layers.23.self_attn.k_proj.lora_B.weight": "model-00007-of-00008.safetensors",
505
+ "llm.model.layers.23.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
506
+ "llm.model.layers.23.self_attn.o_proj.bias": "model-00007-of-00008.safetensors",
507
+ "llm.model.layers.23.self_attn.o_proj.lora_A.weight": "model-00007-of-00008.safetensors",
508
+ "llm.model.layers.23.self_attn.o_proj.lora_B.weight": "model-00007-of-00008.safetensors",
509
+ "llm.model.layers.23.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
510
+ "llm.model.layers.23.self_attn.q_proj.bias": "model-00007-of-00008.safetensors",
511
+ "llm.model.layers.23.self_attn.q_proj.lora_A.weight": "model-00007-of-00008.safetensors",
512
+ "llm.model.layers.23.self_attn.q_proj.lora_B.weight": "model-00007-of-00008.safetensors",
513
+ "llm.model.layers.23.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
514
+ "llm.model.layers.23.self_attn.v_proj.bias": "model-00007-of-00008.safetensors",
515
+ "llm.model.layers.23.self_attn.v_proj.lora_A.weight": "model-00007-of-00008.safetensors",
516
+ "llm.model.layers.23.self_attn.v_proj.lora_B.weight": "model-00007-of-00008.safetensors",
517
+ "llm.model.layers.23.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
518
+ "llm.model.layers.24.input_layernorm.weight": "model-00007-of-00008.safetensors",
519
+ "llm.model.layers.24.mlp.down_proj.weight": "model-00007-of-00008.safetensors",
520
+ "llm.model.layers.24.mlp.gate_proj.weight": "model-00007-of-00008.safetensors",
521
+ "llm.model.layers.24.mlp.up_proj.weight": "model-00007-of-00008.safetensors",
522
+ "llm.model.layers.24.post_attention_layernorm.weight": "model-00007-of-00008.safetensors",
523
+ "llm.model.layers.24.self_attn.k_proj.bias": "model-00007-of-00008.safetensors",
524
+ "llm.model.layers.24.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
525
+ "llm.model.layers.24.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
526
+ "llm.model.layers.24.self_attn.q_proj.bias": "model-00007-of-00008.safetensors",
527
+ "llm.model.layers.24.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
528
+ "llm.model.layers.24.self_attn.v_proj.bias": "model-00007-of-00008.safetensors",
529
+ "llm.model.layers.24.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
530
+ "llm.model.layers.25.input_layernorm.weight": "model-00008-of-00008.safetensors",
531
+ "llm.model.layers.25.mlp.down_proj.weight": "model-00008-of-00008.safetensors",
532
+ "llm.model.layers.25.mlp.gate_proj.weight": "model-00008-of-00008.safetensors",
533
+ "llm.model.layers.25.mlp.up_proj.weight": "model-00008-of-00008.safetensors",
534
+ "llm.model.layers.25.post_attention_layernorm.weight": "model-00008-of-00008.safetensors",
535
+ "llm.model.layers.25.self_attn.k_proj.bias": "model-00007-of-00008.safetensors",
536
+ "llm.model.layers.25.self_attn.k_proj.weight": "model-00007-of-00008.safetensors",
537
+ "llm.model.layers.25.self_attn.o_proj.weight": "model-00007-of-00008.safetensors",
538
+ "llm.model.layers.25.self_attn.q_proj.bias": "model-00007-of-00008.safetensors",
539
+ "llm.model.layers.25.self_attn.q_proj.weight": "model-00007-of-00008.safetensors",
540
+ "llm.model.layers.25.self_attn.v_proj.bias": "model-00007-of-00008.safetensors",
541
+ "llm.model.layers.25.self_attn.v_proj.weight": "model-00007-of-00008.safetensors",
542
+ "llm.model.layers.26.input_layernorm.weight": "model-00008-of-00008.safetensors",
543
+ "llm.model.layers.26.mlp.down_proj.weight": "model-00008-of-00008.safetensors",
544
+ "llm.model.layers.26.mlp.gate_proj.weight": "model-00008-of-00008.safetensors",
545
+ "llm.model.layers.26.mlp.up_proj.weight": "model-00008-of-00008.safetensors",
546
+ "llm.model.layers.26.post_attention_layernorm.weight": "model-00008-of-00008.safetensors",
547
+ "llm.model.layers.26.self_attn.k_proj.bias": "model-00008-of-00008.safetensors",
548
+ "llm.model.layers.26.self_attn.k_proj.weight": "model-00008-of-00008.safetensors",
549
+ "llm.model.layers.26.self_attn.o_proj.weight": "model-00008-of-00008.safetensors",
550
+ "llm.model.layers.26.self_attn.q_proj.bias": "model-00008-of-00008.safetensors",
551
+ "llm.model.layers.26.self_attn.q_proj.weight": "model-00008-of-00008.safetensors",
552
+ "llm.model.layers.26.self_attn.v_proj.bias": "model-00008-of-00008.safetensors",
553
+ "llm.model.layers.26.self_attn.v_proj.weight": "model-00008-of-00008.safetensors",
554
+ "llm.model.layers.27.input_layernorm.weight": "model-00008-of-00008.safetensors",
555
+ "llm.model.layers.27.mlp.down_proj.weight": "model-00008-of-00008.safetensors",
556
+ "llm.model.layers.27.mlp.gate_proj.weight": "model-00008-of-00008.safetensors",
557
+ "llm.model.layers.27.mlp.up_proj.weight": "model-00008-of-00008.safetensors",
558
+ "llm.model.layers.27.post_attention_layernorm.weight": "model-00008-of-00008.safetensors",
559
+ "llm.model.layers.27.self_attn.k_proj.bias": "model-00008-of-00008.safetensors",
560
+ "llm.model.layers.27.self_attn.k_proj.weight": "model-00008-of-00008.safetensors",
561
+ "llm.model.layers.27.self_attn.o_proj.weight": "model-00008-of-00008.safetensors",
562
+ "llm.model.layers.27.self_attn.q_proj.bias": "model-00008-of-00008.safetensors",
563
+ "llm.model.layers.27.self_attn.q_proj.weight": "model-00008-of-00008.safetensors",
564
+ "llm.model.layers.27.self_attn.v_proj.bias": "model-00008-of-00008.safetensors",
565
+ "llm.model.layers.27.self_attn.v_proj.weight": "model-00008-of-00008.safetensors",
566
+ "llm.model.layers.3.input_layernorm.weight": "model-00002-of-00008.safetensors",
567
+ "llm.model.layers.3.mlp.down_proj.bias": "model-00002-of-00008.safetensors",
568
+ "llm.model.layers.3.mlp.down_proj.lora_A.weight": "model-00002-of-00008.safetensors",
569
+ "llm.model.layers.3.mlp.down_proj.lora_B.weight": "model-00002-of-00008.safetensors",
570
+ "llm.model.layers.3.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
571
+ "llm.model.layers.3.mlp.gate_proj.bias": "model-00002-of-00008.safetensors",
572
+ "llm.model.layers.3.mlp.gate_proj.lora_A.weight": "model-00002-of-00008.safetensors",
573
+ "llm.model.layers.3.mlp.gate_proj.lora_B.weight": "model-00002-of-00008.safetensors",
574
+ "llm.model.layers.3.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
575
+ "llm.model.layers.3.mlp.up_proj.bias": "model-00002-of-00008.safetensors",
576
+ "llm.model.layers.3.mlp.up_proj.lora_A.weight": "model-00002-of-00008.safetensors",
577
+ "llm.model.layers.3.mlp.up_proj.lora_B.weight": "model-00002-of-00008.safetensors",
578
+ "llm.model.layers.3.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
579
+ "llm.model.layers.3.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
580
+ "llm.model.layers.3.self_attn.k_proj.bias": "model-00002-of-00008.safetensors",
581
+ "llm.model.layers.3.self_attn.k_proj.lora_A.weight": "model-00002-of-00008.safetensors",
582
+ "llm.model.layers.3.self_attn.k_proj.lora_B.weight": "model-00002-of-00008.safetensors",
583
+ "llm.model.layers.3.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
584
+ "llm.model.layers.3.self_attn.o_proj.bias": "model-00002-of-00008.safetensors",
585
+ "llm.model.layers.3.self_attn.o_proj.lora_A.weight": "model-00002-of-00008.safetensors",
586
+ "llm.model.layers.3.self_attn.o_proj.lora_B.weight": "model-00002-of-00008.safetensors",
587
+ "llm.model.layers.3.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
588
+ "llm.model.layers.3.self_attn.q_proj.bias": "model-00002-of-00008.safetensors",
589
+ "llm.model.layers.3.self_attn.q_proj.lora_A.weight": "model-00002-of-00008.safetensors",
590
+ "llm.model.layers.3.self_attn.q_proj.lora_B.weight": "model-00002-of-00008.safetensors",
591
+ "llm.model.layers.3.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
592
+ "llm.model.layers.3.self_attn.v_proj.bias": "model-00002-of-00008.safetensors",
593
+ "llm.model.layers.3.self_attn.v_proj.lora_A.weight": "model-00002-of-00008.safetensors",
594
+ "llm.model.layers.3.self_attn.v_proj.lora_B.weight": "model-00002-of-00008.safetensors",
595
+ "llm.model.layers.3.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
596
+ "llm.model.layers.4.input_layernorm.weight": "model-00002-of-00008.safetensors",
597
+ "llm.model.layers.4.mlp.down_proj.bias": "model-00002-of-00008.safetensors",
598
+ "llm.model.layers.4.mlp.down_proj.lora_A.weight": "model-00002-of-00008.safetensors",
599
+ "llm.model.layers.4.mlp.down_proj.lora_B.weight": "model-00002-of-00008.safetensors",
600
+ "llm.model.layers.4.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
601
+ "llm.model.layers.4.mlp.gate_proj.bias": "model-00002-of-00008.safetensors",
602
+ "llm.model.layers.4.mlp.gate_proj.lora_A.weight": "model-00002-of-00008.safetensors",
603
+ "llm.model.layers.4.mlp.gate_proj.lora_B.weight": "model-00002-of-00008.safetensors",
604
+ "llm.model.layers.4.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
605
+ "llm.model.layers.4.mlp.up_proj.bias": "model-00002-of-00008.safetensors",
606
+ "llm.model.layers.4.mlp.up_proj.lora_A.weight": "model-00002-of-00008.safetensors",
607
+ "llm.model.layers.4.mlp.up_proj.lora_B.weight": "model-00002-of-00008.safetensors",
608
+ "llm.model.layers.4.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
609
+ "llm.model.layers.4.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
610
+ "llm.model.layers.4.self_attn.k_proj.bias": "model-00002-of-00008.safetensors",
611
+ "llm.model.layers.4.self_attn.k_proj.lora_A.weight": "model-00002-of-00008.safetensors",
612
+ "llm.model.layers.4.self_attn.k_proj.lora_B.weight": "model-00002-of-00008.safetensors",
613
+ "llm.model.layers.4.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
614
+ "llm.model.layers.4.self_attn.o_proj.bias": "model-00002-of-00008.safetensors",
615
+ "llm.model.layers.4.self_attn.o_proj.lora_A.weight": "model-00002-of-00008.safetensors",
616
+ "llm.model.layers.4.self_attn.o_proj.lora_B.weight": "model-00002-of-00008.safetensors",
617
+ "llm.model.layers.4.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
618
+ "llm.model.layers.4.self_attn.q_proj.bias": "model-00002-of-00008.safetensors",
619
+ "llm.model.layers.4.self_attn.q_proj.lora_A.weight": "model-00002-of-00008.safetensors",
620
+ "llm.model.layers.4.self_attn.q_proj.lora_B.weight": "model-00002-of-00008.safetensors",
621
+ "llm.model.layers.4.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
622
+ "llm.model.layers.4.self_attn.v_proj.bias": "model-00002-of-00008.safetensors",
623
+ "llm.model.layers.4.self_attn.v_proj.lora_A.weight": "model-00002-of-00008.safetensors",
624
+ "llm.model.layers.4.self_attn.v_proj.lora_B.weight": "model-00002-of-00008.safetensors",
625
+ "llm.model.layers.4.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
626
+ "llm.model.layers.5.input_layernorm.weight": "model-00002-of-00008.safetensors",
627
+ "llm.model.layers.5.mlp.down_proj.bias": "model-00002-of-00008.safetensors",
628
+ "llm.model.layers.5.mlp.down_proj.lora_A.weight": "model-00002-of-00008.safetensors",
629
+ "llm.model.layers.5.mlp.down_proj.lora_B.weight": "model-00002-of-00008.safetensors",
630
+ "llm.model.layers.5.mlp.down_proj.weight": "model-00002-of-00008.safetensors",
631
+ "llm.model.layers.5.mlp.gate_proj.bias": "model-00002-of-00008.safetensors",
632
+ "llm.model.layers.5.mlp.gate_proj.lora_A.weight": "model-00002-of-00008.safetensors",
633
+ "llm.model.layers.5.mlp.gate_proj.lora_B.weight": "model-00002-of-00008.safetensors",
634
+ "llm.model.layers.5.mlp.gate_proj.weight": "model-00002-of-00008.safetensors",
635
+ "llm.model.layers.5.mlp.up_proj.bias": "model-00002-of-00008.safetensors",
636
+ "llm.model.layers.5.mlp.up_proj.lora_A.weight": "model-00002-of-00008.safetensors",
637
+ "llm.model.layers.5.mlp.up_proj.lora_B.weight": "model-00002-of-00008.safetensors",
638
+ "llm.model.layers.5.mlp.up_proj.weight": "model-00002-of-00008.safetensors",
639
+ "llm.model.layers.5.post_attention_layernorm.weight": "model-00002-of-00008.safetensors",
640
+ "llm.model.layers.5.self_attn.k_proj.bias": "model-00002-of-00008.safetensors",
641
+ "llm.model.layers.5.self_attn.k_proj.lora_A.weight": "model-00002-of-00008.safetensors",
642
+ "llm.model.layers.5.self_attn.k_proj.lora_B.weight": "model-00002-of-00008.safetensors",
643
+ "llm.model.layers.5.self_attn.k_proj.weight": "model-00002-of-00008.safetensors",
644
+ "llm.model.layers.5.self_attn.o_proj.bias": "model-00002-of-00008.safetensors",
645
+ "llm.model.layers.5.self_attn.o_proj.lora_A.weight": "model-00002-of-00008.safetensors",
646
+ "llm.model.layers.5.self_attn.o_proj.lora_B.weight": "model-00002-of-00008.safetensors",
647
+ "llm.model.layers.5.self_attn.o_proj.weight": "model-00002-of-00008.safetensors",
648
+ "llm.model.layers.5.self_attn.q_proj.bias": "model-00002-of-00008.safetensors",
649
+ "llm.model.layers.5.self_attn.q_proj.lora_A.weight": "model-00002-of-00008.safetensors",
650
+ "llm.model.layers.5.self_attn.q_proj.lora_B.weight": "model-00002-of-00008.safetensors",
651
+ "llm.model.layers.5.self_attn.q_proj.weight": "model-00002-of-00008.safetensors",
652
+ "llm.model.layers.5.self_attn.v_proj.bias": "model-00002-of-00008.safetensors",
653
+ "llm.model.layers.5.self_attn.v_proj.lora_A.weight": "model-00002-of-00008.safetensors",
654
+ "llm.model.layers.5.self_attn.v_proj.lora_B.weight": "model-00002-of-00008.safetensors",
655
+ "llm.model.layers.5.self_attn.v_proj.weight": "model-00002-of-00008.safetensors",
656
+ "llm.model.layers.6.input_layernorm.weight": "model-00003-of-00008.safetensors",
657
+ "llm.model.layers.6.mlp.down_proj.bias": "model-00003-of-00008.safetensors",
658
+ "llm.model.layers.6.mlp.down_proj.lora_A.weight": "model-00003-of-00008.safetensors",
659
+ "llm.model.layers.6.mlp.down_proj.lora_B.weight": "model-00003-of-00008.safetensors",
660
+ "llm.model.layers.6.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
661
+ "llm.model.layers.6.mlp.gate_proj.bias": "model-00003-of-00008.safetensors",
662
+ "llm.model.layers.6.mlp.gate_proj.lora_A.weight": "model-00003-of-00008.safetensors",
663
+ "llm.model.layers.6.mlp.gate_proj.lora_B.weight": "model-00003-of-00008.safetensors",
664
+ "llm.model.layers.6.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
665
+ "llm.model.layers.6.mlp.up_proj.bias": "model-00003-of-00008.safetensors",
666
+ "llm.model.layers.6.mlp.up_proj.lora_A.weight": "model-00003-of-00008.safetensors",
667
+ "llm.model.layers.6.mlp.up_proj.lora_B.weight": "model-00003-of-00008.safetensors",
668
+ "llm.model.layers.6.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
669
+ "llm.model.layers.6.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
670
+ "llm.model.layers.6.self_attn.k_proj.bias": "model-00003-of-00008.safetensors",
671
+ "llm.model.layers.6.self_attn.k_proj.lora_A.weight": "model-00003-of-00008.safetensors",
672
+ "llm.model.layers.6.self_attn.k_proj.lora_B.weight": "model-00003-of-00008.safetensors",
673
+ "llm.model.layers.6.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
674
+ "llm.model.layers.6.self_attn.o_proj.bias": "model-00003-of-00008.safetensors",
675
+ "llm.model.layers.6.self_attn.o_proj.lora_A.weight": "model-00003-of-00008.safetensors",
676
+ "llm.model.layers.6.self_attn.o_proj.lora_B.weight": "model-00003-of-00008.safetensors",
677
+ "llm.model.layers.6.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
678
+ "llm.model.layers.6.self_attn.q_proj.bias": "model-00003-of-00008.safetensors",
679
+ "llm.model.layers.6.self_attn.q_proj.lora_A.weight": "model-00003-of-00008.safetensors",
680
+ "llm.model.layers.6.self_attn.q_proj.lora_B.weight": "model-00003-of-00008.safetensors",
681
+ "llm.model.layers.6.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
682
+ "llm.model.layers.6.self_attn.v_proj.bias": "model-00003-of-00008.safetensors",
683
+ "llm.model.layers.6.self_attn.v_proj.lora_A.weight": "model-00003-of-00008.safetensors",
684
+ "llm.model.layers.6.self_attn.v_proj.lora_B.weight": "model-00003-of-00008.safetensors",
685
+ "llm.model.layers.6.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
686
+ "llm.model.layers.7.input_layernorm.weight": "model-00003-of-00008.safetensors",
687
+ "llm.model.layers.7.mlp.down_proj.bias": "model-00003-of-00008.safetensors",
688
+ "llm.model.layers.7.mlp.down_proj.lora_A.weight": "model-00003-of-00008.safetensors",
689
+ "llm.model.layers.7.mlp.down_proj.lora_B.weight": "model-00003-of-00008.safetensors",
690
+ "llm.model.layers.7.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
691
+ "llm.model.layers.7.mlp.gate_proj.bias": "model-00003-of-00008.safetensors",
692
+ "llm.model.layers.7.mlp.gate_proj.lora_A.weight": "model-00003-of-00008.safetensors",
693
+ "llm.model.layers.7.mlp.gate_proj.lora_B.weight": "model-00003-of-00008.safetensors",
694
+ "llm.model.layers.7.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
695
+ "llm.model.layers.7.mlp.up_proj.bias": "model-00003-of-00008.safetensors",
696
+ "llm.model.layers.7.mlp.up_proj.lora_A.weight": "model-00003-of-00008.safetensors",
697
+ "llm.model.layers.7.mlp.up_proj.lora_B.weight": "model-00003-of-00008.safetensors",
698
+ "llm.model.layers.7.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
699
+ "llm.model.layers.7.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
700
+ "llm.model.layers.7.self_attn.k_proj.bias": "model-00003-of-00008.safetensors",
701
+ "llm.model.layers.7.self_attn.k_proj.lora_A.weight": "model-00003-of-00008.safetensors",
702
+ "llm.model.layers.7.self_attn.k_proj.lora_B.weight": "model-00003-of-00008.safetensors",
703
+ "llm.model.layers.7.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
704
+ "llm.model.layers.7.self_attn.o_proj.bias": "model-00003-of-00008.safetensors",
705
+ "llm.model.layers.7.self_attn.o_proj.lora_A.weight": "model-00003-of-00008.safetensors",
706
+ "llm.model.layers.7.self_attn.o_proj.lora_B.weight": "model-00003-of-00008.safetensors",
707
+ "llm.model.layers.7.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
708
+ "llm.model.layers.7.self_attn.q_proj.bias": "model-00003-of-00008.safetensors",
709
+ "llm.model.layers.7.self_attn.q_proj.lora_A.weight": "model-00003-of-00008.safetensors",
710
+ "llm.model.layers.7.self_attn.q_proj.lora_B.weight": "model-00003-of-00008.safetensors",
711
+ "llm.model.layers.7.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
712
+ "llm.model.layers.7.self_attn.v_proj.bias": "model-00003-of-00008.safetensors",
713
+ "llm.model.layers.7.self_attn.v_proj.lora_A.weight": "model-00003-of-00008.safetensors",
714
+ "llm.model.layers.7.self_attn.v_proj.lora_B.weight": "model-00003-of-00008.safetensors",
715
+ "llm.model.layers.7.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
716
+ "llm.model.layers.8.input_layernorm.weight": "model-00003-of-00008.safetensors",
717
+ "llm.model.layers.8.mlp.down_proj.bias": "model-00003-of-00008.safetensors",
718
+ "llm.model.layers.8.mlp.down_proj.lora_A.weight": "model-00003-of-00008.safetensors",
719
+ "llm.model.layers.8.mlp.down_proj.lora_B.weight": "model-00003-of-00008.safetensors",
720
+ "llm.model.layers.8.mlp.down_proj.weight": "model-00003-of-00008.safetensors",
721
+ "llm.model.layers.8.mlp.gate_proj.bias": "model-00003-of-00008.safetensors",
722
+ "llm.model.layers.8.mlp.gate_proj.lora_A.weight": "model-00003-of-00008.safetensors",
723
+ "llm.model.layers.8.mlp.gate_proj.lora_B.weight": "model-00003-of-00008.safetensors",
724
+ "llm.model.layers.8.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
725
+ "llm.model.layers.8.mlp.up_proj.bias": "model-00003-of-00008.safetensors",
726
+ "llm.model.layers.8.mlp.up_proj.lora_A.weight": "model-00003-of-00008.safetensors",
727
+ "llm.model.layers.8.mlp.up_proj.lora_B.weight": "model-00003-of-00008.safetensors",
728
+ "llm.model.layers.8.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
729
+ "llm.model.layers.8.post_attention_layernorm.weight": "model-00003-of-00008.safetensors",
730
+ "llm.model.layers.8.self_attn.k_proj.bias": "model-00003-of-00008.safetensors",
731
+ "llm.model.layers.8.self_attn.k_proj.lora_A.weight": "model-00003-of-00008.safetensors",
732
+ "llm.model.layers.8.self_attn.k_proj.lora_B.weight": "model-00003-of-00008.safetensors",
733
+ "llm.model.layers.8.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
734
+ "llm.model.layers.8.self_attn.o_proj.bias": "model-00003-of-00008.safetensors",
735
+ "llm.model.layers.8.self_attn.o_proj.lora_A.weight": "model-00003-of-00008.safetensors",
736
+ "llm.model.layers.8.self_attn.o_proj.lora_B.weight": "model-00003-of-00008.safetensors",
737
+ "llm.model.layers.8.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
738
+ "llm.model.layers.8.self_attn.q_proj.bias": "model-00003-of-00008.safetensors",
739
+ "llm.model.layers.8.self_attn.q_proj.lora_A.weight": "model-00003-of-00008.safetensors",
740
+ "llm.model.layers.8.self_attn.q_proj.lora_B.weight": "model-00003-of-00008.safetensors",
741
+ "llm.model.layers.8.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
742
+ "llm.model.layers.8.self_attn.v_proj.bias": "model-00003-of-00008.safetensors",
743
+ "llm.model.layers.8.self_attn.v_proj.lora_A.weight": "model-00003-of-00008.safetensors",
744
+ "llm.model.layers.8.self_attn.v_proj.lora_B.weight": "model-00003-of-00008.safetensors",
745
+ "llm.model.layers.8.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
746
+ "llm.model.layers.9.input_layernorm.weight": "model-00004-of-00008.safetensors",
747
+ "llm.model.layers.9.mlp.down_proj.bias": "model-00004-of-00008.safetensors",
748
+ "llm.model.layers.9.mlp.down_proj.lora_A.weight": "model-00004-of-00008.safetensors",
749
+ "llm.model.layers.9.mlp.down_proj.lora_B.weight": "model-00004-of-00008.safetensors",
750
+ "llm.model.layers.9.mlp.down_proj.weight": "model-00004-of-00008.safetensors",
751
+ "llm.model.layers.9.mlp.gate_proj.bias": "model-00003-of-00008.safetensors",
752
+ "llm.model.layers.9.mlp.gate_proj.lora_A.weight": "model-00003-of-00008.safetensors",
753
+ "llm.model.layers.9.mlp.gate_proj.lora_B.weight": "model-00003-of-00008.safetensors",
754
+ "llm.model.layers.9.mlp.gate_proj.weight": "model-00003-of-00008.safetensors",
755
+ "llm.model.layers.9.mlp.up_proj.bias": "model-00003-of-00008.safetensors",
756
+ "llm.model.layers.9.mlp.up_proj.lora_A.weight": "model-00003-of-00008.safetensors",
757
+ "llm.model.layers.9.mlp.up_proj.lora_B.weight": "model-00003-of-00008.safetensors",
758
+ "llm.model.layers.9.mlp.up_proj.weight": "model-00003-of-00008.safetensors",
759
+ "llm.model.layers.9.post_attention_layernorm.weight": "model-00004-of-00008.safetensors",
760
+ "llm.model.layers.9.self_attn.k_proj.bias": "model-00003-of-00008.safetensors",
761
+ "llm.model.layers.9.self_attn.k_proj.lora_A.weight": "model-00003-of-00008.safetensors",
762
+ "llm.model.layers.9.self_attn.k_proj.lora_B.weight": "model-00003-of-00008.safetensors",
763
+ "llm.model.layers.9.self_attn.k_proj.weight": "model-00003-of-00008.safetensors",
764
+ "llm.model.layers.9.self_attn.o_proj.bias": "model-00003-of-00008.safetensors",
765
+ "llm.model.layers.9.self_attn.o_proj.lora_A.weight": "model-00003-of-00008.safetensors",
766
+ "llm.model.layers.9.self_attn.o_proj.lora_B.weight": "model-00003-of-00008.safetensors",
767
+ "llm.model.layers.9.self_attn.o_proj.weight": "model-00003-of-00008.safetensors",
768
+ "llm.model.layers.9.self_attn.q_proj.bias": "model-00003-of-00008.safetensors",
769
+ "llm.model.layers.9.self_attn.q_proj.lora_A.weight": "model-00003-of-00008.safetensors",
770
+ "llm.model.layers.9.self_attn.q_proj.lora_B.weight": "model-00003-of-00008.safetensors",
771
+ "llm.model.layers.9.self_attn.q_proj.weight": "model-00003-of-00008.safetensors",
772
+ "llm.model.layers.9.self_attn.v_proj.bias": "model-00003-of-00008.safetensors",
773
+ "llm.model.layers.9.self_attn.v_proj.lora_A.weight": "model-00003-of-00008.safetensors",
774
+ "llm.model.layers.9.self_attn.v_proj.lora_B.weight": "model-00003-of-00008.safetensors",
775
+ "llm.model.layers.9.self_attn.v_proj.weight": "model-00003-of-00008.safetensors",
776
+ "llm.model.norm.weight": "model-00008-of-00008.safetensors",
777
+ "vision_embedding.out_proj.weight": "model-00008-of-00008.safetensors",
778
+ "vision_embedding.patchifier.norm.weight": "model-00008-of-00008.safetensors",
779
+ "vision_embedding.patchifier.proj.bias": "model-00008-of-00008.safetensors",
780
+ "vision_embedding.patchifier.proj.weight": "model-00008-of-00008.safetensors",
781
+ "vision_embedding.pos_embed": "model-00008-of-00008.safetensors"
782
+ }
783
+ }
modeling_vora.py ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os.path as osp
2
+
3
+ import torch
4
+ import torch.distributed as dist
5
+ from transformers import (
6
+ AutoModelForCausalLM,
7
+ AutoTokenizer,
8
+ AutoConfig,
9
+ PreTrainedModel,
10
+ PretrainedConfig,
11
+ Qwen2ForCausalLM,
12
+ )
13
+
14
+ from .attention_mask import make_mask
15
+ from .configuration_vora import VoRAConfig
16
+ from .lora import apply_lora
17
+ from .vision_embedding import build_vision_embedding
18
+ from .vora_generation_utils import (
19
+ VoraGenerationMixin,
20
+ custom_prepare_4d_causal_attention_mask_with_cache_position,
21
+ )
22
+
23
+
24
+ class VoRAForCausalLM(PreTrainedModel):
25
+ config_class = VoRAConfig
26
+ _auto_class = 'AutoModelForCausalLM'
27
+ supports_gradient_checkpointing = True
28
+
29
+ def __init__(self, config: PretrainedConfig = VoRAConfig()):
30
+ super().__init__(config)
31
+ self.config = config
32
+ # -------------- Setup LLM ---------------------
33
+ self.llm = Qwen2ForCausalLM(config)
34
+
35
+ # monkey patch for generation
36
+ self.llm.__class__ = type(self.llm.__class__.__name__, (self.llm.__class__, VoraGenerationMixin), {})
37
+ self.llm.model._prepare_4d_causal_attention_mask_with_cache_position = staticmethod(custom_prepare_4d_causal_attention_mask_with_cache_position)
38
+ dtype = self.llm.dtype
39
+
40
+ # hacking for multi-processor infer
41
+ self._tp_plan = self.llm._tp_plan
42
+
43
+ self.config.update(self.llm.config.to_dict())
44
+ # ----------------------------------------------
45
+
46
+
47
+ # -------------- Setup LoRA -------------------
48
+ if config.lora:
49
+ for _, param in self.llm.named_parameters():
50
+ param.requires_grad = False
51
+ apply_lora(self.llm, config.lora)
52
+ self.llm.to(dtype)
53
+ # ----------------------------------------------
54
+
55
+ # ------------ Setup Vision Embedding ----------
56
+ self.vision_embedding = build_vision_embedding(config, self.llm.config.hidden_size)
57
+ # ----------------------------------------------
58
+
59
+ def _encode_vision(self, images, n_frames):
60
+ # TODO: we need a more elegant way here to deal with mixed image and pure text training
61
+ if images.size(0) > 0:
62
+ vision_embeds = self.vision_embedding(images)
63
+ else:
64
+ # FIXME: hacking for deepspeed training
65
+ # we feed a dummy image tensor (1, 3, H, W) into vision_encoder when training a pure-text batch
66
+ images = images.new_zeros((1, *images.shape[1:]))
67
+ vision_embeds = self.vision_embedding(images)[0:0]
68
+ vision_embeds = vision_embeds.split(n_frames, dim=0)
69
+ attention_mask = [torch.ones(feature.size()[:-1], dtype=torch.long).to(feature.device) for feature in vision_embeds]
70
+ vision_targets = [torch.ones(feature.size(), dtype=torch.long).to(feature.device).fill_(-100) for feature in attention_mask]
71
+
72
+ image_shapes = images.shape[-2:]
73
+
74
+ return vision_embeds, attention_mask, vision_targets, image_shapes
75
+
76
+ def _concat_embedding(self, vision_encode_out, batch, vision_placeholder_index, left_padding=False, pad_token_id=0):
77
+ """ concat vision and text
78
+ """
79
+
80
+ vision_embeds, vision_atts, vision_targets, _ = vision_encode_out
81
+
82
+ input_embeds = []
83
+ attention_mask = []
84
+ targets = []
85
+ vision_mask = [] # only set vision embeds as 1, text as 0, for aux loss
86
+
87
+ for cur_batch_idx, cur_input_ids in enumerate(batch["input_ids"]):
88
+ cur_vision_embeds = vision_embeds[cur_batch_idx]
89
+ cur_vision_attn = vision_atts[cur_batch_idx]
90
+ cur_vision_targets = vision_targets[cur_batch_idx]
91
+ cur_attn_masks = batch["attention_mask"][cur_batch_idx]
92
+
93
+ image_token_indices = torch.where(cur_input_ids == vision_placeholder_index)[0]
94
+ cur_image_num = len(image_token_indices)
95
+ image_token_indices = list(image_token_indices) + [cur_input_ids.shape[0]]
96
+
97
+ cur_input_embeds = []
98
+ cur_attention_mask = []
99
+ cur_target = []
100
+ cur_vision_mask = []
101
+
102
+ # convert text before 1st <image> to embedding
103
+ image_token_index = image_token_indices[0]
104
+
105
+ cur_input_embeds.append(
106
+ self.llm.get_input_embeddings()(cur_input_ids[:image_token_index]),
107
+ )
108
+ cur_attention_mask.append(
109
+ cur_attn_masks[:image_token_index],
110
+ )
111
+ cur_vision_mask.append(
112
+ torch.zeros_like(cur_attn_masks[:image_token_index]).to(cur_attn_masks.device),
113
+ )
114
+ if "labels" in batch:
115
+ cur_target.append(
116
+ batch["labels"][cur_batch_idx, :image_token_index],
117
+ )
118
+
119
+ if batch.get("vison_placeholder_mode", 0) == 1:
120
+ assert cur_image_num <= 1, "multiple video input is not supported"
121
+ cur_vision_embeds = cur_vision_embeds.unsqueeze(0)
122
+ cur_vision_attn = cur_vision_attn.unsqueeze(0)
123
+ cur_vision_targets = cur_vision_targets.unsqueeze(0)
124
+ assert cur_image_num == len(cur_vision_embeds), \
125
+ f"Size mismatch! cur_image_num: {cur_image_num}, len(cur_vision_embeds): {len(cur_vision_embeds)} {len(cur_vision_embeds)} \
126
+ in {batch['prompt'][cur_batch_idx]} & {batch['gt'][cur_batch_idx]} & {batch['input_ids'][cur_batch_idx]}"
127
+ # convert each <image> xxx group into embedding
128
+ text_embedding = self.llm.get_input_embeddings()(cur_input_ids.relu())
129
+ for i in range(0, cur_image_num):
130
+ image_token_index = image_token_indices[i]
131
+ cur_input_embeds.extend([
132
+ cur_vision_embeds[i],
133
+ text_embedding[image_token_index+1:image_token_indices[i+1]]
134
+ ])
135
+ cur_attention_mask.extend([
136
+ cur_vision_attn[i],
137
+ cur_attn_masks[image_token_index+1:image_token_indices[i+1]]
138
+ ])
139
+ cur_vision_mask.extend([
140
+ torch.ones_like(cur_vision_attn[i]).to(cur_vision_attn[i].device),
141
+ torch.zeros_like(cur_attn_masks[image_token_index+1:image_token_indices[i+1]]).to(cur_vision_attn[i].device),
142
+ ])
143
+ if "labels" in batch:
144
+ cur_target.extend([
145
+ cur_vision_targets[i],
146
+ batch["labels"][cur_batch_idx, image_token_index+1:image_token_indices[i+1]],
147
+ ])
148
+
149
+ input_embeds.append(torch.cat(cur_input_embeds))
150
+ attention_mask.append(torch.cat(cur_attention_mask))
151
+ vision_mask.append(torch.cat(cur_vision_mask))
152
+ if "labels" in batch:
153
+ targets.append(torch.cat(cur_target))
154
+
155
+ # padding
156
+ n_tokens = [embed.shape[0] for embed in input_embeds]
157
+
158
+ max_token = max(n_tokens)
159
+
160
+ for i in range(len(input_embeds)):
161
+ if max_token > n_tokens[i]:
162
+ pad_token = torch.tensor([pad_token_id] * (max_token - n_tokens[i]))
163
+ pad_embedding = self.llm.get_input_embeddings()(pad_token.to(batch["attention_mask"][i].device))
164
+ pad_attention = torch.zeros(pad_embedding.shape[0], dtype=torch.long).to(batch["attention_mask"][i].device)
165
+ pad_targets = torch.ones(pad_attention.size(), dtype=torch.long).to(batch["attention_mask"][i].device).fill_(-100)
166
+
167
+ if left_padding:
168
+ input_embeds[i] = torch.cat([pad_embedding, input_embeds[i]])
169
+ attention_mask[i] = torch.cat([pad_attention, attention_mask[i]])
170
+ vision_mask[i] = torch.cat([pad_attention, vision_mask[i]])
171
+ if "labels" in batch:
172
+ targets[i] = torch.cat([pad_targets, targets[i]])
173
+ else:
174
+ input_embeds[i] = torch.cat([input_embeds[i], pad_embedding])
175
+ attention_mask[i] = torch.cat([attention_mask[i], pad_attention])
176
+ vision_mask[i] = torch.cat([vision_mask[i], pad_attention])
177
+ if "labels" in batch:
178
+ targets[i] = torch.cat([targets[i], pad_targets])
179
+
180
+ inputs_embeds = torch.stack(input_embeds, dim=0).type(self.llm.dtype)
181
+ attention_mask = torch.stack(attention_mask, dim=0)
182
+ vision_mask = torch.stack(vision_mask, dim=0).to(attention_mask.device)
183
+
184
+ if len(targets) > 0:
185
+ targets = torch.stack(targets, dim=0)
186
+
187
+ attention_mask = make_mask(
188
+ attention_mask,
189
+ mode=self.config.vision_attention_mask,
190
+ vision_mask=vision_mask,
191
+ dtype=inputs_embeds.dtype
192
+ )
193
+
194
+ return inputs_embeds, attention_mask, targets, vision_mask
195
+
196
+ def generate(self, batch, **generate_params):
197
+
198
+ with torch.amp.autocast(
199
+ device_type="cuda",
200
+ enabled=(self.device != torch.device("cpu"))
201
+ ):
202
+ # get vision token
203
+ vision_placeholder_index = batch.pop("vision_placeholder_index")
204
+
205
+ # get vision features
206
+ images, n_frames = batch["frames"], batch["n_frames"]
207
+ vision_encode_out = self._encode_vision(images, n_frames)
208
+
209
+ inputs_embeds, attention_mask, _, _ = self._concat_embedding(
210
+ vision_encode_out, batch, vision_placeholder_index, left_padding=False, pad_token_id=generate_params["eos_token_id"])
211
+
212
+ outputs = self.llm.generate(
213
+ inputs_embeds=inputs_embeds,
214
+ attention_mask=attention_mask,
215
+ output_attentions=True,
216
+ **generate_params
217
+ )
218
+
219
+ return outputs
preprocessor_config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": {
3
+ "height": 448,
4
+ "width": 448
5
+ },
6
+ "do_center_crop": true,
7
+ "do_convert_rgb": true,
8
+ "do_normalize": true,
9
+ "do_rescale": true,
10
+ "do_resize": true,
11
+ "image_mean": [
12
+ 0.48145466,
13
+ 0.4578275,
14
+ 0.40821073
15
+ ],
16
+ "image_processor_type": "CLIPImageProcessor",
17
+ "image_std": [
18
+ 0.26862954,
19
+ 0.26130258,
20
+ 0.27577711
21
+ ],
22
+ "processor_class": "VoRAProcessing",
23
+ "resample": 3,
24
+ "rescale_factor": 0.00392156862745098,
25
+ "size": {
26
+ "shortest_edge": 448
27
+ }
28
+ }
processing_vora.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+
3
+ from typing import List, Union
4
+ from PIL import Image
5
+
6
+ from transformers.feature_extraction_utils import BatchFeature
7
+ from transformers.image_utils import ImageInput
8
+ from transformers.processing_utils import ProcessingKwargs, ProcessorMixin, Unpack, _validate_images_text_input_order
9
+ from transformers.tokenization_utils_base import PreTokenizedInput, TextInput
10
+
11
+ from .modeling_vora import VoRAForCausalLM
12
+
13
+
14
+ class VoRAProcessorKwargs(ProcessingKwargs, total=False):
15
+ _defaults = {
16
+ "text_kwargs": {
17
+ "padding": False,
18
+ },
19
+ "images_kwargs": {},
20
+ }
21
+
22
+
23
+ class VoRAProcesser(ProcessorMixin):
24
+ attributes = ["image_processor", "tokenizer"]
25
+ valid_kwargs = [
26
+ "chat_template",
27
+ "image_token",
28
+ ]
29
+ image_processor_class = "AutoImageProcessor"
30
+ tokenizer_class = "AutoTokenizer"
31
+
32
+ def __init__(
33
+ self,
34
+ image_processor=None,
35
+ tokenizer=None,
36
+ chat_template=None,
37
+ image_token="<image>", # set the default and let users change if they have peculiar special tokens in rare cases
38
+ image_token_index = -200,
39
+ **kwargs,
40
+ ):
41
+ self.image_token = image_token
42
+ self.image_token_index = image_token_index
43
+ super().__init__(image_processor, tokenizer, chat_template=chat_template)
44
+
45
+ def __call__(
46
+ self,
47
+ images: ImageInput = None,
48
+ text: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None,
49
+ **kwargs: Unpack[VoRAProcessorKwargs],
50
+ ):
51
+ if images is None and text is None:
52
+ raise ValueError("You have to specify at least one of `images` or `text`.")
53
+
54
+ images, text = _validate_images_text_input_order(images, text)
55
+ output_kwargs = self._merge_kwargs(
56
+ VoRAProcessorKwargs,
57
+ tokenizer_init_kwargs=self.tokenizer.init_kwargs,
58
+ **kwargs,
59
+ )
60
+
61
+ if images is not None:
62
+ images = [[self.expand2square(image[0])] for image in images]
63
+ image_inputs = self.image_processor(images, **output_kwargs["images_kwargs"])
64
+ else:
65
+ image_inputs = {}
66
+
67
+ if isinstance(text, str):
68
+ text = [text]
69
+ elif not isinstance(text, list) and not isinstance(text[0], str):
70
+ raise ValueError("Invalid input text. Please provide a string, or a list of strings")
71
+
72
+ input_ids = [self.tokenizer_vision_placeholder(t) for t in text]
73
+ attention_mask = [
74
+ [1] * len(input_ids[i]) for i in range(len(input_ids))
75
+ ]
76
+ text_inputs = dict(
77
+ input_ids=torch.as_tensor(input_ids, dtype=torch.int64),
78
+ attention_mask=torch.as_tensor(attention_mask, dtype=torch.int64),
79
+ )
80
+ image_inputs['frames'] = image_inputs.pop('pixel_values')
81
+ image_inputs['n_frames'] = [len(_images) for _images in images]
82
+ image_inputs['vision_placeholder_index'] = self.image_token_index
83
+ return BatchFeature(data={**text_inputs, **image_inputs})
84
+
85
+ def expand2square(self, pil_img: Image.Image):
86
+ background_color = (0, 0, 0)
87
+ width, height = pil_img.size
88
+ if width == height:
89
+ return pil_img
90
+ elif width > height:
91
+ result = Image.new(pil_img.mode, (width, width), background_color)
92
+ result.paste(pil_img, (0, (width - height) // 2))
93
+ return result
94
+ else:
95
+ result = Image.new(pil_img.mode, (height, height), background_color)
96
+ result.paste(pil_img, ((height - width) // 2, 0))
97
+ return result
98
+
99
+ def tokenizer_vision_placeholder(self, prompt, add_bos=False):
100
+ def join_lists(*lists, sep):
101
+ result = []
102
+ for i, lst in enumerate(lists):
103
+ if i > 0 and sep:
104
+ result.extend([sep])
105
+ result.extend(lst)
106
+ return result
107
+
108
+ prompt_chunks = [self.tokenizer.encode(
109
+ chunk) for chunk in prompt.split(self.image_token)]
110
+ input_ids = join_lists(*prompt_chunks, sep=self.image_token_index)
111
+ if add_bos:
112
+ input_ids = [self.tokenizer.bos_token_id] + input_ids
113
+
114
+ return input_ids
processor_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "image_token": "<image>",
3
+ "image_token_index": -200,
4
+ "processor_class": "VoRAProcessing",
5
+ "auto_map": {"AutoProcessor": "processing_vora.VoRAProcesser"}
6
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>"
16
+ ],
17
+ "eos_token": {
18
+ "content": "<|im_end|>",
19
+ "lstrip": false,
20
+ "normalized": false,
21
+ "rstrip": false,
22
+ "single_word": false
23
+ },
24
+ "pad_token": {
25
+ "content": "<|endoftext|>",
26
+ "lstrip": false,
27
+ "normalized": false,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ }
31
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
3
+ size 11421896
tokenizer_config.json ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ }
181
+ },
182
+ "additional_special_tokens": [
183
+ "<|im_start|>",
184
+ "<|im_end|>",
185
+ "<|object_ref_start|>",
186
+ "<|object_ref_end|>",
187
+ "<|box_start|>",
188
+ "<|box_end|>",
189
+ "<|quad_start|>",
190
+ "<|quad_end|>",
191
+ "<|vision_start|>",
192
+ "<|vision_end|>",
193
+ "<|vision_pad|>",
194
+ "<|image_pad|>",
195
+ "<|video_pad|>"
196
+ ],
197
+ "bos_token": null,
198
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
199
+ "clean_up_tokenization_spaces": false,
200
+ "eos_token": "<|im_end|>",
201
+ "errors": "replace",
202
+ "extra_special_tokens": {},
203
+ "model_max_length": 131072,
204
+ "pad_token": "<|endoftext|>",
205
+ "processor_class": "VoRAProcessing",
206
+ "split_special_tokens": false,
207
+ "tokenizer_class": "Qwen2Tokenizer",
208
+ "unk_token": null
209
+ }
vision_embedding.py ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+
4
+ from .configuration_vora import VoRAConfig
5
+
6
+
7
+ def _get_1d_sincos_pos_embed_from_grid(
8
+ embed_dim: int, pos: torch.Tensor, device: torch.device
9
+ ) -> torch.Tensor:
10
+ omega = torch.arange(embed_dim // 2).float().to(device)
11
+ omega /= embed_dim / 2.0
12
+ omega = 1.0 / 10000**omega # (D / 2,)
13
+ pos = pos.reshape(-1) # (M,)
14
+ out = pos[:, None] * omega[None, :] # (M, D / 2), outer product
15
+ emb_sin, emb_cos = torch.sin(out).to(device), torch.cos(out).to(device) # (M, D / 2)
16
+ emb = torch.cat([emb_sin, emb_cos], dim=1) # (M, D)
17
+ return emb
18
+
19
+
20
+ def get_sincos_pos_embed(h: int, w: int, embed_dim: int, device: torch.device) -> torch.Tensor:
21
+ assert embed_dim % 2 == 0, embed_dim
22
+ grid_h = torch.arange(h).float().to(device)
23
+ grid_w = torch.arange(w).float().to(device)
24
+ grid = torch.meshgrid(grid_w, grid_h, indexing="xy")
25
+ grid = torch.stack(grid, dim=0).to(device)
26
+ grid = grid.reshape([2, 1, h, w])
27
+ emb_h = _get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[0], device)
28
+ emb_w = _get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[1], device)
29
+ pos_embed = torch.cat([emb_h, emb_w], dim=1) # (H * W, D)
30
+ return pos_embed
31
+
32
+
33
+ class RMSNorm(nn.Module):
34
+ def __init__(self, dim: int, eps: float = 1e-6):
35
+ super().__init__()
36
+ self.weight = nn.Parameter(torch.ones(dim))
37
+ self.eps = eps
38
+
39
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
40
+ output = self._norm(x.float()).type_as(x)
41
+ return output * self.weight
42
+
43
+ def extra_repr(self) -> str:
44
+ return f"{tuple(self.weight.shape)}, eps={self.eps}"
45
+
46
+ def _norm(self, x: torch.Tensor) -> torch.Tensor:
47
+ return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
48
+
49
+
50
+ class VisionEmbedding(nn.Module):
51
+ def __init__(self,
52
+ config: VoRAConfig = None,
53
+ hidden_size: int = 4096,
54
+ ):
55
+ super().__init__()
56
+ self.patch_size = config.patch_size
57
+ self.proj = nn.Conv2d(
58
+ 3,
59
+ hidden_size,
60
+ kernel_size=(self.patch_size, self.patch_size),
61
+ stride=(self.patch_size, self.patch_size),
62
+ bias=True,
63
+ )
64
+ self.norm = RMSNorm(hidden_size, eps=1e-05)
65
+ self.embed_dim = hidden_size
66
+
67
+ def forward(self, pixel_values: torch.Tensor):
68
+ _, _, H, W = pixel_values.shape
69
+ tokens = self.norm(self.proj(pixel_values).flatten(2).transpose(1, 2))
70
+ pos_embed = get_sincos_pos_embed(
71
+ H // self.patch_size, W // self.patch_size, embed_dim=self.embed_dim, device=tokens.device
72
+ )
73
+ tokens = tokens + pos_embed.to(tokens.device)
74
+ return tokens
75
+
76
+
77
+ class AIMv2PatchEmbed(nn.Module):
78
+ def __init__(self, config: VoRAConfig):
79
+ super().__init__()
80
+ self.proj = nn.Conv2d(
81
+ 3,
82
+ config.vision_embedding_intermediate_size,
83
+ kernel_size=(config.patch_size, config.patch_size),
84
+ stride=(config.patch_size, config.patch_size),
85
+ )
86
+ self.norm = RMSNorm(config.vision_embedding_intermediate_size, eps=config.rms_norm_eps)
87
+
88
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
89
+ x = self.proj(x).flatten(2).transpose(1, 2)
90
+ x = self.norm(x)
91
+ return x
92
+
93
+
94
+ class AIMv2ViTPreprocessor(nn.Module):
95
+ def __init__(self,
96
+ config: VoRAConfig = None,
97
+ hidden_size: int = 4096,
98
+ ):
99
+ super().__init__()
100
+ num_patches = (config.image_size // config.patch_size) ** 2
101
+ self.config = config
102
+
103
+ self.patchifier = AIMv2PatchEmbed(config)
104
+ self.pos_embed = nn.Parameter(torch.zeros((1, num_patches, config.vision_embedding_intermediate_size)))
105
+ self.out_proj = nn.Linear(config.vision_embedding_intermediate_size, hidden_size, bias=False)
106
+
107
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
108
+ B, C, H, W = x.shape
109
+ h_token = H // self.config.patch_size
110
+ w_token = W // self.config.patch_size
111
+ tokens = self.patchifier(x)
112
+ _, N, _ = tokens.shape
113
+ pos_embed = self.pos_embed.to(tokens.device)
114
+
115
+ if N <= pos_embed.size(1):
116
+ # 如果 N 小于或等于 num_patches,直接相加
117
+ tokens = tokens + pos_embed[:, :N]
118
+ else:
119
+ # 如果 N 大于 num_patches,使用双线性插值
120
+ # 将 pos_embed 调整为 (1, num_patches, hidden_size) 的形状
121
+ pos_embed = pos_embed.view(1, int(pos_embed.size(1)**0.5), int(pos_embed.size(1)**0.5), -1).permute(0, 3, 1, 2)
122
+ # 使用双线性插值调整大小
123
+ pos_embed = F.interpolate(pos_embed, size=(h_token, w_token), mode='bilinear', align_corners=False).permute(0, 2, 3, 1)
124
+ # 重塑为 (1, N, hidden_size) 形状
125
+ pos_embed = pos_embed.view(1, N, pos_embed.size(-1))
126
+ tokens = tokens + pos_embed
127
+
128
+ return self.out_proj(tokens)
129
+
130
+
131
+ def build_vision_embedding(config: VoRAConfig, hidden_size):
132
+ if config.vision_embedding_type == "AIMv2":
133
+ return AIMv2ViTPreprocessor(config, hidden_size)
134
+ return VisionEmbedding(config, hidden_size)
vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
vora_generation_utils.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Dict, Optional
2
+
3
+ import torch
4
+ from transformers import GenerationMixin
5
+ from transformers.cache_utils import Cache
6
+ from transformers.utils import ModelOutput
7
+
8
+
9
+ class VoraGenerationMixin(GenerationMixin):
10
+
11
+ def prepare_inputs_for_generation(
12
+ self,
13
+ input_ids: torch.LongTensor,
14
+ past_key_values: Optional[Cache] = None,
15
+ attention_mask: Optional[torch.LongTensor] = None,
16
+ inputs_embeds: Optional[torch.FloatTensor] = None,
17
+ cache_position: Optional[torch.LongTensor] = None,
18
+ **kwargs,
19
+ ):
20
+ if attention_mask is not None and attention_mask.ndim == 4:
21
+ attention_mask_2d = (attention_mask[:, 0, :, :] == 0).any(dim=1).long().to(attention_mask.device)
22
+ model_input = super().prepare_inputs_for_generation(
23
+ input_ids,
24
+ past_key_values=past_key_values,
25
+ attention_mask=attention_mask_2d,
26
+ inputs_embeds=inputs_embeds,
27
+ cache_position=cache_position,
28
+ **kwargs,
29
+ )
30
+ model_input['attention_mask'] = attention_mask
31
+ return model_input
32
+ else:
33
+ return super().prepare_inputs_for_generation(
34
+ input_ids,
35
+ past_key_values=past_key_values,
36
+ attention_mask=attention_mask,
37
+ inputs_embeds=inputs_embeds,
38
+ cache_position=cache_position,
39
+ **kwargs,
40
+ )
41
+
42
+ def _update_model_kwargs_for_generation(
43
+ self,
44
+ outputs: ModelOutput,
45
+ model_kwargs: Dict[str, Any],
46
+ is_encoder_decoder: bool = False,
47
+ num_new_tokens: int = 1,
48
+ ) -> Dict[str, Any]:
49
+ if "attention_mask" in model_kwargs and model_kwargs["attention_mask"].ndim == 4:
50
+ attention_mask = model_kwargs.pop("attention_mask")
51
+ model_kwargs = super()._update_model_kwargs_for_generation(
52
+ outputs, model_kwargs, is_encoder_decoder=is_encoder_decoder, num_new_tokens=num_new_tokens
53
+ )
54
+ bs, _, seq_len, tgt_len = attention_mask.shape
55
+ dtype = attention_mask.dtype
56
+ min_dtype = torch.finfo(dtype).min
57
+ new_col = attention_mask.new_zeros((bs, 1, seq_len, 1)).fill_(min_dtype)
58
+ new_row = attention_mask.new_zeros((bs, 1, 1, tgt_len + 1))
59
+ model_kwargs["attention_mask"] = torch.cat([
60
+ torch.cat([attention_mask, new_col], dim=-1),
61
+ new_row
62
+ ], dim=2)
63
+ return model_kwargs
64
+ else:
65
+ return super()._update_model_kwargs_for_generation(
66
+ outputs, model_kwargs, is_encoder_decoder=is_encoder_decoder, num_new_tokens=num_new_tokens
67
+ )
68
+
69
+
70
+ def custom_prepare_4d_causal_attention_mask_with_cache_position(
71
+ attention_mask: torch.Tensor,
72
+ sequence_length: int,
73
+ target_length: int,
74
+ dtype: torch.dtype,
75
+ device: torch.device,
76
+ cache_position: torch.Tensor,
77
+ batch_size: int,
78
+ **kwargs,
79
+ ):
80
+ if attention_mask is not None and attention_mask.dim() == 4:
81
+ # In this case we assume that the mask comes already in inverted form and requires no inversion or slicing.
82
+ causal_mask = attention_mask[:, :, -sequence_length:, -target_length:]
83
+ else:
84
+ min_dtype = torch.finfo(dtype).min
85
+ causal_mask = torch.full(
86
+ (sequence_length, target_length), fill_value=min_dtype, dtype=dtype, device=device
87
+ )
88
+ if sequence_length != 1:
89
+ causal_mask = torch.triu(causal_mask, diagonal=1)
90
+ causal_mask *= torch.arange(target_length, device=device) > cache_position.reshape(-1, 1)
91
+ causal_mask = causal_mask[None, None, :, :].expand(batch_size, 1, -1, -1)
92
+ if attention_mask is not None:
93
+ causal_mask = causal_mask.clone() # copy to contiguous memory for in-place edit
94
+ mask_length = attention_mask.shape[-1]
95
+ padding_mask = causal_mask[:, :, :, :mask_length] + attention_mask[:, None, None, :]
96
+ padding_mask = padding_mask == 0
97
+ causal_mask[:, :, :, :mask_length] = causal_mask[:, :, :, :mask_length].masked_fill(
98
+ padding_mask, min_dtype
99
+ )
100
+
101
+ return causal_mask