From a919f176484cd8f6732d27e4b24801f4efdcb721 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 30 Oct 2024 13:44:05 -0700 Subject: [PATCH] Update __init__.py --- unsloth/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/unsloth/__init__.py b/unsloth/__init__.py index 109e1c6d2f..23f54d213e 100644 --- a/unsloth/__init__.py +++ b/unsloth/__init__.py @@ -53,6 +53,13 @@ pass # Reduce VRAM usage by reducing fragmentation os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True" +# Hugging Face Hub faster downloads (only enable during Colab and Kaggle sessions) +keynames = "\n" + "\n".join(os.environ.keys()) +if "\nCOLAB_" in keynames or "\nKAGGLE_" in keynames: + os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1" + print("Hello") +pass + try: import torch except ModuleNotFoundError: @@ -64,12 +71,6 @@ except Exception as exception: raise exception pass -# Hugging Face Hub faster downloads (only enable during Colab and Kaggle sessions) -keynames = "\n" + "\n".join(os.environ.keys()) -if "\nCOLAB_" in keynames or "\nKAGGLE_" in keynames: - os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1" -pass - # We support Pytorch 2 # Fixes https://github.com/unslothai/unsloth/issues/38 torch_version = torch.__version__.split(".")