From e51a381305cfb55339eed3d20cf9d4c31e014129 Mon Sep 17 00:00:00 2001 From: Daniel Han-Chen Date: Sun, 18 Feb 2024 19:08:04 +1100 Subject: [PATCH] globals --- unsloth/models/llama.py | 2 +- unsloth/models/mistral.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unsloth/models/llama.py b/unsloth/models/llama.py index 82b80e2dc9..2334ae58aa 100644 --- a/unsloth/models/llama.py +++ b/unsloth/models/llama.py @@ -975,7 +975,7 @@ class FastLlamaModel: if item.startswith(("deepspeed", "xm", "met", "smp")): continue if item in inner_training_loop: good_items.append(item) pass - exec("from transformers.trainer import (" + ", ".join(x for x in good_items) + ")") + exec("from transformers.trainer import (" + ", ".join(x for x in good_items) + ")", globals()) start = re.search('logger\.info\([\"\'].+?Running training', inner_training_loop).span(0)[0] end = inner_training_loop.find("\n\n", start) diff --git a/unsloth/models/mistral.py b/unsloth/models/mistral.py index ad119af146..8a54e18357 100644 --- a/unsloth/models/mistral.py +++ b/unsloth/models/mistral.py @@ -380,14 +380,14 @@ class FastMistralModel(FastLlamaModel): if item.startswith(("deepspeed", "xm", "met", "smp")): continue if item in inner_training_loop: good_items.append(item) pass - exec("from transformers.trainer import (" + ", ".join(x for x in good_items) + ")") + exec("from transformers.trainer import (" + ", ".join(x for x in good_items) + ")", globals()) start = re.search('logger\.info\([\"\'].+?Running training', inner_training_loop).span(0)[0] end = inner_training_loop.find("\n\n", start) original_debug = inner_training_loop[start:end] spaces = re.search('\n([\s\t]{1,})', original_debug).group(0)[1:] front_spaces = re.match('([\s\t]{1,})', inner_training_loop).group(0) - + debug_info = """debug_info = \\ f"==((====))== Unsloth - Free Apache OSS license | Num GPUs = {args.world_size}\\n"\\ f" \\\ /| Num examples = {num_examples:,} | Num Epochs = {num_train_epochs:,}\\n"\\