File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,13 @@ def __init__(
397
397
"Passing a `model_init` is incompatible with providing the `optimizers` argument. "
398
398
"You should subclass `Trainer` and override the `create_optimizer_and_scheduler` method."
399
399
)
400
+ if (self .sharded_ddp is not None or args .deepspeed ) and (
401
+ self .optimizer is not None or self .lr_scheduler is not None
402
+ ):
403
+ raise RuntimeError (
404
+ "Passing `optimizers` is not allowed if Fairscale or Deepspeed is enabled."
405
+ "You should subclass `Trainer` and override the `create_optimizer_and_scheduler` method."
406
+ )
400
407
default_callbacks = DEFAULT_CALLBACKS + get_reporting_integration_callbacks (self .args .report_to )
401
408
callbacks = default_callbacks if callbacks is None else default_callbacks + callbacks
402
409
self .callback_handler = CallbackHandler (
You can’t perform that action at this time.
0 commit comments