From 04a514953f8c5d513d5fa67535b0a13cd4bbd19c Mon Sep 17 00:00:00 2001 From: wenhuach21 Date: Tue, 4 Jun 2024 14:28:17 +0800 Subject: [PATCH] fix bug --- auto_round/autoround.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auto_round/autoround.py b/auto_round/autoround.py index 79ba17aa..5d135932 100644 --- a/auto_round/autoround.py +++ b/auto_round/autoround.py @@ -738,7 +738,7 @@ def quant_layer(self, layer_name, inputs, q_inputs=None, device=torch.device("cp mse_loss = torch.nn.MSELoss().to(device) scaler = self.get_scaler() # pylint: disable=assignment-from-none init_loss = None - best_v, best_min_scale, best_max_scale = torch.tensor(0), torch.tensor(0), torch.tensor(0) + best_v, best_min_scale, best_max_scale = torch.tensor(0), torch.tensor(1.0), torch.tensor(1.0) gradient_accumulate_steps = self.train_bs ##Force to low gpu train_bs = 1 ##Force to low gpu pick_samples = train_bs * gradient_accumulate_steps @@ -861,7 +861,7 @@ def quant_block(self, block, input_ids, input_others, q_input=None, device=torch mse_loss = torch.nn.MSELoss().to(device) scaler = self.get_scaler() # pylint: disable=assignment-from-none init_loss = None - best_v, best_min_scale, best_max_scale = torch.tensor(0), torch.tensor(0), torch.tensor(0) + best_v, best_min_scale, best_max_scale = torch.tensor(0), torch.tensor(1.0), torch.tensor(1.0) for i in range(self.iters): total_loss = 0 if self.sampler == "rand":