[Misc] Fixes (#4015)

* convert print to logger

* Print but cleaner

* Hide model on multiple devices

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix typo

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix typo transfomers -> transformers, revert MoE message change

* Update MoE detection message to show num_experts and target_modules

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Hanchen <danielhanchen@users.noreply.github.com>
This commit is contained in:
Datta Nimmaturi 2026-02-10 15:38:55 +05:30 committed by GitHub
commit 3df65308f3

View file

@ -530,6 +530,15 @@ class RaiseUninitialized:
transformers_logger.removeHandler(self.error_handler)
try:
from transformers.trainer import logger as transformers_trainer_logger
transformers_trainer_logger.addFilter(
HideLoggingMessage("The model is already on multiple devices.")
)
except:
pass
# Patch get_model_param_count to record correct 4bit / 8bit
from transformers.trainer_pt_utils import is_deepspeed_zero3_enabled
@ -2625,7 +2634,7 @@ def get_moe_target_parameters(model, target_modules = None) -> Optional[List[str
if moe_params:
print(
f"Unsloth: Detected MoE model with {num_experts} experts - enabling LoRA on: {moe_params}"
f"Unsloth: Detected MoE model with {num_experts = } and {target_modules = }. Enabling LoRA on MoE parameters: {moe_params}"
)
return moe_params