From 946a46a61864016b9184e336fec99bf874dfc2d6 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 25 Nov 2024 22:52:57 -0800 Subject: [PATCH] Update _utils.py --- unsloth/models/_utils.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 775be91fe5..fbb68b38f4 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -1187,12 +1187,12 @@ pass EMPTY_LOGITS = EmptyLogits() functions = dir(torch.Tensor) for j, function in enumerate(functions): - if function.endswith("_") and len(function) > 2 and function[-2] != "_": - print() - try: exec(f"EMPTY_LOGITS.{function} = warn_logits_error", globals(), locals()) - except: continue - else: - exec(f"def raise_{j}(*args, **kwargs): print('{function}')", globals(), locals()) - try: exec(f"EMPTY_LOGITS.{function} = raise_{j}", globals(), locals()) - except: continue + # if function.endswith("_") and len(function) > 2 and function[-2] != "_": + # print() + # try: exec(f"EMPTY_LOGITS.{function} = warn_logits_error", globals(), locals()) + # except: continue + # else: + exec(f"def raise_{j}(*args, **kwargs): print('{function}')", globals(), locals()) + try: exec(f"EMPTY_LOGITS.{function} = raise_{j}", globals(), locals()) + except: continue pass