nvalchemi.hooks.HookContext#
- class nvalchemi.hooks.HookContext(*, batch, model=None, global_rank=0, workflow=None)[source]#
Common context object passed to hooks.
HookContextcontains fields shared by all hook-enabled workflows. Workflow-specific subclasses add state that is only meaningful in that domain, such as dynamics step counts or training losses.- Parameters:
batch (Batch | None)
model (BaseModelMixin | None)
global_rank (int)
workflow (Any)
- batch#
Current batch being processed.
Noneis used for lifecycle stages that run before the first batch is available.- Type:
Batch | None
- model#
Model being used (if applicable).
- Type:
BaseModelMixin | None
- global_rank#
Distributed rank of this process.
- Type:
int
- workflow#
Back-reference to the engine running the hooks.
Nonewhen the workflow does not inject itself.- Type:
Any