Update loader.py

This commit is contained in:
Daniel Han 2025-03-08 03:38:22 -08:00
commit ad3b2dd7a6

View file

@ -519,9 +519,9 @@ class FastModel(FastBaseModel):
do_logging = os.environ.get("UNSLOTH_ENABLE_LOGGING", "0") == "1"
if do_logging:
redirector = contextlib.redirect_stdout(open(os.devnull, "w"))
else:
redirector = contextlib.nullcontext()
else:
redirector = contextlib.redirect_stdout(open(os.devnull, "w"))
with redirector:
patch_loss_functions(torch_compile = False)