pub struct RLTraining<RLC: RLComponentsTypes> { /* private fields */ }rl only.Expand description
Structure to configure and launch reinforcement learning trainings.
Implementations§
Source§impl<B, E, EI, A> RLTraining<RLComponentsMarker<B, E, EI, A>>where
B: AutodiffBackend,
E: Environment + 'static,
EI: EnvironmentInit<E> + Send + 'static,
A: PolicyLearner<B> + Send + 'static,
A::TrainContext: ItemLazy + Clone + Send,
A::InnerPolicy: Policy<B> + Send,
<A::InnerPolicy as Policy<B>>::Observation: Batchable + Clone + Send,
<A::InnerPolicy as Policy<B>>::ActionDistribution: Batchable + Clone + Send,
<A::InnerPolicy as Policy<B>>::Action: Batchable + Clone + Send,
<A::InnerPolicy as Policy<B>>::ActionContext: ItemLazy + Clone + Send + 'static,
<A::InnerPolicy as Policy<B>>::PolicyState: Clone + Send,
E::State: Into<<A::InnerPolicy as Policy<B>>::Observation> + Clone + Send + 'static,
E::Action: From<<A::InnerPolicy as Policy<B>>::Action> + Into<<A::InnerPolicy as Policy<B>>::Action> + Clone + Send + 'static,
impl<B, E, EI, A> RLTraining<RLComponentsMarker<B, E, EI, A>>where
B: AutodiffBackend,
E: Environment + 'static,
EI: EnvironmentInit<E> + Send + 'static,
A: PolicyLearner<B> + Send + 'static,
A::TrainContext: ItemLazy + Clone + Send,
A::InnerPolicy: Policy<B> + Send,
<A::InnerPolicy as Policy<B>>::Observation: Batchable + Clone + Send,
<A::InnerPolicy as Policy<B>>::ActionDistribution: Batchable + Clone + Send,
<A::InnerPolicy as Policy<B>>::Action: Batchable + Clone + Send,
<A::InnerPolicy as Policy<B>>::ActionContext: ItemLazy + Clone + Send + 'static,
<A::InnerPolicy as Policy<B>>::PolicyState: Clone + Send,
E::State: Into<<A::InnerPolicy as Policy<B>>::Observation> + Clone + Send + 'static,
E::Action: From<<A::InnerPolicy as Policy<B>>::Action> + Into<<A::InnerPolicy as Policy<B>>::Action> + Clone + Send + 'static,
Source§impl<RLC: RLComponentsTypes + 'static> RLTraining<RLC>
impl<RLC: RLComponentsTypes + 'static> RLTraining<RLC>
Sourcepub fn with_learning_strategy(
self,
learning_strategy: RLStrategies<RLC>,
) -> Self
pub fn with_learning_strategy( self, learning_strategy: RLStrategies<RLC>, ) -> Self
Replace the default learning strategy (Off Policy learning) with the provided one.
§Arguments
training_strategy- The training strategy.
Sourcepub fn with_metric_logger<ML>(self, logger: ML) -> Selfwhere
ML: MetricLogger + 'static,
pub fn with_metric_logger<ML>(self, logger: ML) -> Selfwhere
ML: MetricLogger + 'static,
Sourcepub fn with_checkpointing_strategy<CS: CheckpointingStrategy + 'static>(
self,
strategy: CS,
) -> Self
pub fn with_checkpointing_strategy<CS: CheckpointingStrategy + 'static>( self, strategy: CS, ) -> Self
Update the checkpointing_strategy.
Sourcepub fn renderer<MR>(self, renderer: MR) -> Selfwhere
MR: MetricsRenderer + 'static,
pub fn renderer<MR>(self, renderer: MR) -> Selfwhere
MR: MetricsRenderer + 'static,
Sourcepub fn metrics_train<Me: TrainMetricRegistration<RLC>>(
self,
metrics: Me,
) -> Self
pub fn metrics_train<Me: TrainMetricRegistration<RLC>>( self, metrics: Me, ) -> Self
Register numerical metrics for a training step of the agent.
Sourcepub fn text_metrics_train<Me: TrainTextMetricRegistration<RLC>>(
self,
metrics: Me,
) -> Self
pub fn text_metrics_train<Me: TrainTextMetricRegistration<RLC>>( self, metrics: Me, ) -> Self
Register textual metrics for a training step of the agent.
Sourcepub fn metrics_agent<Me: AgentMetricRegistration<RLC>>(
self,
metrics: Me,
) -> Self
pub fn metrics_agent<Me: AgentMetricRegistration<RLC>>( self, metrics: Me, ) -> Self
Register numerical metrics for each action of the agent.
Sourcepub fn text_metrics_agent<Me: AgentTextMetricRegistration<RLC>>(
self,
metrics: Me,
) -> Self
pub fn text_metrics_agent<Me: AgentTextMetricRegistration<RLC>>( self, metrics: Me, ) -> Self
Register textual metrics for each action of the agent.
Sourcepub fn metrics_episode<Me: EpisodeMetricRegistration<RLC>>(
self,
metrics: Me,
) -> Self
pub fn metrics_episode<Me: EpisodeMetricRegistration<RLC>>( self, metrics: Me, ) -> Self
Register numerical metrics for a completed episode.
Sourcepub fn text_metrics_episode<Me: EpisodeTextMetricRegistration<RLC>>(
self,
metrics: Me,
) -> Self
pub fn text_metrics_episode<Me: EpisodeTextMetricRegistration<RLC>>( self, metrics: Me, ) -> Self
Register textual metrics for a completed episode.
Sourcepub fn text_metric_train<Me: Metric + 'static>(self, metric: Me) -> Self
pub fn text_metric_train<Me: Metric + 'static>(self, metric: Me) -> Self
Register a textual metric for a training step.
Sourcepub fn metric_train<Me>(self, metric: Me) -> Self
pub fn metric_train<Me>(self, metric: Me) -> Self
Sourcepub fn text_metric_agent<Me: Metric + 'static>(self, metric: Me) -> Self
pub fn text_metric_agent<Me: Metric + 'static>(self, metric: Me) -> Self
Register a textual metric for each action taken by the agent.
Sourcepub fn metric_agent<Me>(self, metric: Me) -> Self
pub fn metric_agent<Me>(self, metric: Me) -> Self
Sourcepub fn text_metric_episode<Me: Metric + 'static>(self, metric: Me) -> Self
pub fn text_metric_episode<Me: Metric + 'static>(self, metric: Me) -> Self
Register a textual metric for a completed episode.
Sourcepub fn metric_episode<Me>(self, metric: Me) -> Self
pub fn metric_episode<Me>(self, metric: Me) -> Self
Sourcepub fn checkpoint(self, checkpoint: usize) -> Self
pub fn checkpoint(self, checkpoint: usize) -> Self
The step from which the training must resume.
Sourcepub fn interrupter(&self) -> Interrupter
pub fn interrupter(&self) -> Interrupter
Provides a handle that can be used to interrupt training.
Sourcepub fn with_interrupter(self, interrupter: Interrupter) -> Self
pub fn with_interrupter(self, interrupter: Interrupter) -> Self
Override the handle for stopping training with an externally provided handle
Sourcepub fn with_application_logger(
self,
logger: Option<Box<dyn ApplicationLoggerInstaller>>,
) -> Self
pub fn with_application_logger( self, logger: Option<Box<dyn ApplicationLoggerInstaller>>, ) -> Self
By default, Rust logs are captured and written into
experiment.log. If disabled, standard Rust log handling
will apply.
Sourcepub fn with_file_checkpointer<FR>(self, recorder: FR) -> Selfwhere
FR: FileRecorder<RLC::Backend> + 'static + FileRecorder<<RLC::Backend as AutodiffBackend>::InnerBackend>,
pub fn with_file_checkpointer<FR>(self, recorder: FR) -> Selfwhere
FR: FileRecorder<RLC::Backend> + 'static + FileRecorder<<RLC::Backend as AutodiffBackend>::InnerBackend>,
Register a checkpointer that will save the environment runner’s policy and the PolicyLearner state to different files.
Sourcepub fn summary(self) -> Self
pub fn summary(self) -> Self
Enable the training summary report.
The summary will be displayed after .launch(), when the renderer is dropped.
Sourcepub fn launch(self, learner_agent: RLC::LearningAgent) -> RLResult<RLC::Policy>
pub fn launch(self, learner_agent: RLC::LearningAgent) -> RLResult<RLC::Policy>
Launch the training with the specified PolicyLearner on the specified environment.
Auto Trait Implementations§
impl<RLC> Freeze for RLTraining<RLC>
impl<RLC> !RefUnwindSafe for RLTraining<RLC>
impl<RLC> !Send for RLTraining<RLC>
impl<RLC> !Sync for RLTraining<RLC>
impl<RLC> Unpin for RLTraining<RLC>
impl<RLC> UnsafeUnpin for RLTraining<RLC>
impl<RLC> !UnwindSafe for RLTraining<RLC>
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> 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