| 44 | else: |
| 45 | dst[i] = src[i] |
| 46 | class HackLinearNF4(LinearNF4): |
| 47 | def _load_from_state_dict(self, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs): |
| 48 | if prefix + 'weight' in state_dict: |
| 49 | self.weight.data.copy_(state_dict[prefix+'weight']) |
| 50 | if self.weight.data.dtype == torch.uint8: |
| 51 | copy_nested_list(state_dict[prefix+'quant_state'], self.weight.quant_state) |
| 52 | if prefix + 'bias' in state_dict: |
| 53 | self.bias.data.copy_(state_dict[prefix+'bias']) |
| 54 | def _save_to_state_dict(self, destination, prefix, keep_vars): |
| 55 | super()._save_to_state_dict(destination, prefix, keep_vars) |
| 56 | destination[prefix+'quant_state'] = self.weight.quant_state |
| 57 | except Exception as exception: |
| 58 | print_all("Failed to load bitsandbytes:" + str(exception), level='WARNING') |
| 59 |
no outgoing calls
no test coverage detected