SLM Lab
v4.1.1
v4.1.1
  • SLM Lab
  • 🖥Setup
    • Installation
    • Quick Start
  • 🚀Using SLM Lab
    • Lab Command
    • Lab Organization
    • Train and Enjoy: REINFORCE CartPole
    • Agent Spec: DDQN+PER on LunarLander
    • Env Spec: A2C on Pong
    • GPU Usage: PPO on Pong
    • Parallelizing Training: Async SAC on Humanoid
    • Experiment and Search Spec: PPO on Breakout
    • Run Benchmark: A2C on Atari Games
    • Meta Spec: High Level Specifications
    • Post-Hoc Analysis
    • TensorBoard: Visualizing Models and Actions
    • Using SLM Lab In Your Project
  • 📈Analyzing Results
    • Data Locations
    • Graphs and Data
    • Performance Metrics
  • 🥇Benchmark Results
    • Public Benchmark Data
    • Discrete Environment Benchmark
    • Continuous Environment Benchmark
    • Atari Environment Benchmark
    • RL GIFs
  • 🔧Development
    • Modular Design
      • Algorithm Taxonomy
      • Class Inheritance: A2C > PPO
    • Algorithm
      • DQN
      • REINFORCE
      • Actor Critic
    • Memory
      • Replay
      • PrioritizedReplay
      • OnPolicyReplay
      • OnPolicyBatchReplay
    • Net
      • MLP
      • CNN
      • RNN
    • Profiling SLM Lab
  • 📖Publications and Talks
    • Book: Foundations of Deep Reinforcement Learning
    • Talks and Presentations
  • 🤓Resources
    • Deep RL Resources
    • Contributing
    • Motivation
    • Help
    • Contact
Powered by GitBook
On this page
  • OnPolicyBatchReplay
  • Source Documentation
  • Example Memory Spec

Was this helpful?

  1. 🔧Development
  2. Memory

OnPolicyBatchReplay

PreviousOnPolicyReplayNextNet

Last updated 5 years ago

Was this helpful?

OnPolicyBatchReplay

Code:

Sometimes for on-policy training, an agent trains at a fixed frequency, e.g. every 200 steps, instead of at the end of an episode. The signal for training also comes from the memory class in memory.to_train. For batched training schedule, OnPolicyBatchReplay extends OnPolicyReplay to set self.to_train = true based on agent's training frequency and the number of experiences collected.

Suitable for on-policy algorithms.

Source Documentation

Refer to the class documentation and example memory spec from the source:

Example Memory Spec

The spec for this memory has no parameters, since it automatically flushes at the end of a batch after training. The batch_size is the training_frequency provided by algorithm_spec.

{
    ...
    "agent": [{
      "memory": {
        "name": "OnPolicyBatchReplay"
      }
    }],
    ...
}

For more concrete examples of memory spec specific to algorithms, refer to the existing .

slm_lab/agent/memory/onpolicy.py
slm_lab/agent/memory/onpolicy.py#L100-L110
spec files