[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
4215035a83
commit
44c6984f73
3 changed files with 22 additions and 11 deletions
|
|
@ -77,9 +77,7 @@ def list_diffusion_runs(limit: int = 20) -> list[dict]:
|
|||
"""Summaries of persisted diffusion runs, newest first. The heavy per-run payload
|
||||
(metric logs, config) stays in the file; fetch it via ``get_diffusion_run``."""
|
||||
try:
|
||||
files = sorted(
|
||||
_runs_dir().glob("*.json"), key = lambda p: p.stat().st_mtime, reverse = True
|
||||
)
|
||||
files = sorted(_runs_dir().glob("*.json"), key = lambda p: p.stat().st_mtime, reverse = True)
|
||||
except Exception: # noqa: BLE001 -- unreadable dir -> no history
|
||||
return []
|
||||
out: list[dict] = []
|
||||
|
|
|
|||
|
|
@ -1285,7 +1285,6 @@ async def list_diffusion_training_runs(
|
|||
"""Previous diffusion training runs (terminal), newest first, from the persisted
|
||||
per-run records. Summaries only; fetch one run for its config + metric logs."""
|
||||
from core.training.diffusion_training_service import list_diffusion_runs
|
||||
|
||||
return DiffusionTrainingRunsResponse(
|
||||
runs = [DiffusionTrainingRunSummary(**r) for r in list_diffusion_runs(limit = limit)]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -670,7 +670,9 @@ def test_run_record_no_save_stop_marks_unsaved(_isolated_runs_dir):
|
|||
def _cancel_target(*, event_queue, stop_queue, config):
|
||||
event_queue.put({"type": "model_load_completed"})
|
||||
stop_queue.get(timeout = 5.0)
|
||||
event_queue.put({"type": "complete", "output_dir": None, "lora_path": None, "stopped": True})
|
||||
event_queue.put(
|
||||
{"type": "complete", "output_dir": None, "lora_path": None, "stopped": True}
|
||||
)
|
||||
|
||||
svc = DiffusionTrainingService(ctx = _FakeCtx(), target = _cancel_target)
|
||||
job_id = svc.start(dict(_CFG))
|
||||
|
|
@ -692,14 +694,26 @@ def test_runs_endpoints_list_and_detail(client, _isolated_runs_dir):
|
|||
import os
|
||||
|
||||
a = {
|
||||
"job_id": "a" * 32, "status": "completed", "adapter": "first", "saved": True,
|
||||
"step": 10, "total_steps": 10, "avg_loss": 0.4,
|
||||
"config": {"train_steps": 10}, "metric_history": {"steps": [1], "loss": [0.4], "lr": [1e-4], "grad_norm": [0.2]},
|
||||
"job_id": "a" * 32,
|
||||
"status": "completed",
|
||||
"adapter": "first",
|
||||
"saved": True,
|
||||
"step": 10,
|
||||
"total_steps": 10,
|
||||
"avg_loss": 0.4,
|
||||
"config": {"train_steps": 10},
|
||||
"metric_history": {"steps": [1], "loss": [0.4], "lr": [1e-4], "grad_norm": [0.2]},
|
||||
}
|
||||
b = {
|
||||
"job_id": "b" * 32, "status": "stopped", "adapter": "second", "saved": False,
|
||||
"step": 3, "total_steps": 10, "avg_loss": 0.6,
|
||||
"config": {"train_steps": 10}, "metric_history": {"steps": [1], "loss": [0.6], "lr": [1e-4], "grad_norm": [0.3]},
|
||||
"job_id": "b" * 32,
|
||||
"status": "stopped",
|
||||
"adapter": "second",
|
||||
"saved": False,
|
||||
"step": 3,
|
||||
"total_steps": 10,
|
||||
"avg_loss": 0.6,
|
||||
"config": {"train_steps": 10},
|
||||
"metric_history": {"steps": [1], "loss": [0.6], "lr": [1e-4], "grad_norm": [0.3]},
|
||||
}
|
||||
pa = _isolated_runs_dir / f"{a['job_id']}.json"
|
||||
pb = _isolated_runs_dir / f"{b['job_id']}.json"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue