From dde8b367a486bc089266bb528fcb59dd4ca0c2f9 Mon Sep 17 00:00:00 2001 From: Lars Bogner Date: Fri, 24 Jul 2026 13:17:58 +0200 Subject: [PATCH] style: apply ruff format to cli.py and test_condor_gpu.py Pre-existing formatting drift, unrelated to any functional change. --- giant/cli.py | 36 ++++++++++++------------------------ tests/test_condor_gpu.py | 7 ++++++- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/giant/cli.py b/giant/cli.py index 211d612..6d8c163 100644 --- a/giant/cli.py +++ b/giant/cli.py @@ -543,14 +543,10 @@ def new_run( conditioning: Annotated[ Optional[Conditioning], typer.Option("--conditioning") ] = None, - router: Annotated[ - Optional[bool], typer.Option("--router/--no-router") - ] = None, + router: Annotated[Optional[bool], typer.Option("--router/--no-router")] = None, router_type: Annotated[Optional[str], typer.Option("--router-type")] = None, n_experts: Annotated[Optional[int], typer.Option("--n-experts")] = None, - router_axis: Annotated[ - Optional[list[str]], typer.Option("--router-axis") - ] = None, + router_axis: Annotated[Optional[list[str]], typer.Option("--router-axis")] = None, out: Annotated[ Optional[Path], typer.Option("--out", "-o", help="Run dir (default: auto from hyperparams)"), @@ -619,7 +615,9 @@ def new_run( if cli_router: cli_model["router"] = cli_router - cfg = gconfig.merge_cli_overrides(gconfig.DEFAULT_CONFIG, config, cli_train, cli_model) + cfg = gconfig.merge_cli_overrides( + gconfig.DEFAULT_CONFIG, config, cli_train, cli_model + ) run_dir = (out or gconfig.default_out_dir(cfg)).resolve() if not force: @@ -1460,14 +1458,10 @@ def train_submit( request_gpus: Annotated[int, typer.Option("--request-gpus")] = 1, gpu_type: Annotated[ Optional[str], - typer.Option( - "--gpu-type", help='Pin GPU model, e.g. "Tesla V100-PCIE-32GB"' - ), + typer.Option("--gpu-type", help='Pin GPU model, e.g. "Tesla V100-PCIE-32GB"'), ] = None, gpu_memory_mb: Annotated[Optional[int], typer.Option("--gpu-memory-mb")] = None, - request_memory: Annotated[ - int, typer.Option("--request-memory", help="MB") - ] = 16384, + request_memory: Annotated[int, typer.Option("--request-memory", help="MB")] = 16384, request_walltime: Annotated[ int, typer.Option("--request-walltime", help="Seconds (default: 2 days)") ] = 172800, @@ -1615,7 +1609,8 @@ def rollout_submit( ), ] = 10, weights: Annotated[ - Weights, typer.Option("--weights", help="raw or ema (see `giant rollout --help`)") + Weights, + typer.Option("--weights", help="raw or ema (see `giant rollout --help`)"), ] = Weights.raw, batch_size: Annotated[ int, typer.Option("--batch-size", "-b", help="Tracks stepped per model forward") @@ -1647,14 +1642,10 @@ def rollout_submit( request_gpus: Annotated[int, typer.Option("--request-gpus")] = 1, gpu_type: Annotated[ Optional[str], - typer.Option( - "--gpu-type", help='Pin GPU model, e.g. "Tesla V100-PCIE-32GB"' - ), + typer.Option("--gpu-type", help='Pin GPU model, e.g. "Tesla V100-PCIE-32GB"'), ] = None, gpu_memory_mb: Annotated[Optional[int], typer.Option("--gpu-memory-mb")] = None, - request_memory: Annotated[ - int, typer.Option("--request-memory", help="MB") - ] = 16384, + request_memory: Annotated[int, typer.Option("--request-memory", help="MB")] = 16384, request_walltime: Annotated[ int, typer.Option("--request-walltime", help="Seconds (default: 2 days)") ] = 172800, @@ -1722,10 +1713,7 @@ def rollout_submit( command = f"uv run giant rollout {q(str(data_path))} " + " ".join(flags) wrapper_body = ( - "#!/bin/bash\n" - "set -euo pipefail\n" - f"cd {q(str(repo_path))}\n" - f"exec {command}\n" + f"#!/bin/bash\nset -euo pipefail\ncd {q(str(repo_path))}\nexec {command}\n" ) submit_cfg = GpuSubmitConfig( diff --git a/tests/test_condor_gpu.py b/tests/test_condor_gpu.py index bbe898e..792fdf4 100644 --- a/tests/test_condor_gpu.py +++ b/tests/test_condor_gpu.py @@ -8,7 +8,12 @@ from typer.testing import CliRunner from giant import config as gconfig from giant.cli import app -from giant.condor import CondorJobMeta, GpuSubmitConfig, parse_cluster_id, write_gpu_submit +from giant.condor import ( + CondorJobMeta, + GpuSubmitConfig, + parse_cluster_id, + write_gpu_submit, +) runner = CliRunner()