orchard
orchard
¶
Orchard ML: type-Safe Deep Learning for Reproducible Research.
Top-level convenience API re-exporting the most commonly used components
from subpackages, so users and the orchard CLI can write:
from orchard import Config, RootOrchestrator, get_model
LogStyle
¶
Unified logging style constants for consistent visual hierarchy.
Provides separators, symbols, indentation, and ANSI color codes used
by all logging modules. Placed here (in paths.constants) rather
than in logger.styles so that low-level packages (environment,
config) can reference the constants without triggering circular
imports.
RootOrchestrator(cfg, infra_manager=None, reporter=None, time_tracker=None, audit_saver=None, log_initializer=None, seed_setter=None, thread_applier=None, system_configurator=None, static_dir_setup=None, device_resolver=None, rank=None, local_rank=None)
¶
Central coordinator for ML experiment lifecycle management.
Orchestrates the complete initialization sequence from configuration validation through resource provisioning to execution readiness. Implements a 7-phase initialization protocol (phases 1-6 eager, phase 7 deferred) with dependency injection for maximum testability.
The orchestrator follows the Single Responsibility Principle by delegating specialized tasks to injected dependencies while maintaining overall coordination. Uses the Context Manager pattern to guarantee resource cleanup even during failures.
Initialization Phases:
- Determinism: Global RNG seeding (Python, NumPy, PyTorch)
- Runtime Configuration: CPU thread affinity, system libraries
- Filesystem Provisioning: Dynamic workspace creation via RunPaths
- Logging Initialization: File-based persistent logging setup
- Config Persistence: YAML manifest export for auditability
- Infrastructure Guarding: OS-level resource locks (prevents race conditions)
- Environment Reporting: Comprehensive telemetry logging
Dependency Injection:
All external dependencies are injectable with sensible defaults:
- infra_manager: OS resource management (locks, cleanup)
- reporter: Environment telemetry engine
- log_initializer: Logging setup strategy
- seed_setter: RNG seeding function
- thread_applier: CPU thread configuration
- system_configurator: System library setup (matplotlib, etc)
- static_dir_setup: Static directory creation
- audit_saver: Config YAML + requirements snapshot persistence
- device_resolver: Hardware device detection
Attributes:
| Name | Type | Description |
|---|---|---|
cfg |
Config
|
Validated global configuration (Single Source of Truth) |
rank |
int
|
Global rank of this process (0 in single-process mode) |
local_rank |
int
|
Node-local rank for GPU assignment (0 in single-process mode) |
is_main_process |
bool
|
True for rank 0, False for non-main ranks |
infra |
InfraManagerProtocol
|
Infrastructure resource manager |
reporter |
ReporterProtocol
|
Environment telemetry engine |
time_tracker |
TimeTrackerProtocol
|
Pipeline duration tracker |
paths |
RunPaths | None
|
Session-specific directory structure (None on non-main ranks) |
run_logger |
Logger | None
|
Active logger instance (None on non-main ranks) |
repro_mode |
bool
|
Strict determinism flag |
warn_only_mode |
bool
|
Warn-only mode for strict determinism |
num_workers |
int
|
DataLoader worker processes |
Example
cfg = Config.from_recipe(Path("recipes/config_mini_cnn.yaml")) with RootOrchestrator(cfg) as orch: ... device = orch.get_device() ... logger = orch.run_logger ... paths = orch.paths ... # Execute training pipeline with guaranteed cleanup
Notes:
- Thread-safe: Single-instance locking via InfrastructureManager
- Idempotent: initialize_core_services() is safe to call multiple times (subsequent calls return cached RunPaths without re-executing phases)
- Auditable: All configuration saved to YAML in workspace
- Deterministic: Reproducible experiments via strict seeding
Initializes orchestrator with dependency injection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
'Config'
|
Validated global configuration (SSOT) |
required |
infra_manager
|
InfraManagerProtocol | None
|
Infrastructure management handler (default: InfrastructureManager()) |
None
|
reporter
|
ReporterProtocol | None
|
Environment reporting engine (default: Reporter()) |
None
|
time_tracker
|
TimeTrackerProtocol | None
|
Pipeline duration tracker (default: TimeTracker()) |
None
|
audit_saver
|
AuditSaverProtocol | None
|
Run-manifest persistence — config YAML + dependency snapshot (default: AuditSaver()) |
None
|
log_initializer
|
Callable[..., Any] | None
|
Logging setup function (default: Logger.setup) |
None
|
seed_setter
|
Callable[..., Any] | None
|
RNG seeding function (default: set_seed) |
None
|
thread_applier
|
Callable[..., Any] | None
|
CPU thread configuration (default: apply_cpu_threads) |
None
|
system_configurator
|
Callable[..., Any] | None
|
System library setup (default: configure_system_libraries) |
None
|
static_dir_setup
|
Callable[..., Any] | None
|
Static directory creation (default: setup_static_directories) |
None
|
device_resolver
|
Callable[..., Any] | None
|
Device resolution (default: to_device_obj) |
None
|
rank
|
int | None
|
Global rank of this process (default: auto-detected from RANK env var). Rank 0 executes all phases; rank N skips filesystem, logging, config persistence, infrastructure locking, and reporting. |
None
|
local_rank
|
int | None
|
Node-local rank for GPU assignment (default: auto-detected from LOCAL_RANK env var). Used by device_resolver to select the correct GPU in multi-GPU distributed setups. |
None
|
Source code in orchard/core/orchestrator.py
__enter__()
¶
Context Manager entry — triggers the initialization sequence.
Starts the pipeline timer and delegates to initialize_core_services() for phases 1-6 (seeding, runtime config, filesystem, logging, config persistence, infrastructure locking, and device resolution). Phase 7 (environment reporting) is deferred to log_environment_report().
If any phase raises (including KeyboardInterrupt / SystemExit), cleanup() is called before re-raising to ensure partial resources (locks, file handles) are released even on failure.
Returns:
| Type | Description |
|---|---|
'RootOrchestrator'
|
Fully initialized RootOrchestrator ready for pipeline execution. |
Raises:
| Type | Description |
|---|---|
BaseException
|
Re-raises any initialization error after cleanup. |
Source code in orchard/core/orchestrator.py
__exit__(exc_type, exc_val, exc_tb)
¶
Context Manager exit — stops timer and guarantees resource teardown.
Invoked automatically when leaving the with block, whether the
pipeline completed normally or raised an exception. Stops the timer,
then delegates to cleanup() for infrastructure lock release and
logging handler closure.
Error reporting is intentionally left to the caller (CLI layer), which has the user-facing context to log appropriate messages.
Returns False so that any exception propagates to the caller unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exc_type
|
type[BaseException] | None
|
Exception class if the block raised, else None. |
required |
exc_val
|
BaseException | None
|
Exception instance if the block raised, else None. |
required |
exc_tb
|
TracebackType | None
|
Traceback object if the block raised, else None. |
required |
Returns:
| Type | Description |
|---|---|
Literal[False]
|
Always False — exceptions are never suppressed. |
Source code in orchard/core/orchestrator.py
initialize_core_services()
¶
Executes linear sequence of environment initialization phases.
Synchronizes global state through phases 1-6, progressing from deterministic seeding to device resolution. Phase 7 (environment reporting) is deferred to log_environment_report().
In distributed mode (torchrun / DDP), only the main process (rank 0)
executes phases 3-6 (filesystem, logging, config persistence, infra
locking). All ranks execute phases 1-2 (seeding, threads) for
identical RNG state and thread affinity, plus device resolution
for DDP readiness (each rank binds to cuda:{local_rank}).
Idempotent: guarded by _initialized flag. If already initialized,
returns existing RunPaths without re-executing any phase. This prevents
orphaned directories (Phase 3 creates unique paths per call) and
resource leaks (Phase 6 acquires filesystem locks).
Returns:
| Type | Description |
|---|---|
RunPaths | None
|
Provisioned directory structure for rank 0, None for non-main ranks. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called after cleanup (single-use guard). |
OrchardDeviceError
|
If device resolution fails at runtime. |
Source code in orchard/core/orchestrator.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | |
log_environment_report()
¶
Emit the environment initialization report (phase 7).
Designed to be called explicitly by the CLI app after external services (e.g. MLflow tracker) have been started, so that all enter/exit log messages appear in the correct chronological order.
Source code in orchard/core/orchestrator.py
cleanup()
¶
Releases system resources and removes execution lock file.
Guarantees clean state for subsequent runs by unlinking InfrastructureManager guards and closing logging handlers. Non-main ranks skip resource release (they never acquired locks or opened file-based log handlers).
Source code in orchard/core/orchestrator.py
get_device()
¶
Resolves and caches optimal computation device (CUDA/CPU/MPS).
Returns:
| Type | Description |
|---|---|
device
|
PyTorch device object for model execution |
Source code in orchard/core/orchestrator.py
TaskComponents(criterion_factory, training_step, validation_metrics, eval_pipeline, fallback_metrics, early_stopping_thresholds)
dataclass
¶
Immutable bundle of task-specific strategy implementations.
Attributes:
| Name | Type | Description |
|---|---|---|
criterion_factory |
TaskCriterionFactory
|
Builds the loss function for this task. |
training_step |
TaskTrainingStep
|
Executes the forward pass and computes training loss. |
validation_metrics |
TaskValidationMetrics
|
Computes per-epoch validation metrics. |
eval_pipeline |
TaskEvalPipeline
|
Orchestrates inference, visualization, and reporting. |
fallback_metrics |
Mapping[str, float]
|
Metrics returned when validation fails during Optuna trials. Must contain at least the monitored metric key. |
early_stopping_thresholds |
Mapping[str, float]
|
Default early-stopping thresholds per metric
name (e.g. |
OrchardConfigError
¶
Bases: OrchardError, ValueError
Configuration validation error (backward-compatible with ValueError).
OrchardDatasetError
¶
Bases: OrchardError
Dataset loading, fetching, or validation error.
OrchardDeviceError
¶
Bases: OrchardError, RuntimeError
Device resolution failed at runtime (e.g. driver crash after config validation).
OrchardError
¶
Bases: Exception
Base exception for all Orchard ML errors.
OrchardExportError
¶
Bases: OrchardError
Model export (ONNX) or checkpoint loading error.
OrchardInfrastructureError
¶
Bases: OrchardError
OS-level resource lock acquisition or release failure.
ClassificationCriterionAdapter
¶
Builds classification loss functions (CrossEntropy / Focal).
get_criterion(training, class_weights=None)
¶
Delegate to the existing criterion factory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
training
|
TrainingConfig
|
Training sub-config with criterion parameters. |
required |
class_weights
|
Tensor | None
|
Optional per-class weights for imbalanced datasets. |
None
|
Returns:
| Type | Description |
|---|---|
Module
|
Loss module (CrossEntropyLoss or FocalLoss). |
Source code in orchard/tasks/classification/criterion_adapter.py
ClassificationEvalPipelineAdapter
¶
Orchestrates classification inference, visualization, and reporting.
run_evaluation(model, test_loader, train_losses, val_metrics_history, class_names, paths, training, dataset, augmentation, evaluation, arch_name, aug_info='N/A', tracker=None)
¶
Delegate to the existing final evaluation pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
Trained model (already on target device). |
required |
test_loader
|
DataLoader[Any]
|
DataLoader for test set. |
required |
train_losses
|
list[float]
|
Training loss history per epoch. |
required |
val_metrics_history
|
list[Mapping[str, float]]
|
Validation metrics history per epoch. |
required |
class_names
|
list[str]
|
List of class label strings. |
required |
paths
|
RunPaths
|
RunPaths for artifact output. |
required |
training
|
TrainingConfig
|
Training sub-config. |
required |
dataset
|
DatasetConfig
|
Dataset sub-config. |
required |
augmentation
|
AugmentationConfig
|
Augmentation sub-config. |
required |
evaluation
|
EvaluationConfig
|
Evaluation sub-config. |
required |
arch_name
|
str
|
Architecture identifier. |
required |
aug_info
|
str
|
Augmentation description string. |
'N/A'
|
tracker
|
TrackerProtocol | None
|
Optional experiment tracker for final metrics. |
None
|
Returns:
| Type | Description |
|---|---|
Mapping[str, float]
|
Mapping of metric names to float values. |
Source code in orchard/tasks/classification/evaluation_adapter.py
ClassificationMetricsAdapter
¶
Computes per-epoch classification metrics (loss, accuracy, AUC, F1).
compute_validation_metrics(model, val_loader, criterion, device)
¶
Delegate to the existing validation engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
Neural network model to evaluate. |
required |
val_loader
|
DataLoader[Any]
|
Validation data provider. |
required |
criterion
|
Module
|
Loss function. |
required |
device
|
device
|
Hardware target. |
required |
Returns:
| Type | Description |
|---|---|
Mapping[str, float]
|
Immutable mapping with keys: loss, accuracy, auc, f1. |
Source code in orchard/tasks/classification/metrics_adapter.py
ClassificationTrainingStepAdapter
¶
Computes classification training loss with optional MixUp blending.
compute_training_loss(model, inputs, targets, criterion, mixup_fn=None, device=None)
¶
Execute classification forward pass and compute loss.
When mixup_fn is provided, inputs and targets are blended
before the forward pass and the loss is computed as a convex
combination of the two target sets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
Neural network producing logits. |
required |
inputs
|
Any
|
Batch of input tensors. |
required |
targets
|
Any
|
Batch of target tensors. |
required |
criterion
|
Module
|
Loss function (e.g. CrossEntropyLoss). |
required |
mixup_fn
|
Callable[..., Any] | None
|
Optional MixUp augmentation callable. |
None
|
device
|
device | None
|
Target device for tensor placement. |
None
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Scalar loss tensor for backward pass. |
Source code in orchard/tasks/classification/training_step_adapter.py
DetectionCriterionAdapter
¶
Returns a no-op sentinel criterion for detection tasks.
get_criterion(training, class_weights=None)
¶
Return a sentinel criterion.
Detection models compute their own losses internally (classification
loss, box regression loss, objectness, RPN box reg). The returned
module raises RuntimeError if its forward() is ever called,
making misuse immediately visible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
training
|
TrainingConfig
|
Training sub-config (ignored for detection). |
required |
class_weights
|
Tensor | None
|
Per-class weights (ignored for detection). |
None
|
Returns:
| Type | Description |
|---|---|
Module
|
Sentinel |
Source code in orchard/tasks/detection/criterion_adapter.py
DetectionEvalPipelineAdapter
¶
Orchestrates detection inference, mAP computation, and reporting.
run_evaluation(model, test_loader, train_losses, val_metrics_history, class_names, paths, training, dataset, augmentation, evaluation, arch_name, aug_info='N/A', tracker=None)
¶
Run detection evaluation pipeline.
Computes mAP metrics on the test set, plots training loss curves, and optionally logs metrics to the experiment tracker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
Trained detection model (already on target device). |
required |
test_loader
|
DataLoader[Any]
|
DataLoader for test set. |
required |
train_losses
|
list[float]
|
Training loss history per epoch. |
required |
val_metrics_history
|
list[Mapping[str, float]]
|
Validation metrics history per epoch. |
required |
class_names
|
list[str]
|
List of class label strings. |
required |
paths
|
RunPaths
|
RunPaths for artifact output. |
required |
training
|
TrainingConfig
|
Training sub-config. |
required |
dataset
|
DatasetConfig
|
Dataset sub-config. |
required |
augmentation
|
AugmentationConfig
|
Augmentation sub-config. |
required |
evaluation
|
EvaluationConfig
|
Evaluation sub-config. |
required |
arch_name
|
str
|
Architecture identifier. |
required |
aug_info
|
str
|
Augmentation description string. |
'N/A'
|
tracker
|
TrackerProtocol | None
|
Optional experiment tracker for final metrics. |
None
|
Returns:
| Type | Description |
|---|---|
Mapping[str, float]
|
Mapping of detection metric names to float values. |
Source code in orchard/tasks/detection/evaluation_adapter.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
DetectionMetricsAdapter
¶
Computes mAP validation metrics for object detection.
compute_validation_metrics(model, val_loader, criterion, device)
¶
Run detection inference and compute mAP metrics.
Iterates the validation loader, collects predictions and targets, then computes mean Average Precision at multiple IoU thresholds.
Detection models do not produce a single validation loss in eval
mode, so "loss" is returned as 0.0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
Detection model to evaluate. |
required |
val_loader
|
DataLoader[Any]
|
Validation data provider. |
required |
criterion
|
Module
|
Ignored (detection models compute losses internally). |
required |
device
|
device
|
Hardware target for inference. |
required |
Returns:
| Type | Description |
|---|---|
Mapping[str, float]
|
Immutable mapping with keys: |
Source code in orchard/tasks/detection/metrics_adapter.py
DetectionTrainingStepAdapter
¶
Computes detection training loss by summing model-internal losses.
compute_training_loss(model, inputs, targets, criterion, mixup_fn=None, device=None)
¶
Execute detection forward pass and compute total loss.
Moves images and target dicts to device, calls the model in training mode (which returns a loss dict), and sums all loss components into a single scalar for backpropagation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Module
|
Detection model (e.g. Faster R-CNN) in training mode. |
required |
inputs
|
Any
|
List of image tensors, one per image in the batch. |
required |
targets
|
Any
|
List of target dicts, each with |
required |
criterion
|
Module
|
Ignored (detection models compute losses internally). |
required |
mixup_fn
|
Callable[..., Any] | None
|
Ignored (MixUp is not applicable to detection). |
None
|
device
|
device | None
|
Target device for tensor placement. |
None
|
Returns:
| Type | Description |
|---|---|
Tensor
|
Scalar loss tensor (sum of all loss components). |
Source code in orchard/tasks/detection/training_step_adapter.py
get_model(device, dataset_cfg, arch_cfg, verbose=True)
¶
Factory function to resolve, instantiate, and prepare architectures.
It maps configuration identifiers to specific builder functions via an internal registry. Structural parameters like input channels and class cardinality are derived from the 'effective' geometry resolved by the DatasetConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device
|
device
|
Hardware accelerator target. |
required |
dataset_cfg
|
DatasetConfig
|
Dataset sub-config with resolved metadata. |
required |
arch_cfg
|
ArchitectureConfig
|
Architecture sub-config with model selection. |
required |
verbose
|
bool
|
If True, emit builder-internal INFO logging. |
True
|
Returns:
| Type | Description |
|---|---|
Module
|
nn.Module: The instantiated model synchronized with the target device. |
Example
model = get_model(device, dataset_cfg=cfg.dataset, arch_cfg=cfg.architecture)
Raises:
| Type | Description |
|---|---|
ValueError
|
If the requested architecture is not found in the registry. |
Source code in orchard/architectures/factory.py
log_pipeline_summary(test_metrics, best_model_path, run_dir, duration, onnx_path=None, logger_instance=None)
¶
Log final pipeline completion summary.
Called at the end of the pipeline after all phases complete. Consolidates key metrics and artifact locations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_metrics
|
Mapping[str, float]
|
Task-specific test metrics mapping. |
required |
best_model_path
|
Path
|
Path to best model checkpoint |
required |
run_dir
|
Path
|
Root directory for this run |
required |
duration
|
str
|
Human-readable duration string |
required |
onnx_path
|
Path | None
|
Path to ONNX export (if performed) |
None
|
logger_instance
|
Logger | None
|
Logger instance to use (defaults to module logger) |
None
|
Source code in orchard/core/logger/progress.py
register_task(task_type, components)
¶
Register a task-specific component bundle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_type
|
str
|
Identifier matching a |
required |
components
|
TaskComponents
|
Frozen bundle of strategy implementations. |
required |
Raises:
| Type | Description |
|---|---|
OrchardConfigError
|
If |
Source code in orchard/core/task_registry.py
run_export_phase(orchestrator, checkpoint_path, cfg=None)
¶
Execute model export phase.
Exports trained model to production format (ONNX) with validation.
Export format and opset version are read from cfg.export.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orchestrator
|
RootOrchestrator
|
Active RootOrchestrator providing paths, device, logger |
required |
checkpoint_path
|
Path
|
Path to trained model checkpoint (.pth) |
required |
cfg
|
Config | None
|
Optional config override (defaults to orchestrator's config) |
None
|
Returns:
| Type | Description |
|---|---|
Path | None
|
Path to exported model, or None if export config is absent |
Example
with RootOrchestrator(cfg) as orch: ... best_path, *_ = run_training_phase(orch) ... onnx_path = run_export_phase(orch, best_path) ... print(f"Exported to: {onnx_path}")
Source code in orchard/pipeline/phases.py
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | |
run_optimization_phase(orchestrator, cfg=None, tracker=None)
¶
Execute hyperparameter optimization phase.
Runs Optuna study with configured trials, pruning, and early stopping. Generates visualizations (if enabled) and exports best configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orchestrator
|
RootOrchestrator
|
Active RootOrchestrator providing paths, device, logger |
required |
cfg
|
Config | None
|
Optional config override (defaults to orchestrator's config) |
None
|
tracker
|
TrackerProtocol | None
|
Optional experiment tracker for MLflow nested trial logging |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Study, Path | None]
|
tuple of (completed study, path to best_config.yaml or None) |
Example
with RootOrchestrator(cfg) as orch: ... study, best_config_path = run_optimization_phase(orch) ... print(f"Best AUC: {study.best_value:.4f}")
Source code in orchard/pipeline/phases.py
run_training_phase(orchestrator, cfg=None, tracker=None)
¶
Execute model training phase.
Loads dataset, initializes model, runs training with validation, and performs final evaluation on test set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orchestrator
|
RootOrchestrator
|
Active RootOrchestrator providing paths, device, logger |
required |
cfg
|
Config | None
|
Optional config override (defaults to orchestrator's config) |
None
|
tracker
|
TrackerProtocol | None
|
Optional experiment tracker for MLflow metric logging |
None
|
Returns:
| Type | Description |
|---|---|
TrainingResult
|
TrainingResult named tuple with best_model_path, train_losses, |
TrainingResult
|
val_metrics, model, test_metrics. |
Example
with RootOrchestrator(cfg) as orch: ... result = run_training_phase(orch) ... print(f"Test metrics: {result.test_metrics}")
Source code in orchard/pipeline/phases.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
create_tracker(cfg)
¶
Factory: returns MLflowTracker if tracking is configured, else NoOpTracker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Any
|
Config object. If cfg.tracking is set and enabled, returns MLflowTracker. |
required |
Returns:
| Type | Description |
|---|---|
TrackerProtocol
|
Active tracker instance. |