Stable-baselines: [question] Tensorboard callback during testing/predicting?

Created on 17 Nov 2019  路  3Comments  路  Source: hill-a/stable-baselines

I see that it's easy to pass tensorboard callbacks to the model.train() function. Is there any way to do something similar when testing the model after training, i.e., using the model.predict() call? For me, tensorboard is a convenient way to also see how the agent is doing during testing.

I just saw that predict() does not seem to accept callbacks directly. So I guess this is not possible? What's the best practice then?

RTFM question

All 3 comments

predict only returns a single action for a single observation, it does not evaluate the agent on the environment. No code for that exists yet, but #508 will add evaluate_policy for easier evaluation of the agents. Meanwhile you have to write the evaluation loop yourself (see examples for hints).

I saw the manual evaluation loop in the examples, which is where I saw the predict call. I was just wondering if there is a way to include tensorboard callbacks in this evaluation loop? And if so what's the best practice to do so?

Thanks for your pointer to https://github.com/hill-a/stable-baselines/pull/508 though. It seems like evaluate_policy will accept tensorboard callbacks and solve my question. Hopefully, you'll be able to merge the PR soon :)

As @Miffyli mentioned, model.predict() is quite different from model.learn() as it only does one thing. Compared to keras predict method, this only take a batch of observation as input (not a generator), most of the evaluation code must be written by the user for now (this will normally change in the future with evaluation callback #348 and PR #508).

Was this page helpful?
0 / 5 - 0 ratings