[CI][RFC] Replace black-jupyter with ruff-format (#37210)
Co-authored-by: Alison Shao <a.shao@wustl.edu>
This commit is contained in:
co-authored by
Alison Shao
parent
2641e427be
commit
28262c20df
@@ -473,8 +473,7 @@ class TestFormatComparisonRichMinimal:
|
||||
assert_rich_tags_balanced(result)
|
||||
|
||||
assert result == (
|
||||
"[red]❌[/] [bold red]hidden_states [/] "
|
||||
"rel_diff=5.00e-01"
|
||||
"[red]❌[/] [bold red]hidden_states [/] rel_diff=5.00e-01"
|
||||
)
|
||||
|
||||
def test_shape_mismatch(self) -> None:
|
||||
@@ -1046,7 +1045,7 @@ class TestFormatAbsDiffPercentilesRich:
|
||||
result: str = _format_abs_diff_percentiles_rich(diff)
|
||||
|
||||
assert result == (
|
||||
"p1=1.00e-04 p5=1.00e-04 p50=2.00e-04 " "p95=4.00e-04 p99=5.00e-04"
|
||||
"p1=1.00e-04 p5=1.00e-04 p50=2.00e-04 p95=4.00e-04 p99=5.00e-04"
|
||||
)
|
||||
|
||||
def test_high_p99_coloring(self) -> None:
|
||||
@@ -1123,7 +1122,7 @@ class TestFormatReplicatedChecks:
|
||||
result: str = format_replicated_checks(checks)
|
||||
|
||||
assert result == (
|
||||
"Replicated checks:\n" " ✅ axis=tp group=0 idx=1 vs 0: n/a diff"
|
||||
"Replicated checks:\n ✅ axis=tp group=0 idx=1 vs 0: n/a diff"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -3299,9 +3299,9 @@ def _create_thd_cp_zigzag_dumps(
|
||||
# Dump each rank
|
||||
for cp_rank in range(cp_size):
|
||||
rank_tensor: torch.Tensor = torch.cat(rank_segments[cp_rank], dim=0)
|
||||
assert (
|
||||
rank_tensor.shape[0] == total_per_rank
|
||||
), f"rank {cp_rank}: expected {total_per_rank} tokens, got {rank_tensor.shape[0]}"
|
||||
assert rank_tensor.shape[0] == total_per_rank, (
|
||||
f"rank {cp_rank}: expected {total_per_rank} tokens, got {rank_tensor.shape[0]}"
|
||||
)
|
||||
|
||||
_create_rank_dump(
|
||||
directory,
|
||||
@@ -4008,11 +4008,13 @@ class TestEntrypointMetaOverride:
|
||||
baseline_path, target_path = self._create_single_rank_pair(tmp_path)
|
||||
|
||||
yaml_path: Path = tmp_path / "override.yaml"
|
||||
yaml_path.write_text(textwrap.dedent("""\
|
||||
yaml_path.write_text(
|
||||
textwrap.dedent("""\
|
||||
overrides:
|
||||
- match: "hidden"
|
||||
dims: "t h"
|
||||
"""))
|
||||
""")
|
||||
)
|
||||
|
||||
argv = _make_argv(
|
||||
baseline_path,
|
||||
@@ -4148,13 +4150,15 @@ class TestEntrypointMetaOverride:
|
||||
baseline_path, target_path = self._create_single_rank_pair(tmp_path)
|
||||
|
||||
yaml_path: Path = tmp_path / "override.yaml"
|
||||
yaml_path.write_text(textwrap.dedent("""\
|
||||
yaml_path.write_text(
|
||||
textwrap.dedent("""\
|
||||
overrides:
|
||||
- match: "hidden"
|
||||
dims: "t h"
|
||||
- match: "hidden"
|
||||
dims: "a b"
|
||||
"""))
|
||||
""")
|
||||
)
|
||||
|
||||
argv = _make_argv(
|
||||
baseline_path,
|
||||
@@ -4169,11 +4173,13 @@ class TestEntrypointMetaOverride:
|
||||
baseline_path, target_path = self._create_single_rank_pair(tmp_path)
|
||||
|
||||
yaml_path: Path = tmp_path / "override.yaml"
|
||||
yaml_path.write_text(textwrap.dedent("""\
|
||||
yaml_path.write_text(
|
||||
textwrap.dedent("""\
|
||||
overrides:
|
||||
- match: "hidden"
|
||||
dims: "a b"
|
||||
"""))
|
||||
""")
|
||||
)
|
||||
|
||||
argv = _make_argv(
|
||||
baseline_path,
|
||||
|
||||
@@ -194,11 +194,13 @@ class TestFromArgsAndConfig:
|
||||
def test_cli_before_yaml(self, tmp_path: Path) -> None:
|
||||
"""CLI rules are ordered before YAML rules (CLI wins on conflict)."""
|
||||
yaml_path = tmp_path / "override.yaml"
|
||||
yaml_path.write_text(textwrap.dedent("""\
|
||||
yaml_path.write_text(
|
||||
textwrap.dedent("""\
|
||||
overrides:
|
||||
- match: "hidden"
|
||||
dims: "FROM_YAML"
|
||||
"""))
|
||||
""")
|
||||
)
|
||||
|
||||
overrider = MetaOverrider.from_args_and_config(
|
||||
override_dims=["hidden:FROM_CLI"],
|
||||
@@ -256,14 +258,16 @@ class TestLoadYamlRules:
|
||||
def test_valid_yaml(self, tmp_path: Path) -> None:
|
||||
"""Valid YAML with override rules loads correctly."""
|
||||
yaml_path = tmp_path / "override.yaml"
|
||||
yaml_path.write_text(textwrap.dedent("""\
|
||||
yaml_path.write_text(
|
||||
textwrap.dedent("""\
|
||||
overrides:
|
||||
- match: "hidden"
|
||||
dims: "b s h d"
|
||||
- match: "logits"
|
||||
dims: "b s v[tp]"
|
||||
side: baseline
|
||||
"""))
|
||||
""")
|
||||
)
|
||||
rules = _load_yaml_rules(yaml_path)
|
||||
assert len(rules) == 2
|
||||
assert rules[0].dims == "b s h d"
|
||||
|
||||
@@ -591,9 +591,7 @@ class TestFormatAlignerPlan:
|
||||
)
|
||||
result: str = _format_aligner_plan(_wrap_plan(plan))
|
||||
|
||||
assert result == (
|
||||
"Aligner Plan:\n" " baseline: (no steps)\n" " target: (no steps)"
|
||||
)
|
||||
assert result == ("Aligner Plan:\n baseline: (no steps)\n target: (no steps)")
|
||||
|
||||
def test_unsharder(self) -> None:
|
||||
unsharder: UnsharderPlan = UnsharderPlan(
|
||||
@@ -614,9 +612,7 @@ class TestFormatAlignerPlan:
|
||||
result: str = _format_aligner_plan(_wrap_plan(plan))
|
||||
|
||||
assert result == (
|
||||
"Aligner Plan:\n"
|
||||
" baseline: (no steps)\n"
|
||||
" target: [step=0: unsharder(tp)]"
|
||||
"Aligner Plan:\n baseline: (no steps)\n target: [step=0: unsharder(tp)]"
|
||||
)
|
||||
|
||||
def test_reorderer(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user