Add a check that warmup_setps is either 0 or >= 1 (#30764)

* Add a check that warmup_setps is either 0 or >= 1

Update training_args.py to add a check that warmup_setps is either 0 or >= 1. Otherwise, raise an error.

* Update src/transformers/training_args.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

---------

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
This commit is contained in:
Yasmin Moslem 2024-05-23 17:23:59 +01:00 committed by GitHub
parent 21339a5213
commit 892b13d3cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1797,6 +1797,9 @@ class TrainingArguments:
" during training"
)
if not isinstance(self.warmup_steps, int) or self.warmup_steps < 0 or 0 < self.warmup_steps <= 1:
raise ValueError("warmup_steps must be either 0 or > 1")
if isinstance(self.fsdp, bool):
self.fsdp = "full_shard" if self.fsdp else ""
if isinstance(self.fsdp, str):