pub struct PhaseConfig {
pub full_steps: usize,
pub predict_steps: usize,
pub correct_every: usize,
pub prediction_config: PredictionConfig,
pub ternary_config: TernaryConfig,
pub vsa_config: VSAConfig,
pub gradient_accumulation: usize,
pub max_grad_norm: f32,
pub adaptive_phases: bool,
pub loss_threshold: f32,
}Expand description
Configuration for phase-based training.
The training cycle is: FULL → PREDICT → CORRECT → repeat
§Example
use vsa_optim_rs::PhaseConfig;
let config = PhaseConfig::default()
.with_full_steps(10)
.with_predict_steps(40);Fields§
§full_steps: usizeNumber of full gradient computation steps per cycle.
predict_steps: usizeNumber of predicted gradient steps per cycle.
correct_every: usizeFrequency of correction steps during predict phase.
prediction_config: PredictionConfigSub-configuration for gradient prediction.
ternary_config: TernaryConfigSub-configuration for ternary optimization.
vsa_config: VSAConfigSub-configuration for VSA compression.
gradient_accumulation: usizeGradient accumulation steps.
max_grad_norm: f32Maximum gradient norm for clipping.
adaptive_phases: boolWhether to adaptively adjust phase lengths based on loss.
loss_threshold: f32Loss increase threshold for triggering more full steps.
Implementations§
Source§impl PhaseConfig
impl PhaseConfig
Sourcepub const fn with_full_steps(self, steps: usize) -> PhaseConfig
pub const fn with_full_steps(self, steps: usize) -> PhaseConfig
Set the number of full training steps.
Sourcepub const fn with_predict_steps(self, steps: usize) -> PhaseConfig
pub const fn with_predict_steps(self, steps: usize) -> PhaseConfig
Set the number of prediction steps.
Sourcepub const fn with_correct_every(self, every: usize) -> PhaseConfig
pub const fn with_correct_every(self, every: usize) -> PhaseConfig
Set the correction frequency.
Sourcepub const fn with_max_grad_norm(self, norm: f32) -> PhaseConfig
pub const fn with_max_grad_norm(self, norm: f32) -> PhaseConfig
Set the maximum gradient norm for clipping.
Sourcepub const fn with_adaptive_phases(self, adaptive: bool) -> PhaseConfig
pub const fn with_adaptive_phases(self, adaptive: bool) -> PhaseConfig
Set whether to use adaptive phase scheduling.
Sourcepub fn with_prediction_config(self, config: PredictionConfig) -> PhaseConfig
pub fn with_prediction_config(self, config: PredictionConfig) -> PhaseConfig
Set the prediction sub-configuration.
Sourcepub fn with_ternary_config(self, config: TernaryConfig) -> PhaseConfig
pub fn with_ternary_config(self, config: TernaryConfig) -> PhaseConfig
Set the ternary sub-configuration.
Sourcepub fn with_vsa_config(self, config: VSAConfig) -> PhaseConfig
pub fn with_vsa_config(self, config: VSAConfig) -> PhaseConfig
Set the VSA sub-configuration.
Trait Implementations§
Source§impl Clone for PhaseConfig
impl Clone for PhaseConfig
Source§fn clone(&self) -> PhaseConfig
fn clone(&self) -> PhaseConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PhaseConfig
impl Debug for PhaseConfig
Source§impl Default for PhaseConfig
impl Default for PhaseConfig
Source§fn default() -> PhaseConfig
fn default() -> PhaseConfig
Source§impl<'de> Deserialize<'de> for PhaseConfig
impl<'de> Deserialize<'de> for PhaseConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PhaseConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PhaseConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for PhaseConfig
impl Serialize for PhaseConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for PhaseConfig
impl RefUnwindSafe for PhaseConfig
impl Send for PhaseConfig
impl Sync for PhaseConfig
impl Unpin for PhaseConfig
impl UnwindSafe for PhaseConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more