8000 Trainer: the call timeout and hard budget stop setup and finalize by Tong-bit-art · Pull Request #53 · Infini-AI-Lab/hermit · GitHub
[go: up one dir, main page]

Skip to content

Trainer: the call timeout and hard budget stop setup and finalize - #53

Open
Tong-bit-art wants to merge 1 commit into
Infini-AI-Lab:mainfrom
Tong-bit-art:trainer-cancel-setup-finalize
Open

Tong-bit-art wants to merge 1 commit into
Infini-AI-Lab:mainfrom
Tong-bit-art:trainer-cancel-setup-finalize

Conversation

@Tong-bit-art
Copy link
Copy Markdown

Change

The step call's context carried the Trainer's cancel event, so its tools refused further calls and started programs stopped once trainer.call_timeout_min or the hard budget was reached. The setup and finalize calls built their context without the event, so the timeout and the budget set an event nothing read: a setup or finalize that never returned hung the run past call_timeout_min and past the budget, with no summary and nothing to resume from (a restart re-enters the same call).

Both calls now build their context from the same cancel event the watchdog sets, as _call's comment and the Context.cancel field already describe. No contract changes; the documented call_timeout_min guarantee — "the time, in minutes, the Trainer allows each Evolver call (setup, a step, finalize)" (docs/recipes/officeqa.md) — now holds for all three call kinds.

Validation

  • New tests/test_training.py::test_call_timeout_stops_the_setup: a setup that polls ctx.cancel ends at call_timeout_min instead of hanging the run. The call runs in a subprocess, because while the timeout could not reach the context, this test would hang rather than fail.
    • With the change: passes in ~14 s.
    • With the change reverted: fails after 90 s with "the run hung: the setup call ignored trainer.call_timeout_min".
  • python -m pytest tests/test_training.py tests/test_spec.py tests/test_deploy.py: 38 passed. The 2 test_spec.py failures (test_exports_are_learnable_and_restored_when_they_do_not_parse, test_adapter_md_may_be_removed) reproduce identically on unmodified main in this environment (a sandboxed check subprocess cannot import jsonschema under this venv layout) and are unrelated to this change.
  • Offline walkthrough (hermit check, hermit train, hermit eval --adapter final on docs/_examples/first_training/run.yaml): passes, mean_score: 1.0.
  • Platform: Linux (WSL Ubuntu, Python 3.14.4). No sandbox-specific behavior touched; no model credentials or benchmark runs needed.

Review

  • Tests and documentation cover the affected behavior, where applicable.
  • Commands, defaults, and public interfaces are consistent.
  • Shared logs and examples contain no credentials or private data.

The step call's context carried the Trainer's cancel event, so tools refused
further calls and started programs stopped once the call_timeout_min or the
hard budget was reached. The setup and finalize calls built their context
without the event, so the timeout and the budget set an event nothing read:
a setup or finalize that never returned hung the run past call_timeout_min
and past the budget, with no summary and nothing to resume from.

Both calls now build their context from the same cancel event the watchdog
sets, as _call's comment and the Context.cancel field already describe; the
docs' call_timeout_min guarantee ("each Evolver call (setup, a step,
finalize)") now holds for all three call kinds.

A regression test runs the Trainer in a subprocess: a setup that polls
ctx.cancel ends at call_timeout_min instead of hanging the run.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0