Struct RetryPolicy
pub struct RetryPolicy {
pub max_retries: u32,
}Expand description
What a failed trial is allowed to cost before the study gives up on it.
RL objectives crash: a CUDA OOM, a NaN, a flaky simulator. Re-running the same parameters is usually the right answer and is a policy, not a sampler concern.
A retry is a new trial: it gets its own number, its own record and its
own slot against Budget::max_trials, and its parameters are pinned by a
TrialTemplate taken from the failed trial’s record. Anything the
objective suggests that the failed run never reached is therefore sampled
afresh, under the new trial’s seed.
§Determinism: a retrying study is replayable, not pre-determined
Trial-number-indexed
determinism
holds for a stateless sampler with an empty template queue. A non-zero
retry policy empties that precondition: the failed configuration is pushed
onto the queue at the moment the failure is observed, and under
parallelism(n) with n > 1 that moment is
thread-scheduling dependent — so the retry template lands on whichever trial
number the next ask happens to claim. Two runs of the same
seed then agree on the multiset of configurations they retry, but not
necessarily on which trial number carries which. Sequentially the mapping is
fixed and reproducible.
This is not fixable by locking: the enqueue time is itself order-dependent,
so a study with retries is replayable (its recorded history explains
itself completely) rather than pre-determined (computable from the seed
before it runs). Use parallelism(1) when the number-to-configuration map
itself has to be reproducible.
use atune_core::study::RetryPolicy;
assert_eq!(RetryPolicy::default(), RetryPolicy::none());
assert_eq!(RetryPolicy::times(2).max_retries, 2);Fields§
§max_retries: u32How many additional attempts a failed configuration gets. 0
disables retrying.
Implementations§
§impl RetryPolicy
impl RetryPolicy
Trait Implementations§
§impl Clone for RetryPolicy
impl Clone for RetryPolicy
§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more