Struct TrainerConfig

Source
pub struct TrainerConfig {
    pub max_opts: usize,
    pub opt_interval: usize,
    pub eval_interval: usize,
    pub flush_record_interval: usize,
    pub record_compute_cost_interval: usize,
    pub record_agent_info_interval: usize,
    pub warmup_period: usize,
    pub save_interval: usize,
}
Expand description

Configuration parameters for the training process.

This struct defines various intervals and thresholds that control the behavior of the training loop. Each parameter can be set using the builder pattern methods.

Fields§

§max_opts: usize

Maximum number of optimization steps to perform. Training stops when this number is reached.

§opt_interval: usize

Number of environment steps between optimization updates. For example, if set to 1, optimization occurs after every environment step.

§eval_interval: usize

Number of optimization steps between performance evaluations. During evaluation, the agent’s performance is measured and the best model is saved.

§flush_record_interval: usize

Number of optimization steps between flushing recorded metrics to storage. This controls how frequently training metrics are persisted.

§record_compute_cost_interval: usize

Number of optimization steps between recording computational performance metrics. This includes metrics like optimization steps per second.

§record_agent_info_interval: usize

Number of optimization steps between recording agent-specific information. This can include internal agent metrics or state information.

§warmup_period: usize

Initial number of environment steps before optimization begins. During this period, the replay buffer is filled with initial experiences.

§save_interval: usize

Number of optimization steps between saving model checkpoints. These checkpoints can be used for resuming training or analysis.

Implementations§

Source§

impl TrainerConfig

Source

pub fn max_opts(self, v: usize) -> Self

Sets the maximum number of optimization steps.

§Arguments
  • v - Maximum number of optimization steps
§Returns

Self with the updated configuration

Source

pub fn eval_interval(self, v: usize) -> Self

Sets the interval between performance evaluations.

§Arguments
  • v - Number of optimization steps between evaluations
§Returns

Self with the updated configuration

Source

pub fn eval_threshold(self, _v: f32) -> Self

(Deprecated) Sets the evaluation threshold.

This method is currently unimplemented and may be removed in future versions.

Source

pub fn opt_interval(self, opt_interval: usize) -> Self

Sets the interval between optimization updates.

§Arguments
  • opt_interval - Number of environment steps between optimizations
§Returns

Self with the updated configuration

Source

pub fn flush_record_interval(self, flush_record_interval: usize) -> Self

Sets the interval for flushing recorded metrics.

§Arguments
  • flush_record_interval - Number of optimization steps between flushes
§Returns

Self with the updated configuration

Source

pub fn record_compute_cost_interval( self, record_compute_cost_interval: usize, ) -> Self

Sets the interval for recording computational performance metrics.

§Arguments
  • record_compute_cost_interval - Number of optimization steps between recordings
§Returns

Self with the updated configuration

Source

pub fn record_agent_info_interval( self, record_agent_info_interval: usize, ) -> Self

Sets the interval for recording agent-specific information.

§Arguments
  • record_agent_info_interval - Number of optimization steps between recordings
§Returns

Self with the updated configuration

Source

pub fn warmup_period(self, warmup_period: usize) -> Self

Sets the initial warmup period before optimization begins.

§Arguments
  • warmup_period - Number of environment steps in the warmup period
§Returns

Self with the updated configuration

Source

pub fn save_interval(self, save_interval: usize) -> Self

Sets the interval for saving model checkpoints.

§Arguments
  • save_interval - Number of optimization steps between checkpoints
§Returns

Self with the updated configuration

Source

pub fn load(path: impl AsRef<Path>) -> Result<Self>

Loads configuration from a YAML file.

§Arguments
  • path - Path to the configuration file
§Returns

Result containing the loaded configuration

§Errors

Returns an error if the file cannot be read or parsed

Source

pub fn save(&self, path: impl AsRef<Path>) -> Result<()>

Saves the configuration to a file.

§Arguments
  • path - Path where the configuration will be saved
§Returns

Result indicating success or failure

§Errors

Returns an error if the file cannot be written

Trait Implementations§

Source§

impl Clone for TrainerConfig

Source§

fn clone(&self) -> TrainerConfig

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TrainerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TrainerConfig

Source§

fn default() -> Self

Creates a default configuration with conservative values.

Default values are set to:

  • max_opts: 0
  • opt_interval: 1 (optimize every step)
  • eval_interval: 0 (no evaluation)
  • flush_record_interval: usize::MAX (never flush)
  • record_compute_cost_interval: usize::MAX (never record)
  • record_agent_info_interval: usize::MAX (never record)
  • warmup_period: 0 (no warmup)
  • save_interval: usize::MAX (never save)
Source§

impl<'de> Deserialize<'de> for TrainerConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for TrainerConfig

Source§

fn eq(&self, other: &TrainerConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TrainerConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TrainerConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,