From 975f04597931b3ced250d95b04b9f0097313d317 Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Fri, 6 Sep 2024 22:48:07 -0400 Subject: [PATCH] warn if incorrect accelerate version with schedule free Co-authored-by: Aman Gupta Karmani --- src/transformers/trainer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/transformers/trainer.py b/src/transformers/trainer.py index 425cc39338e7b3..525708645c2c49 100755 --- a/src/transformers/trainer.py +++ b/src/transformers/trainer.py @@ -1498,6 +1498,8 @@ def optimizer_hook(param): "You need to install `schedulefree` in order to use schedulefree optimizers" " install it with `pip install schedulefree`" ) + if not is_accelerate_available("0.30.0"): + raise ImportError("You need to have `accelerate>=0.30.0` to be able to use schedulefree optimizers") from schedulefree import AdamWScheduleFree, SGDScheduleFree additional_optim_kwargs = {}