chore: refactor if condition

This commit is contained in:
NanoCode012
2025-05-22 18:25:45 +07:00
parent 2e2f42918d
commit 58842ded9c

View File

@@ -452,10 +452,12 @@ class TrainerBuilderBase(abc.ABC):
optim_args = self.cfg.optim_args optim_args = self.cfg.optim_args
training_args_kwargs["optim_args"] = optim_args training_args_kwargs["optim_args"] = optim_args
if self.cfg.optimizer == "adamw_anyprecision": if (
if Path(self.cfg.torchdistx_path).exists(): self.cfg.optimizer == "adamw_anyprecision"
sys.path.append(self.cfg.torchdistx_path) and Path(self.cfg.torchdistx_path).exists()
importlib.import_module("torchdistx") ):
sys.path.append(self.cfg.torchdistx_path)
importlib.import_module("torchdistx")
if self.cfg.optim_target_modules: if self.cfg.optim_target_modules:
training_args_kwargs["optim_target_modules"] = self.cfg.optim_target_modules training_args_kwargs["optim_target_modules"] = self.cfg.optim_target_modules