yalharbi commited on
Commit
7099eaa
·
verified ·
1 Parent(s): 1c04ffe

Upload VoRAForCausalLM

Browse files
README.md ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ tags: []
4
+ ---
5
+
6
+ # Model Card for Model ID
7
+
8
+ <!-- Provide a quick summary of what the model is/does. -->
9
+
10
+
11
+
12
+ ## Model Details
13
+
14
+ ### Model Description
15
+
16
+ <!-- Provide a longer summary of what this model is. -->
17
+
18
+ This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
+
20
+ - **Developed by:** [More Information Needed]
21
+ - **Funded by [optional]:** [More Information Needed]
22
+ - **Shared by [optional]:** [More Information Needed]
23
+ - **Model type:** [More Information Needed]
24
+ - **Language(s) (NLP):** [More Information Needed]
25
+ - **License:** [More Information Needed]
26
+ - **Finetuned from model [optional]:** [More Information Needed]
27
+
28
+ ### Model Sources [optional]
29
+
30
+ <!-- Provide the basic links for the model. -->
31
+
32
+ - **Repository:** [More Information Needed]
33
+ - **Paper [optional]:** [More Information Needed]
34
+ - **Demo [optional]:** [More Information Needed]
35
+
36
+ ## Uses
37
+
38
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
+
40
+ ### Direct Use
41
+
42
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
+
44
+ [More Information Needed]
45
+
46
+ ### Downstream Use [optional]
47
+
48
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
+
50
+ [More Information Needed]
51
+
52
+ ### Out-of-Scope Use
53
+
54
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
+
56
+ [More Information Needed]
57
+
58
+ ## Bias, Risks, and Limitations
59
+
60
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
+
62
+ [More Information Needed]
63
+
64
+ ### Recommendations
65
+
66
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
+
68
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
+
70
+ ## How to Get Started with the Model
71
+
72
+ Use the code below to get started with the model.
73
+
74
+ [More Information Needed]
75
+
76
+ ## Training Details
77
+
78
+ ### Training Data
79
+
80
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
+
82
+ [More Information Needed]
83
+
84
+ ### Training Procedure
85
+
86
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
+
88
+ #### Preprocessing [optional]
89
+
90
+ [More Information Needed]
91
+
92
+
93
+ #### Training Hyperparameters
94
+
95
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
+
97
+ #### Speeds, Sizes, Times [optional]
98
+
99
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
+
101
+ [More Information Needed]
102
+
103
+ ## Evaluation
104
+
105
+ <!-- This section describes the evaluation protocols and provides the results. -->
106
+
107
+ ### Testing Data, Factors & Metrics
108
+
109
+ #### Testing Data
110
+
111
+ <!-- This should link to a Dataset Card if possible. -->
112
+
113
+ [More Information Needed]
114
+
115
+ #### Factors
116
+
117
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
+
119
+ [More Information Needed]
120
+
121
+ #### Metrics
122
+
123
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
+
125
+ [More Information Needed]
126
+
127
+ ### Results
128
+
129
+ [More Information Needed]
130
+
131
+ #### Summary
132
+
133
+
134
+
135
+ ## Model Examination [optional]
136
+
137
+ <!-- Relevant interpretability work for the model goes here -->
138
+
139
+ [More Information Needed]
140
+
141
+ ## Environmental Impact
142
+
143
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
+
145
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
+
147
+ - **Hardware Type:** [More Information Needed]
148
+ - **Hours used:** [More Information Needed]
149
+ - **Cloud Provider:** [More Information Needed]
150
+ - **Compute Region:** [More Information Needed]
151
+ - **Carbon Emitted:** [More Information Needed]
152
+
153
+ ## Technical Specifications [optional]
154
+
155
+ ### Model Architecture and Objective
156
+
157
+ [More Information Needed]
158
+
159
+ ### Compute Infrastructure
160
+
161
+ [More Information Needed]
162
+
163
+ #### Hardware
164
+
165
+ [More Information Needed]
166
+
167
+ #### Software
168
+
169
+ [More Information Needed]
170
+
171
+ ## Citation [optional]
172
+
173
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
+
175
+ **BibTeX:**
176
+
177
+ [More Information Needed]
178
+
179
+ **APA:**
180
+
181
+ [More Information Needed]
182
+
183
+ ## Glossary [optional]
184
+
185
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
+
187
+ [More Information Needed]
188
+
189
+ ## More Information [optional]
190
+
191
+ [More Information Needed]
192
+
193
+ ## Model Card Authors [optional]
194
+
195
+ [More Information Needed]
196
+
197
+ ## Model Card Contact
198
+
199
+ [More Information Needed]
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")
aux_vision.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+ from transformers import CLIPVisionModel, AutoModel
4
+
5
+ from .configuration_vora import VoRAConfig
6
+
7
+
8
+ class RMSNorm(nn.Module):
9
+ def __init__(self, dim: int, eps: float = 1e-5):
10
+ super().__init__()
11
+ self.weight = nn.Parameter(torch.ones(dim))
12
+ self.eps = eps
13
+
14
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
15
+ output = self._norm(x.float()).type_as(x)
16
+ return output * self.weight
17
+
18
+ def extra_repr(self) -> str:
19
+ return f"{tuple(self.weight.shape)}, eps={self.eps}"
20
+
21
+ def _norm(self, x: torch.Tensor) -> torch.Tensor:
22
+ return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
23
+
24
+
25
+ class CosineLoss(nn.Module):
26
+ def __init__(self, reduction='mean'):
27
+ super(CosineLoss, self).__init__()
28
+ self.reduction = reduction
29
+
30
+ @staticmethod
31
+ def interpolate_tokens_2d(self, teacher_tokens, target_size):
32
+ """
33
+ Interpolate teacher tokens to the target size using bilinear interpolation.
34
+ """
35
+ # teacher_tokens shape is (batch_size, height, width, feature_dim)
36
+ teacher_tokens = teacher_tokens.permute(0, 3, 1, 2) # Convert to (batch_size, feature_dim, height, width)
37
+ interpolated = torch.nn.functional.interpolate(teacher_tokens, size=target_size, mode='bilinear', align_corners=True).flatten(2) # Flatten height and width dimensions
38
+ return interpolated.permute(0, 2, 1) # Convert back to (batch_size, new_height * new_width, feature_dim)
39
+
40
+ def forward(self, input: torch.Tensor, target: torch.Tensor, input_shape=None, target_shape=None) -> torch.Tensor:
41
+ if input_shape is not None and target_shape is not None:
42
+ input = input.reshape((input.shape[0], ) + input_shape + (-1, ))
43
+ input = self.interpolate_tokens_2d(input, target_shape)
44
+
45
+ cos_sim = nn.functional.cosine_similarity(input, target, dim=1)
46
+ loss = 1 - cos_sim
47
+
48
+ if self.reduction == 'mean':
49
+ return loss.mean()
50
+ elif self.reduction == 'sum':
51
+ return loss.sum()
52
+ else:
53
+ return loss
54
+
55
+
56
+ class AuxVision(nn.Module):
57
+ def __init__(self,
58
+ config: VoRAConfig = None,
59
+ ):
60
+ super().__init__()
61
+ self.skip_aux_cls = config.skip_aux_cls # whether to skip the cls token in ViT
62
+ # ---------------- Setup Aux Model ----------------
63
+ if 'clip' in config.aux_vision.lower():
64
+ self.aux_model = CLIPVisionModel.from_pretrained(config.aux_vision)
65
+ vision_hidden_size = self.aux_model.vision_model.config.hidden_size
66
+ num_hidden_layers = self.aux_model.vision_model.config.num_hidden_layers
67
+ else:
68
+ self.aux_model = AutoModel.from_pretrained(config.aux_vision, trust_remote_code=True)
69
+ vision_hidden_size = self.aux_model.config.hidden_size
70
+ num_hidden_layers = self.aux_model.config.num_hidden_layers
71
+ for name, param in self.aux_model.named_parameters():
72
+ param.requires_grad = False
73
+ # -------------------------------------------------
74
+
75
+ # ---------------- Setup Aux Heads ----------------
76
+ self.aux_layers = list(range(num_hidden_layers))
77
+ for layer_id in self.aux_layers:
78
+ self.add_module(f"aux_layer_{layer_id}", self.build_aux_layer(config.hidden_size, vision_hidden_size))
79
+ # -------------------------------------------------
80
+
81
+ self.loss_function = CosineLoss()
82
+ self.loss_keys = [f"loss_aux_layer_{layer_id}" for layer_id in self.aux_layers]
83
+
84
+ def build_aux_layer(self, llm_hidden_size, vit_hidden_size):
85
+ return nn.Sequential(
86
+ RMSNorm(llm_hidden_size),
87
+ nn.Linear(
88
+ llm_hidden_size,
89
+ vit_hidden_size,
90
+ bias=False,
91
+ )
92
+ )
93
+
94
+ def forward(self, frames, llm_hidden_states, vision_mask):
95
+ vision_hidden_states = self.aux_model(frames, output_hidden_states=True).hidden_states
96
+ losses = {}
97
+ for layer_idx in self.aux_layers:
98
+ aux_hidden_states = getattr(self, f"aux_layer_{layer_idx}")(llm_hidden_states[layer_idx][vision_mask == 1])
99
+ start_id = 1 if self.skip_aux_cls else 0
100
+ aux_loss = self.loss_function(vision_hidden_states[layer_idx][:, start_id:].reshape(aux_hidden_states.shape), aux_hidden_states)
101
+ losses[f"loss_aux_layer_{layer_idx}"] = aux_loss
102
+ return losses
config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": "Qwen/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
+ "pretrained": "/root/.cache/huggingface/hub/models--Hon-Wong--VoRA-7B-Instruct/snapshots/6598d808aebd0bac624665f92b3433f2d311afd0/",
40
+ "reuse_aux_vision_embedding_layers": "",
41
+ "rms_norm_eps": 1e-06,
42
+ "rope_scaling": null,
43
+ "rope_theta": 1000000.0,
44
+ "skip_aux_cls": false,
45
+ "sliding_window": 131072,
46
+ "tie_word_embeddings": false,
47
+ "torch_dtype": "float32",
48
+ "transformers_version": "4.50.3",
49
+ "use_cache": true,
50
+ "use_sliding_window": false,
51
+ "vision_attention_mask": "bidirectional",
52
+ "vision_embedding": "AIMv2Embedding",
53
+ "vision_embedding_intermediate_size": 1536,
54
+ "vocab_size": 152064
55
+ }
configuration_vora.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ skip_aux_cls: bool = False,
17
+ reuse_aux_vision_embedding_layers: str = "",
18
+ lora: dict = {},
19
+ image_size: int = 448,
20
+ vision_embedding: str = "AIMv2",
21
+ vision_embedding_intermediate_size: int = 1536,
22
+ patch_size: int = 14,
23
+ vision_attention_mask: str = "bidirectional",
24
+ rms_norm_eps: float = 1e-5,
25
+ **kwargs: Any,
26
+ ):
27
+ super().__init__(**kwargs)
28
+ self.llm = llm
29
+ self.aux_vision = aux_vision
30
+ self.skip_aux_cls = skip_aux_cls
31
+ self.reuse_aux_vision_embedding_layers = reuse_aux_vision_embedding_layers
32
+ self.lora = lora
33
+ self.image_size = image_size
34
+ self.vision_embedding = vision_embedding
35
+ self.vision_embedding_intermediate_size = vision_embedding_intermediate_size
36
+ self.patch_size = patch_size
37
+ self.vision_attention_mask = vision_attention_mask
38
+ self.rms_norm_eps = rms_norm_eps
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.05,
10
+ "temperature": 0.7,
11
+ "top_k": 20,
12
+ "top_p": 0.8,
13
+ "transformers_version": "4.50.3"
14
+ }
lora.py ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # we elimate lora_alpha here bc we find it unnecessary in VoRA
29
+ if r < 0:
30
+ self.forward = self.naive_forward
31
+ else:
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
+
46
+ def _get_submodules(self, key):
47
+ parent = self.get_submodule(".".join(key.split(".")[:-1]))
48
+ target_name = key.split(".")[-1]
49
+ target = self.get_submodule(key)
50
+ return parent, target, target_name
51
+
52
+
53
+ def _find_and_replace(self, lora_params):
54
+ target_modules = lora_params["target_modules"]
55
+
56
+ for llm_module_name in target_modules:
57
+ parent, target, target_name = self._get_submodules(llm_module_name)
58
+ bias = target.bias is not None
59
+ vora_layer = LoRALayer(
60
+ target.in_features,
61
+ target.out_features,
62
+ bias=bias,
63
+ **lora_params
64
+ )
65
+ self._replace_module(parent, target_name, vora_layer, target)
66
+
67
+
68
+ def _replace_module(self, parent_module, child_name, new_module, old_module):
69
+ setattr(parent_module, child_name, new_module)
70
+ new_module.weight = old_module.weight
71
+ if old_module.bias is not None:
72
+ new_module.bias = old_module.bias
73
+ if getattr(old_module, "state", None) is not None:
74
+ new_module.state = old_module.state
75
+ new_module.to(old_module.weight.device)
76
+
77
+
78
+ def apply_lora(llm, lora_params={"layers": "all", "r": 1024, "target_modules": QWEN2_TARGET_MODULES}):
79
+ llm_num_layers = llm.config.num_hidden_layers
80
+ total_layers = lora_params.get("layers", "all")
81
+
82
+ # -------------------- validation check ---------------------
83
+ if isinstance(total_layers, str):
84
+ if total_layers.lower() == "all":
85
+ total_layers = list(range(llm_num_layers))
86
+ else:
87
+ assert isinstance(total_layers, int), "total_layers must be an integer or 'all'"
88
+ total_layers = list(range(total_layers))
89
+ # -------------------- validation check ---------------------
90
+
91
+ # -------------------- replace llm layers ---------------------
92
+ for i in total_layers:
93
+ llm_layer = llm.model.layers[i]
94
+ llm_layer._get_submodules = types.MethodType(_get_submodules, llm_layer)
95
+ llm_layer._find_and_replace = types.MethodType(_find_and_replace, llm_layer)
96
+ llm_layer._replace_module = types.MethodType(_replace_module, llm_layer)
97
+ llm_layer._find_and_replace(lora_params)
98
+
99
+
100
+ if __name__ == "__main__":
101
+ from transformers import LlamaForCausalLM, CLIPVisionModel, AutoModel
102
+ llama = LlamaForCausalLM.from_pretrained("/mnt/bn/wh-data/data/models/llama2_7b_hf_chat")
103
+ apply_lora(llama)
104
+ print(llama)
model-00001-of-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd23c14b1d5b7707a7c23e91f62bd2f8f6889e1886d8d2ad4777be1ba72cd05b
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:601430b3763dfacfbcce9291ad7672caf4d780231f1d52a631314332762f27dd
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:f431425f27f62b81874df6c0447ebb053ee36099700dd9c9d1390640a770c6cc
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:c0c72caac26378342d5f6544ec444b55ff2bc5f971e1ec1df98306b57dc18dfc
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:3f227aa97c65250b736bfd9ea5cc3bcf1db287fa2bcbd79b7d110f6368bb56df
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:1bd0654e7c43092c37905ffecbb1d70b9e69b8d6c5e305784e4a817120912036
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:9ecdf1c467318ad0f64632a60543ab6f6c3201acaa04199f305c8a5fba99e67f
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:a9d44433adb6162ce553ba38efa185a0a952a947b5ec74ac1c4dfe3cb124e2c8
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,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.distributed as dist
3
+ from transformers import (
4
+ AutoModelForCausalLM,
5
+ AutoTokenizer,
6
+ PreTrainedModel,
7
+ PretrainedConfig,
8
+ )
9
+
10
+ from .attention_mask import make_mask
11
+ from .configuration_vora import VoRAConfig
12
+ from .vision_embedding import * # hacking, let transformers find vision_embedding
13
+ from . import vision_embedding as VB
14
+ from .lora import apply_lora
15
+ from .vora_generation_utils import (
16
+ VoraGenerationMixin,
17
+ custom_prepare_4d_causal_attention_mask_with_cache_position,
18
+ )
19
+
20
+ try:
21
+ from utils import logging
22
+ except:
23
+ from transformers.utils import logging
24
+
25
+
26
+ logger = logging.get_logger(__name__)
27
+
28
+
29
+ class VoRAForCausalLM(PreTrainedModel):
30
+ config_class = VoRAConfig
31
+ _auto_class = 'AutoModelForCausalLM'
32
+ supports_gradient_checkpointing = True
33
+ supports_report_metrics: bool = True
34
+
35
+ def __init__(self, config: PretrainedConfig = VoRAConfig()):
36
+ super().__init__(config)
37
+ self.config = config
38
+ # -------------- Setup LLM ---------------------
39
+ self.llm = AutoModelForCausalLM.from_pretrained(config.llm)
40
+ self.tokenizer = AutoTokenizer.from_pretrained(config.llm)
41
+ self.llm.__class__ = type(self.llm.__class__.__name__, (self.llm.__class__, VoraGenerationMixin), {})
42
+ self.llm.model._prepare_4d_causal_attention_mask_with_cache_position = staticmethod(custom_prepare_4d_causal_attention_mask_with_cache_position)
43
+
44
+ self.config.update(self.llm.config.to_dict())
45
+
46
+ # -------------- Setup LoRA -------------------
47
+ if config.lora:
48
+ for _, param in self.llm.named_parameters():
49
+ param.requires_grad = False
50
+ apply_lora(self.llm, config.lora)
51
+ # ----------------------------------------------
52
+
53
+ # ------------ Setup Vision Embedding ----------
54
+ self.vision_embedding = getattr(VB, config.vision_embedding)(self.config) # setup after llm so that we know the hiddensize
55
+ # ----------------------------------------------
56
+
57
+ # ------------- Setup Aux Vision ---------------
58
+ self.enable_aux_vision = False
59
+ if config.aux_vision:
60
+ from .aux_vision import AuxVision
61
+ self.enable_aux_vision = True
62
+ self.aux_vision = AuxVision(self.config)
63
+ if config.reuse_aux_vision_embedding_layers:
64
+ weights = getattr(self.aux_vision.aux_model, config.reuse_aux_vision_embedding_layers).state_dict()
65
+ msg = self.vision_embedding.load_state_dict(weights, strict=False)
66
+ logger.info(f"Loaded aux vision weights: {msg}")
67
+ # ----------------------------------------------
68
+ # print trainable prameters and total parameters so that we can check if we are loading the correct model
69
+ #logger.info("Trainable parameters:")
70
+ print("Trainable parameters:")
71
+ for name, param in self.named_parameters():
72
+ if param.requires_grad:
73
+ print(f"{name}: {param.numel()}")
74
+ print(f"Total parameters: {sum(p.numel() for p in self.parameters())}")
75
+
76
+ def detach_and_gather_loss(self, loss, dtype, device):
77
+ if not dist.is_initialized():
78
+ return loss.item()
79
+ gathered_loss = [torch.tensor(0.0, dtype=loss.dtype).to(device) for _ in range(dist.get_world_size())]
80
+ dist.all_gather(gathered_loss, loss.detach().clone())
81
+ avg_gathered_loss = torch.mean(torch.stack(gathered_loss))
82
+ return avg_gathered_loss.item()
83
+
84
+ def _encode_vision(self, images, n_frames):
85
+ # TODO: we need a more elegant way here to deal with mixed image and pure text training
86
+ if images.size(0) > 0:
87
+ vision_embeds = self.vision_embedding(images)
88
+ else:
89
+ # FIXME: hacking for deepspeed training
90
+ # we feed a dummy image tensor (1, 3, H, W) into vision_encoder when training a pure-text batch
91
+ images = images.new_zeros((1, *images.shape[1:]))
92
+ vision_embeds = self.vision_embedding(images)[0:0]
93
+ vision_embeds = vision_embeds.split(n_frames, dim=0)
94
+ attention_mask = [torch.ones(feature.size()[:-1], dtype=torch.long).to(feature.device) for feature in vision_embeds]
95
+ vision_targets = [torch.ones(feature.size(), dtype=torch.long).to(feature.device).fill_(-100) for feature in attention_mask]
96
+
97
+ image_shapes = images.shape[-2:]
98
+
99
+ return vision_embeds, attention_mask, vision_targets, image_shapes
100
+
101
+ def _concat_embedding(self, vision_encode_out, batch, vision_placeholder_index, left_padding=False):
102
+ """ concat vision and text
103
+ """
104
+
105
+ vision_embeds, vision_atts, vision_targets, _ = vision_encode_out
106
+
107
+ input_embeds = []
108
+ attention_mask = []
109
+ targets = []
110
+ vision_mask = [] # set vision token as 1, text token as 0
111
+
112
+ for cur_batch_idx, cur_input_ids in enumerate(batch["input_ids"]):
113
+ cur_vision_embeds = vision_embeds[cur_batch_idx]
114
+ cur_vision_attn = vision_atts[cur_batch_idx]
115
+ cur_vision_targets = vision_targets[cur_batch_idx]
116
+ cur_attn_masks = batch["attention_mask"][cur_batch_idx]
117
+
118
+ image_token_indices = torch.where(cur_input_ids == vision_placeholder_index)[0]
119
+ cur_image_num = len(image_token_indices)
120
+ image_token_indices = list(image_token_indices) + [cur_input_ids.shape[0]]
121
+
122
+ cur_input_embeds = []
123
+ cur_attention_mask = []
124
+ cur_target = []
125
+ cur_vision_mask = []
126
+
127
+ # convert text before 1st <image> to embedding
128
+ image_token_index = image_token_indices[0]
129
+
130
+ cur_input_embeds.append(
131
+ self.llm.get_input_embeddings()(cur_input_ids[:image_token_index]),
132
+ )
133
+ cur_attention_mask.append(
134
+ cur_attn_masks[:image_token_index],
135
+ )
136
+ cur_vision_mask.append(
137
+ torch.zeros_like(cur_attn_masks[:image_token_index]).to(cur_attn_masks.device),
138
+ )
139
+ if "labels" in batch:
140
+ cur_target.append(
141
+ batch["labels"][cur_batch_idx, :image_token_index],
142
+ )
143
+
144
+ if batch.get("vison_placeholder_mode", 0) == 1:
145
+ assert cur_image_num <= 1, "multiple video input is not supported"
146
+ cur_vision_embeds = cur_vision_embeds.unsqueeze(0)
147
+ cur_vision_attn = cur_vision_attn.unsqueeze(0)
148
+ cur_vision_targets = cur_vision_targets.unsqueeze(0)
149
+ assert cur_image_num == len(cur_vision_embeds), \
150
+ f"Size mismatch! cur_image_num: {cur_image_num}, len(cur_vision_embeds): {len(cur_vision_embeds)} {len(cur_vision_embeds)} \
151
+ in {batch['prompt'][cur_batch_idx]} & {batch['gt'][cur_batch_idx]} & {batch['input_ids'][cur_batch_idx]}"
152
+ # convert each <image> xxx group into embedding
153
+ text_embedding = self.llm.get_input_embeddings()(cur_input_ids.relu())
154
+ for i in range(0, cur_image_num):
155
+ image_token_index = image_token_indices[i]
156
+ cur_input_embeds.extend([
157
+ cur_vision_embeds[i],
158
+ text_embedding[image_token_index+1:image_token_indices[i+1]]
159
+ ])
160
+ cur_attention_mask.extend([
161
+ cur_vision_attn[i],
162
+ cur_attn_masks[image_token_index+1:image_token_indices[i+1]]
163
+ ])
164
+ cur_vision_mask.extend([
165
+ torch.ones_like(cur_vision_attn[i]).to(cur_vision_attn[i].device),
166
+ torch.zeros_like(cur_attn_masks[image_token_index+1:image_token_indices[i+1]]).to(cur_vision_attn[i].device),
167
+ ])
168
+ if "labels" in batch:
169
+ cur_target.extend([
170
+ cur_vision_targets[i],
171
+ batch["labels"][cur_batch_idx, image_token_index+1:image_token_indices[i+1]],
172
+ ])
173
+
174
+ input_embeds.append(torch.cat(cur_input_embeds))
175
+ attention_mask.append(torch.cat(cur_attention_mask))
176
+ vision_mask.append(torch.cat(cur_vision_mask))
177
+ if "labels" in batch:
178
+ targets.append(torch.cat(cur_target))
179
+
180
+ # padding
181
+ n_tokens = [embed.shape[0] for embed in input_embeds]
182
+
183
+ max_token = max(n_tokens)
184
+
185
+ for i in range(len(input_embeds)):
186
+ if max_token > n_tokens[i]:
187
+ self.pad_id = self.tokenizer.pad_token_id or self.tokenizer.eos_token_id
188
+ pad_token = torch.tensor([self.pad_id] * (max_token - n_tokens[i]))
189
+ pad_embedding = self.llm.get_input_embeddings()(pad_token.to(batch["attention_mask"][i].device))
190
+ pad_attention = torch.zeros(pad_embedding.shape[0], dtype=torch.long).to(batch["attention_mask"][i].device)
191
+ pad_targets = torch.ones(pad_attention.size(), dtype=torch.long).to(batch["attention_mask"][i].device).fill_(-100)
192
+
193
+ if left_padding:
194
+ input_embeds[i] = torch.cat([pad_embedding, input_embeds[i]])
195
+ attention_mask[i] = torch.cat([pad_attention, attention_mask[i]])
196
+ vision_mask[i] = torch.cat([pad_attention, vision_mask[i]])
197
+ if "labels" in batch:
198
+ targets[i] = torch.cat([pad_targets, targets[i]])
199
+ else:
200
+ input_embeds[i] = torch.cat([input_embeds[i], pad_embedding])
201
+ attention_mask[i] = torch.cat([attention_mask[i], pad_attention])
202
+ vision_mask[i] = torch.cat([vision_mask[i], pad_attention])
203
+ if "labels" in batch:
204
+ targets[i] = torch.cat([targets[i], pad_targets])
205
+
206
+ inputs_embeds = torch.stack(input_embeds, dim=0).type(self.llm.dtype)
207
+ attention_mask = torch.stack(attention_mask, dim=0)
208
+ vision_mask = torch.stack(vision_mask, dim=0).to(attention_mask.device)
209
+
210
+ if len(targets) > 0:
211
+ targets = torch.stack(targets, dim=0)
212
+
213
+ attention_mask = make_mask(
214
+ attention_mask,
215
+ mode=self.config.vision_attention_mask,
216
+ vision_mask=vision_mask,
217
+ dtype=inputs_embeds.dtype
218
+ )
219
+
220
+ return inputs_embeds, attention_mask, targets, vision_mask
221
+
222
+ def forward(self, **batch):
223
+ # -------------- Vision/Text Embedding ----------
224
+ vision_placeholder_index = batch.pop("vision_placeholder_index")
225
+ images, n_frames = batch["frames"], batch["n_frames"]
226
+ vision_encode_out = self._encode_vision(images, n_frames)
227
+ inputs_embeds, attention_mask, targets, vision_mask = self._concat_embedding(
228
+ vision_encode_out, batch, vision_placeholder_index)
229
+ # -----------------------------------------------
230
+
231
+ outputs = self.llm(
232
+ inputs_embeds=inputs_embeds,
233
+ attention_mask=attention_mask,
234
+ labels=targets,
235
+ return_dict=True,
236
+ output_hidden_states=True,
237
+ )
238
+
239
+ llm_loss = outputs.loss
240
+ device = llm_loss.device
241
+ dtype = llm_loss.dtype
242
+
243
+ metrics = {}
244
+
245
+ metrics["llm_loss"] = self.detach_and_gather_loss(llm_loss, dtype, device)
246
+ if self.enable_aux_vision:
247
+ if images.size(0) > 0:
248
+ aux_losses = self.aux_vision(images, outputs.hidden_states, vision_mask)
249
+ else:
250
+ # FIXME: hacking for deepspeed training
251
+ aux_losses = {key: torch.tensor(0., dtype=dtype).to(device) for key in self.aux_vision.loss_keys}
252
+
253
+ aux_loss = torch.tensor(0., dtype=dtype).to(device)
254
+ n_aux = 0
255
+ for _aux_key, _aux_loss in aux_losses.items():
256
+ aux_loss += _aux_loss
257
+ n_aux += 1
258
+ metrics[_aux_key] = self.detach_and_gather_loss(_aux_loss, dtype, device)
259
+ aux_loss /= n_aux
260
+
261
+ outputs.loss = aux_loss + llm_loss
262
+ metrics["total_loss"] = self.detach_and_gather_loss(outputs.loss, dtype, device)
263
+ self.report_metrics(**metrics)
264
+
265
+ return outputs
266
+
267
+ def generate(self, batch, **generate_params):
268
+
269
+ with torch.amp.autocast(
270
+ enabled=(self.device != torch.device("cpu")),
271
+ device_type=self.device.type,
272
+ ):
273
+ # get vision token
274
+ vision_placeholder_index = batch.pop("vision_placeholder_index")
275
+
276
+ # get vision features
277
+ images, n_frames = batch["frames"], batch["n_frames"]
278
+ vision_encode_out = self._encode_vision(images, n_frames)
279
+
280
+ inputs_embeds, attention_mask, _, _ = self._concat_embedding(
281
+ vision_encode_out, batch, vision_placeholder_index, left_padding=False)
282
+
283
+ outputs = self.llm.generate(
284
+ inputs_embeds=inputs_embeds,
285
+ attention_mask=attention_mask,
286
+ output_attentions=True,
287
+ **generate_params
288
+ )
289
+
290
+ return outputs
vision_embedding.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+
4
+ from .configuration_vora import VoRAConfig
5
+
6
+
7
+ class RMSNorm(nn.Module):
8
+ def __init__(self, dim: int, eps: float = 1e-6):
9
+ super().__init__()
10
+ self.weight = nn.Parameter(torch.ones(dim))
11
+ self.eps = eps
12
+
13
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
14
+ output = self._norm(x.float()).type_as(x)
15
+ return output * self.weight
16
+
17
+ def extra_repr(self) -> str:
18
+ return f"{tuple(self.weight.shape)}, eps={self.eps}"
19
+
20
+ def _norm(self, x: torch.Tensor) -> torch.Tensor:
21
+ return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)
22
+
23
+
24
+ class AIMv2PatchEmbed(nn.Module):
25
+ def __init__(self, config: VoRAConfig):
26
+ super().__init__()
27
+ self.proj = nn.Conv2d(
28
+ 3,
29
+ config.vision_embedding_intermediate_size,
30
+ kernel_size=(config.patch_size, config.patch_size),
31
+ stride=(config.patch_size, config.patch_size),
32
+ )
33
+ self.norm = RMSNorm(config.vision_embedding_intermediate_size, eps=config.rms_norm_eps)
34
+
35
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
36
+ x = self.proj(x).flatten(2).transpose(1, 2)
37
+ x = self.norm(x)
38
+ return x
39
+
40
+
41
+ class AIMv2Embedding(nn.Module):
42
+ def __init__(self,
43
+ config: VoRAConfig = None,
44
+ ):
45
+ super().__init__()
46
+ hidden_size = config.hidden_size
47
+ num_patches = (config.image_size // config.patch_size) ** 2
48
+ self.config = config
49
+
50
+ self.patchifier = AIMv2PatchEmbed(config)
51
+ self.pos_embed = nn.Parameter(torch.zeros((1, num_patches, config.vision_embedding_intermediate_size)))
52
+ self.out_proj = nn.Linear(config.vision_embedding_intermediate_size, hidden_size, bias=False)
53
+
54
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
55
+ B, C, H, W = x.shape
56
+ h_token = H // self.config.patch_size
57
+ w_token = W // self.config.patch_size
58
+ tokens = self.patchifier(x)
59
+ _, N, _ = tokens.shape
60
+ pos_embed = self.pos_embed.to(tokens.device)
61
+
62
+ if N <= pos_embed.size(1):
63
+ tokens = tokens + pos_embed[:, :N]
64
+ else:
65
+ 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)
66
+ pos_embed = nn.functional.interpolate(pos_embed, size=(h_token, w_token), mode='bilinear', align_corners=False).permute(0, 2, 3, 1)
67
+ pos_embed = pos_embed.view(1, N, pos_embed.size(-1))
68
+ tokens = tokens + pos_embed
69
+
70
+ return self.out_proj(tokens)
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