From d3199ea1755e935eaa37d067840d94a4affa1394 Mon Sep 17 00:00:00 2001 From: ZX-ModelCloud Date: Sat, 21 Dec 2024 05:38:44 +0000 Subject: [PATCH] fix auto_gptq layer error device --- optimum/gptq/quantizer.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/optimum/gptq/quantizer.py b/optimum/gptq/quantizer.py index 844da3e315..24db531de6 100644 --- a/optimum/gptq/quantizer.py +++ b/optimum/gptq/quantizer.py @@ -519,8 +519,6 @@ def quantize_model(self, model: nn.Module, tokenizer: Optional[Any] = None): blocks = recurse_getattr(model, self.block_name_to_quantize) cur_layer_device = get_device(blocks[0]) - if not is_gptqmodel_available(): - cur_layer_device = 0 if not has_device_map: # put modules from module_name_preceding_first_block on cuda or xpu or cpu @@ -591,8 +589,6 @@ def store_input_hook(_, input, *args): block = block.to(0) layers = get_layers(block) block_device = get_device(block) - if not is_gptqmodel_available(): - block_device = 0 if isinstance(self.modules_in_block_to_quantize, list) and len(self.modules_in_block_to_quantize) > 0: if self.true_sequential: layers_name_list = self.modules_in_block_to_quantize