diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index c4cdc5b82e..82b80e2dc9 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -992,7 +992,7 @@ class FastLlamaModel: logger.warning_once(debug_info)""" debug_info = debug_info.split('\n') - debug_info = "\n".join([debug_info[0]] + [spaces + x.lstrip("\t ") for x in debug_info[1:]]) + debug_info = "\n".join([debug_info[0]] + [spaces + x[8:] for x in debug_info[1:]]) inner_training_loop = inner_training_loop.replace(original_debug, debug_info) debug_info = """n_total_devices = total_train_batch_size // \\ @@ -1006,7 +1006,7 @@ class FastLlamaModel: ) debug_info =""" debug_info = debug_info.split('\n') - debug_info = "\n".join([debug_info[0]] + [spaces + x.lstrip("\t ") for x in debug_info[1:]]) + debug_info = "\n".join([debug_info[0]] + [spaces + x[8:] for x in debug_info[1:]]) inner_training_loop = inner_training_loop.replace("debug_info =", debug_info, 1) front_spaces = re.match(r"[\t\s]{1,}", inner_training_loop).group(0) @@ -1039,7 +1039,7 @@ class FastLlamaModel: divisor = n_total_devices / 2 / 2 ga = args.gradient_accumulation_steps = max(int(ga / divisor), 1)""" check_batches = check_batches.split('\n') - check_batches = "\n".join([check_batches[0]] + [front_spaces + x.lstrip("\t ") for x in check_batches[1:]]) + check_batches = "\n".join([check_batches[0]] + [front_spaces + x[8:] for x in check_batches[1:]]) inner_training_loop = inner_training_loop.replace( "train_dataloader = self.get_train_dataloader()", check_batches, 1, diff --git a/unsloth/models/mistral.py b/unsloth/models/mistral.py index 10362a7885..ad119af146 100644 --- a/unsloth/models/mistral.py +++ b/unsloth/models/mistral.py @@ -397,7 +397,7 @@ class FastMistralModel(FastLlamaModel): logger.warning_once(debug_info)""" debug_info = debug_info.split('\n') - debug_info = "\n".join([debug_info[0]] + [spaces + x.lstrip("\t ") for x in debug_info[1:]]) + debug_info = "\n".join([debug_info[0]] + [spaces + x[8:] for x in debug_info[1:]]) inner_training_loop = inner_training_loop.replace(original_debug, debug_info) debug_info = """n_total_devices = total_train_batch_size // \\ @@ -411,7 +411,7 @@ class FastMistralModel(FastLlamaModel): ) debug_info =""" debug_info = debug_info.split('\n') - debug_info = "\n".join([debug_info[0]] + [spaces + x.lstrip("\t ") for x in debug_info[1:]]) + debug_info = "\n".join([debug_info[0]] + [spaces + x[8:] for x in debug_info[1:]]) inner_training_loop = inner_training_loop.replace("debug_info =", debug_info, 1) front_spaces = re.match(r"[\t\s]{1,}", inner_training_loop).group(0) @@ -444,7 +444,7 @@ class FastMistralModel(FastLlamaModel): divisor = n_total_devices / 2 / 2 ga = args.gradient_accumulation_steps = max(int(ga / divisor), 1)""" check_batches = check_batches.split('\n') - check_batches = "\n".join([check_batches[0]] + [front_spaces + x.lstrip("\t ") for x in check_batches[1:]]) + check_batches = "\n".join([check_batches[0]] + [front_spaces + x[8:] for x in check_batches[1:]]) inner_training_loop = inner_training_loop.replace( "train_dataloader = self.get_train_dataloader()", check_batches, 1,