diff --git a/unsloth/__init__.py b/unsloth/__init__.py index a6ea8f4c9f..1b2a9310ff 100644 --- a/unsloth/__init__.py +++ b/unsloth/__init__.py @@ -124,6 +124,8 @@ from .import_fixes import fix_xformers_performance_issue fix_xformers_performance_issue(); del fix_xformers_performance_issue; from .import_fixes import fix_vllm_aimv2_issue fix_vllm_aimv2_issue(); del fix_vllm_aimv2_issue; +from .import_fixes import ignore_logger_messages +ignore_logger_messages(); del ignore_logger_messages; # Torch 2.4 has including_emulation if DEVICE_TYPE == "cuda": diff --git a/unsloth/import_fixes.py b/unsloth/import_fixes.py index a07f9970f8..cc4f6dbfc7 100644 --- a/unsloth/import_fixes.py +++ b/unsloth/import_fixes.py @@ -117,3 +117,13 @@ def fix_vllm_aimv2_issue(): if UNSLOTH_ENABLE_LOGGING: print(f"Unsloth: Failed patching vLLM with error = {str(e)}") pass + +def ignore_logger_messages(): + # Ignore Environment variable `HF_TOKEN` is set + try: + from huggingface_hub._login.utils import logger as huggingface_hub_logger + huggingface_hub_logger.addFilter(HideLoggingMessage("`HF_TOKEN`")) + del huggingface_hub_logger + except: + pass +pass diff --git a/unsloth/models/_utils.py b/unsloth/models/_utils.py index 981ff81577..e9181c39fb 100644 --- a/unsloth/models/_utils.py +++ b/unsloth/models/_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2025.8.10" +__version__ = "2025.9.1" __all__ = [ "SUPPORTS_BFLOAT16", @@ -317,14 +317,6 @@ try: except: pass -# Environment variable `HF_TOKEN` is set -try: - from huggingface_hub._login.utils import logger as huggingface_hub_logger - huggingface_hub_logger.addFilter(HideLoggingMessage("`HF_TOKEN`")) - del huggingface_hub_logger -except: - pass - # Errors out on # Some weights of Gemma3nForConditionalGeneration were not initialized from the model checkpoint from transformers.modeling_utils import logger as transformers_logger