From 58842ded9c012a0e4af618529751a8ce1ee477cc Mon Sep 17 00:00:00 2001 From: NanoCode012 Date: Thu, 22 May 2025 18:25:45 +0700 Subject: [PATCH] chore: refactor if condition --- src/axolotl/core/trainer_builder/base.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/axolotl/core/trainer_builder/base.py b/src/axolotl/core/trainer_builder/base.py index f24453556..bd6dd0cc1 100644 --- a/src/axolotl/core/trainer_builder/base.py +++ b/src/axolotl/core/trainer_builder/base.py @@ -452,10 +452,12 @@ class TrainerBuilderBase(abc.ABC): optim_args = self.cfg.optim_args training_args_kwargs["optim_args"] = optim_args - if self.cfg.optimizer == "adamw_anyprecision": - if Path(self.cfg.torchdistx_path).exists(): - sys.path.append(self.cfg.torchdistx_path) - importlib.import_module("torchdistx") + if ( + self.cfg.optimizer == "adamw_anyprecision" + and Path(self.cfg.torchdistx_path).exists() + ): + sys.path.append(self.cfg.torchdistx_path) + importlib.import_module("torchdistx") if self.cfg.optim_target_modules: training_args_kwargs["optim_target_modules"] = self.cfg.optim_target_modules