Load the weight from the state dictionary. Args: state_dict (dict): A dictionary containing the weights
(self, state_dict: dict)
| 209 | self.quant_method.process_prequanted_weights(self, state_dict) |
| 210 | |
| 211 | def load_weight(self, state_dict: dict): |
| 212 | """ |
| 213 | Load the weight from the state dictionary. |
| 214 | |
| 215 | Args: |
| 216 | state_dict (dict): A dictionary containing the weights |
| 217 | """ |
| 218 | if "qkv_a_proj_with_mqa" in self.weight_key: |
| 219 | self.weight_key_q = self.weight_key.replace("qkv_a_proj_with_mqa", "q_a_proj") |
| 220 | self.weight_key_kv = self.weight_key.replace("qkv_a_proj_with_mqa", "kv_a_proj_with_mqa") |
| 221 | q_weight_tensor = get_tensor(state_dict.pop(self.weight_key_q)) |
| 222 | kv_weight_tensor = get_tensor(state_dict.pop(self.weight_key_kv)) |
| 223 | weight_tensor = paddle.concat([q_weight_tensor, kv_weight_tensor], axis=-1) |
| 224 | else: |
| 225 | weight_tensor = get_tensor(state_dict.pop(self.weight_key)) |
| 226 | self.quant_method.process_loaded_weights(self, weight_tensor) |
| 227 | |
| 228 | def load_state_dict(self, state_dict: dict): |
| 229 | """ |
no test coverage detected