[ci] pin ruff version and fix lint errors (#10681)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-07-24 16:29:58 +08:00
committed by GitHub
parent 3f77101580
commit 2ebe7be611
10 changed files with 30 additions and 21 deletions

View File

@@ -294,9 +294,7 @@ class BaseTrainer:
# mp_shard=world); a separate CP reduce would over-count by sqrt(cp_size).
total_norm = total_norm.full_tensor()
# pass a Tensor: clip_grads_with_norm_ clamps max_norm / (total_norm + 1e-6).
torch.nn.utils.clip_grads_with_norm_(
self.model.parameters(), self.args.max_grad_norm, total_norm
)
torch.nn.utils.clip_grads_with_norm_(self.model.parameters(), self.args.max_grad_norm, total_norm)
grad_norm = total_norm.item()
if not torch.isfinite(torch.tensor(grad_norm)): # type: ignore # pyright: ignore [reportUnknownReturnType]

View File

@@ -19,6 +19,7 @@ from typing import TYPE_CHECKING
from ....utils import logging
from ....utils.plugin import BasePlugin
if TYPE_CHECKING:
from ....config.arg_utils import PluginConfig
from ....utils.types import HFModel