studio: drop unused max_grad_value schema + route plumbing (#5424)

* studio: drop unused max_grad_value schema + route plumbing

The MLX worker hardcodes max_grad_value to 5.0 after PR #5340. The
schema field, frontend payload type, route forwarder, and start_training
kwarg threading were all left in place as a transitional buffer for old
clients. The field is now genuinely unused everywhere except inside the
MLX worker, so the schema, route forwarder, and config-build entries can
go. Pydantic still tolerates older clients that send max_grad_value
because TrainingStartRequest's model_config defaults to extra=ignore.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Daniel Han 2026-05-14 05:43:58 -07:00 committed by GitHub
commit 4192fe6ebe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 5 additions and 15 deletions

View file

@ -35,6 +35,7 @@ Example:
git diff --name-only origin/main..HEAD \\
| xargs python scripts/verify_comment_only_diff.py --base origin/main
"""
from __future__ import annotations
import argparse
@ -49,7 +50,9 @@ import yaml
def _git_show(rev: str, path: str) -> str:
return subprocess.check_output(
["git", "show", f"{rev}:{path}"], text = True, stderr = subprocess.DEVNULL,
["git", "show", f"{rev}:{path}"],
text = True,
stderr = subprocess.DEVNULL,
)
@ -145,8 +148,7 @@ def _walk_yaml_diff(b: Any, a: Any, prefix: str = "") -> None:
elif isinstance(b, list):
if len(b) != len(a):
print(
f" list len at {prefix or '/'}: "
f"{len(b)} -> {len(a)}",
f" list len at {prefix or '/'}: " f"{len(b)} -> {len(a)}",
)
for i, (bi, ai) in enumerate(zip(b, a)):
_walk_yaml_diff(bi, ai, f"{prefix}[{i}]")

View file

@ -215,7 +215,6 @@ class TrainingBackend:
"save_steps": kwargs.get("save_steps", 0),
"weight_decay": kwargs.get("weight_decay", 0.001),
"max_grad_norm": kwargs.get("max_grad_norm", 0.0),
"max_grad_value": kwargs.get("max_grad_value"),
"random_seed": kwargs.get("random_seed", 3407),
"packing": kwargs.get("packing", False),
"optim": kwargs.get("optim", "adamw_8bit"),

View file

@ -267,14 +267,6 @@ class TrainingStartRequest(BaseModel):
ge = 0,
description = "Global gradient norm clipping threshold. Set 0 to disable.",
)
max_grad_value: Optional[float] = Field(
None,
ge = 0,
description = (
"Elementwise gradient value clipping threshold. Set 0 to disable. "
"If omitted, MLX defaults to 1 unless max_grad_norm is set."
),
)
random_seed: int = Field(42, description = "Random seed")
packing: bool = Field(False, description = "Enable sequence packing")
optim: str = Field("adamw_8bit", description = "Optimizer")

View file

@ -216,7 +216,6 @@ async def start_training(
"save_steps": request.save_steps,
"weight_decay": request.weight_decay,
"max_grad_norm": request.max_grad_norm,
"max_grad_value": request.max_grad_value,
"random_seed": request.random_seed,
"packing": request.packing,
"optim": request.optim,

View file

@ -107,12 +107,10 @@ class TestTrainingRawSupport(unittest.TestCase):
model_name = "unsloth/test",
training_type = "LoRA/QLoRA",
max_grad_norm = 0.7,
max_grad_value = 0.0,
)
config = mock_process.call_args.kwargs["kwargs"]["config"]
self.assertEqual(config["max_grad_norm"], 0.7)
self.assertEqual(config["max_grad_value"], 0.0)
def test_training_route_forwards_embedding_learning_rate(self):
training_route = _load_route_module(