nnpd.core.runner ================ .. py:module:: nnpd.core.runner .. autoapi-nested-parse:: Plan first; train and cache models; analyze saved models with separate analysis settings. Attributes ---------- .. autoapisummary:: nnpd.core.runner.TRAINING_FILE nnpd.core.runner.ANALYSIS_FILE nnpd.core.runner.KEEP_SETTINGS nnpd.core.runner.STAGES Classes ------- .. autoapisummary:: nnpd.core.runner.Job Functions --------- .. autoapisummary:: nnpd.core.runner.expand_jobs nnpd.core.runner.infeasible nnpd.core.runner.check_feasible nnpd.core.runner.plan nnpd.core.runner.analyze_run nnpd.core.runner.save_references nnpd.core.runner.execute nnpd.core.runner.restore nnpd.core.runner.verify_store Module Contents --------------- .. py:data:: TRAINING_FILE :value: 'settings_training.py' .. py:data:: ANALYSIS_FILE :value: 'settings_analysis.py' .. py:data:: KEEP_SETTINGS :value: 3 .. py:data:: STAGES :value: ('train', 'run', 'analyze') .. py:class:: Job .. py:attribute:: settings :type: dict .. py:attribute:: member :type: dict .. py:attribute:: changed :type: str | None .. py:attribute:: workload :type: dict .. py:property:: id :type: str .. py:method:: as_dict() -> dict .. py:function:: expand_jobs(training_settings: dict, experiment: nnpd.core.api.Experiment, analysis_settings: dict | None = None, analysis: nnpd.core.api.Analysis | None = None) -> list[Job] Validate *every* training alternative, and the analysis of each, before anything runs. .. py:function:: infeasible(jobs: list[Job]) -> dict[str, list[str]] Configurations whose analysis would exceed the configured limits, with the reasons. .. py:function:: check_feasible(jobs: list[Job]) -> None Refuse the whole launch before anything is computed if any configuration cannot be analyzed. .. py:function:: plan(profile: str | None = None, settings_dir: str | pathlib.Path = '.') -> list[Job] What `run` would train, with each model's analysis workload; computes nothing. .. py:function:: analyze_run(context: nnpd.core.api.Context) -> dict Compute the selected metrics and plots of one run, replacing earlier ones. Never trains. .. py:function:: save_references(context: nnpd.core.api.Context) -> None .. py:function:: execute(stage: str = 'run', *, profile: str | None = None, settings_dir: str | pathlib.Path = '.') -> list[pathlib.Path] Train, analyze, or both, from the settings files in settings_dir; the CLI does the same. 'train' trains the models of settings_training.py and resets their analysis. 'analyze' analyzes the latest trained models with settings_analysis.py; it never trains. 'run' does both. 'jobs': torchrun workers process disjoint runs; 'ddp': workers train each model together and only rank zero analyzes. After success, runs of earlier settings are removed, the cache keeps what the last KEEP_SETTINGS trainings used, and the settings files are copied into the output folder. .. py:function:: restore(run_dir: str | pathlib.Path, *, device: str = 'cpu') -> nnpd.core.api.Context Open a saved run, with the analysis settings it was analyzed with, on any supported device. .. py:function:: verify_store(root: str | pathlib.Path) -> int Recompute all saved artifact checksums; raises on the first damaged file.