Skip to content

Commit

Permalink
Make logger only log on rank0 for Phi3 loading errors (#1599)
Browse files Browse the repository at this point in the history
  • Loading branch information
joecummings authored and ebsmothers committed Sep 17, 2024
1 parent 43478f5 commit 325c7b7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions torchtune/training/checkpointing/_checkpointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
safe_torch_load,
save_config,
)
from torchtune.utils import get_logger
from torchtune.utils._logging import get_logger, log_rank_zero

logger = get_logger("DEBUG")

Expand Down Expand Up @@ -436,9 +436,10 @@ def load_checkpoint(self) -> Dict[str, Any]:
del state_dict
gc.collect()
if self._model_type == ModelType.PHI3_MINI:
logger.warning(
"Converting Phi-3 Mini weights from HF format."
"Note that conversion of adapter weights into PEFT format is not supported."
log_rank_zero(
logger=logger,
msg="Converting Phi-3 Mini weights from HF format."
"Note that conversion of adapter weights into PEFT format is not supported.",
)
converted_state_dict[training.MODEL_KEY] = phi3_hf_to_tune(
merged_state_dict
Expand Down

0 comments on commit 325c7b7

Please sign in to comment.