speculators.train.recovery
Classes:
-
BatchRecoveryCoordinator–Consume batch metadata and periodically coordinate recovery across ranks.
-
GenerationRecoveryGuard–Retry generation operations and bound consecutive exhausted samples.
-
RecoveryMetadata–Recovery state carried from the collator to the trainer.
-
SampleUnavailable–Picklable result for a sample the dataset could not provide.
BatchRecoveryCoordinator
Consume batch metadata and periodically coordinate recovery across ranks.
Methods:
-
consume–Remove recovery metadata and optionally synchronize pending state.
-
synchronize–Aggregate pending failures and raise a circuit breaker on every rank.
Source code in speculators/train/recovery.py
consume
Remove recovery metadata and optionally synchronize pending state.
Source code in speculators/train/recovery.py
synchronize
Aggregate pending failures and raise a circuit breaker on every rank.
Source code in speculators/train/recovery.py
GenerationRecoveryGuard
Retry generation operations and bound consecutive exhausted samples.
DataLoader workers each receive their own dataset copy, so a guard stored on the dataset naturally tracks failures independently per persistent worker.
Methods:
-
run–Run
operationuntil it succeeds or all attempts are exhausted.
Attributes:
-
consecutive_failures(int) –Number of consecutive samples which exhausted all attempts.
Source code in speculators/train/recovery.py
consecutive_failures property
Number of consecutive samples which exhausted all attempts.
run
Run operation until it succeeds or all attempts are exhausted.
Source code in speculators/train/recovery.py
RecoveryMetadata dataclass
RecoveryMetadata(
failure_count: int = 0,
locally_empty: bool = False,
fatal: bool = False,
error: str = "",
)
Recovery state carried from the collator to the trainer.
Methods:
-
from_unavailable–Summarize unavailable samples for one collated batch.
from_unavailable classmethod
from_unavailable(
unavailable: Sequence[SampleUnavailable],
*,
locally_empty: bool,
) -> RecoveryMetadata
Summarize unavailable samples for one collated batch.