Skip to content

batch size vs n_env*n_steps #481

Answered by araffin
geoffreyvd asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,
you are correct, PPO will actually print a warning:

stable_baselines3/ppo/ppo.py:155: UserWarning: You have specified a mini-batch size of 256, but because the `RolloutBuffer` is of size `n_steps * n_envs = 8`, after every 0 untruncated mini-batches, there will be a truncated mini-batch of size 8
We recommend using a `batch_size` that is a factor of `n_steps * n_envs`.

Each minibatch will be truncated to 8.

In fact, it will give you the same result as python train.py --algo ppo --env MountainCarContinuous-v0 -param batch_size:8

I would appreciate a PR that updates this parameter ;)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by geoffreyvd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants