Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set number of epochs trained instead of total_timestep #352

Closed
maxmatical opened this issue Jun 5, 2019 · 7 comments
Closed

How to set number of epochs trained instead of total_timestep #352

maxmatical opened this issue Jun 5, 2019 · 7 comments
Labels
question Further information is requested

Comments

@maxmatical
Copy link

In the example codes, the call to train the agent is as follows:

model.learn(total_timesteps=10000)

Is there a way to specify the number of epochs a model is trained, instead of by timesteps?

@araffin araffin added the question Further information is requested label Jun 5, 2019
@araffin
Copy link
Collaborator

araffin commented Jun 5, 2019

Hello,

How do you define an epoch? You maybe mean episodes?

@maxmatical
Copy link
Author

I think it depends on the definition, but I mean an epoch in the traditional DL sense, a forward/backward pass through the entirety of the data

@araffin
Copy link
Collaborator

araffin commented Jun 5, 2019

I mean an epoch in the traditional DL sense, a forward/backward pass through the entirety of the data

Well, we are in a RL setting, "the entirety of the data" does not really makes sense here, no?

@maxmatical
Copy link
Author

maxmatical commented Jun 5, 2019

Epochs are defined in openai spinups

ppo(env_fn=env_fn, ac_kwargs=ac_kwargs, steps_per_epoch=5000, epochs=250, logger_kwargs=logger_kwargs)

Which would be the equivalent of nupdates in baselines

So I'm just curious if there's an equivalent variable in baselines. If I want to set the number of episodes, is there an option to do so, or is it enough to set the number of steps?

@araffin
Copy link
Collaborator

araffin commented Jun 5, 2019

Epochs are defined in openai spinups

I see.

If you can want an equivalent of epochs, with one process:

for PPO2 for instance, epochs= total_timesteps // n_steps (in the sense of spinning up) which is as you pointed out nupdates.
However, in the the multiprocessing case, epochs= total_timesteps // (n_steps * n_envs).

For other algorithms, like SAC that updates every steps, that does not really makes sense...

or is it enough to set the number of steps?

There is no option, but you can easily convert your number of epochs into a number of steps (cf above), but that depends on the algorithm used.

@maxmatical
Copy link
Author

I see. Thanks for your answers.

@blurLake
Copy link

How about DDPG? I saw in openai spinups

spinup.ddpg_tf1(..., steps_per_epoch=4000, epochs=100, ...)

Is there a similar setting in stable_baselines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants