From b2c8573b2b075e0edd7480b76c6f87a595d2f232 Mon Sep 17 00:00:00 2001 From: taking-lying-flat <1615405@qq.com> Date: Sun, 23 Aug 2026 16:33:11 +0800 Subject: [PATCH] Reject negative gradient clipping max norm --- torchtitan/config/configs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/torchtitan/config/configs.py b/torchtitan/config/configs.py index 90c38afeaa..3f338fe217 100644 --- a/torchtitan/config/configs.py +++ b/torchtitan/config/configs.py @@ -60,6 +60,8 @@ def __post_init__(self) -> None: raise ValueError("num_tokens_per_train_step must be -1 or greater than 0.") if self.max_context_length <= 0: raise ValueError("max_context_length must be greater than 0.") + if self.max_norm < 0: + raise ValueError("max_norm must be greater than or equal to 0.") max_norm: float | int = 1.0 """Max norm for gradient clipping"""