From 064b20e38ad1340a212d92e0b4526bc0f4c1743d Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Mon, 22 Jan 2024 22:49:01 -0500 Subject: [PATCH] handle edge case w logging --- src/axolotl/train.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/axolotl/train.py b/src/axolotl/train.py index 79b8802345..5fb873edd9 100644 --- a/src/axolotl/train.py +++ b/src/axolotl/train.py @@ -47,10 +47,14 @@ def train( *, cfg: DictDefault, cli_args: TrainerCliArgs, dataset_meta: TrainDatasetMeta ) -> Tuple[Union[PeftModel, PreTrainedModel], PreTrainedTokenizer]: # load the tokenizer first - LOG.debug( - f"loading tokenizer... {cfg.tokenizer_config or cfg.base_model_config}", - main_process_only=True, - ) + try: + LOG.debug( + f"loading tokenizer... {cfg.tokenizer_config or cfg.base_model_config}", + main_process_only=True, + ) + except RuntimeError: + # sometimes Accelerator() needs to be called un-necessarily before using logging + pass tokenizer = load_tokenizer(cfg) train_dataset = dataset_meta.train_dataset