1 lightning.training.execution_profile
lightning.training.execution_profile
Execution and W&B-attempt policy for the Q1/QH research launchers.
The scientific recipes remain backend-independent. This module applies one explicit runtime profile at the launcher seam and records enough evidence to distinguish historical CUDA mixed precision from the commissioned Mac FP32 lane. It does not start a trainer or create a W&B run.
1.1 Classes
| Name | Description |
|---|---|
| QhExecutionProfile | One admitted single-device training backend and precision policy. |
| WandbAttempt | Explicit W&B identity for one immutable training attempt or segment. |
1.1.1 QhExecutionProfile
lightning.training.execution_profile.QhExecutionProfile(
name,
accelerator,
device_type,
precision,
expected_system,
expected_machine,
allowed_cpu_fallback_operations=(),
)One admitted single-device training backend and precision policy.
1.1.1.1 Attributes
| Name | Description |
|---|---|
| name | Stable profile identity persisted in protocol and attempt evidence. |
| accelerator | Lightning accelerator selector. |
| device_type | Torch device type required for model parameters, batches and gradients. |
| precision | Lightning precision policy; the Mac lane is strictly FP32. |
| expected_system | Operating system admitted for this profile. |
| expected_machine | Host architecture admitted for this profile. |
| allowed_cpu_fallback_operations | Reviewed MPS operations allowed to execute on CPU. |
1.1.1.2 Methods
| Name | Description |
|---|---|
| apply | Return the recipe with only backend and precision fields changed. |
| admit_runtime | Validate the real host/backend and return immutable runtime evidence. |
| autocast_context | Return the preflight precision context matching Lightning training. |
| prepare_memory_accounting | Apply the historical CUDA cap or reset available MPS counters. |
| memory_evidence | Return backend-native allocation evidence without equating semantics. |
1.1.1.2.1 apply
lightning.training.execution_profile.QhExecutionProfile.apply(config)Return the recipe with only backend and precision fields changed.
1.1.1.2.2 admit_runtime
lightning.training.execution_profile.QhExecutionProfile.admit_runtime()Validate the real host/backend and return immutable runtime evidence.
1.1.1.2.3 autocast_context
lightning.training.execution_profile.QhExecutionProfile.autocast_context()Return the preflight precision context matching Lightning training.
1.1.1.2.4 prepare_memory_accounting
lightning.training.execution_profile.QhExecutionProfile.prepare_memory_accounting(
max_allocated_bytes,
)Apply the historical CUDA cap or reset available MPS counters.
1.1.1.2.5 memory_evidence
lightning.training.execution_profile.QhExecutionProfile.memory_evidence()Return backend-native allocation evidence without equating semantics.
1.1.2 WandbAttempt
lightning.training.execution_profile.WandbAttempt(
run_id,
resume=False,
offline=False,
logical_run_id=None,
local_attempt_id=None,
)Explicit W&B identity for one immutable training attempt or segment.
1.1.2.1 Attributes
| Name | Description |
|---|---|
| run_id | Fresh online run, required online resume id, or unique offline segment id. |
| resume | Require an existing online run with exactly run_id. |
| offline | Write a locally recoverable segment without claiming cloud publication. |
| logical_run_id | Stable experiment identity linking multiple offline segments. |
| local_attempt_id | Unique immutable local segment; required when resuming an online run. |
| resolved_local_attempt_id | Return the immutable local segment id for filesystem publication. |
1.1.2.2 Methods
| Name | Description |
|---|---|
| apply | Return a config with explicit new/resume/segment W&B identity. |
| evidence | Describe intended W&B behavior without creating a remote run. |
| output_directory | Resolve a fresh local publication directory independent of W&B resume id. |
| local_writer_lock | Hold one nonblocking host-local writer lock for the logical run. |
1.1.2.2.1 apply
lightning.training.execution_profile.WandbAttempt.apply(config)Return a config with explicit new/resume/segment W&B identity.
1.1.2.2.2 evidence
lightning.training.execution_profile.WandbAttempt.evidence()Describe intended W&B behavior without creating a remote run.
1.1.2.2.3 output_directory
lightning.training.execution_profile.WandbAttempt.output_directory(
output_root,
cell,
)Resolve a fresh local publication directory independent of W&B resume id.
1.1.2.2.4 local_writer_lock
lightning.training.execution_profile.WandbAttempt.local_writer_lock(output_root)Hold one nonblocking host-local writer lock for the logical run.
1.2 Functions
| Name | Description |
|---|---|
| assert_device_tensors | Reject CPU execution or non-FP32 state when an accelerator was requested. |
| captured_fallback_operations | Observe fallback names without retaining unrelated long-fit warnings. |
| execution_policy_source | Bind current package policy bytes to their explicitly named source owner. |
| execution_profile | Resolve one closed, reviewable training execution profile. |
| publish_wandb_attempt | Publish online evidence or close one explicitly linked offline segment. |
| verified_cold_initialization_lineage | Verify the original cold-state artifact used by a resumed fit lineage. |
1.2.1 assert_device_tensors
lightning.training.execution_profile.assert_device_tensors(
module,
device_type,
*,
gradients,
)Reject CPU execution or non-FP32 state when an accelerator was requested.
1.2.2 captured_fallback_operations
lightning.training.execution_profile.captured_fallback_operations()Observe fallback names without retaining unrelated long-fit warnings.
1.2.3 execution_policy_source
lightning.training.execution_profile.execution_policy_source(source_root=None)Bind current package policy bytes to their explicitly named source owner.
1.2.3.1 Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| source_root | Path | None | Repository root of a separately authenticated producer; omitted when sealing the imported package implementation. | None |
1.2.3.2 Returns
| Name | Type | Description |
|---|---|---|
| dict[str, str] | Versioned owner path and exact byte digest. Historical protocols retain | |
| dict[str, str] | their script-byte fields and are verified at their historical root. |
1.2.4 execution_profile
lightning.training.execution_profile.execution_profile(name)Resolve one closed, reviewable training execution profile.
1.2.5 publish_wandb_attempt
lightning.training.execution_profile.publish_wandb_attempt(
attempt,
result_path,
files,
metrics,
)Publish online evidence or close one explicitly linked offline segment.
1.2.6 verified_cold_initialization_lineage
lightning.training.execution_profile.verified_cold_initialization_lineage(
path,
*,
source_package_digest,
seed,
)Verify the original cold-state artifact used by a resumed fit lineage.