From 9940583287b3acbcbf0b6a9514023136cfbbac59 Mon Sep 17 00:00:00 2001 From: Edd <68678137+Erland366@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:04:27 +0800 Subject: [PATCH] Improve debugging experience (#1512) * Create CONTRIBUTING.md (#1472) Creating contributing guidelines * Update CONTRIBUTING.md improved sentence * Improve logging control in `unsloth_compile_transformers` by conditionally redirecting stdout based on UNSLOTH_DISABLE_LOGGER environment variable --------- Co-authored-by: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> Co-authored-by: Nino Risteski <95188570+NinoRisteski@users.noreply.github.com> --- unsloth/models/loader.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unsloth/models/loader.py b/unsloth/models/loader.py index a881146692..acfd0129b5 100644 --- a/unsloth/models/loader.py +++ b/unsloth/models/loader.py @@ -446,7 +446,9 @@ class FastVisionModel(FastBaseVisionModel): if not was_disabled: enable_progress_bars() - with contextlib.redirect_stdout(open(os.devnull, "w")): + with contextlib.redirect_stdout( + open(os.devnull, "w") if os.environ.get("UNSLOTH_DISABLE_LOGGER", "0") != "1" else sys.stdout + ): patch_loss_functions(torch_compile = False) model_types = unsloth_compile_transformers( model_name = model_name,