tf_agents.policies.async_policy_saver.AsyncPolicySaver

Triggers policy_saver save calls in a separate thread asynchronously.

policy_saver An instance of a policy_saver.PolicySaver.

Methods

close

View source

Blocks until there is no saving happening and kills the save_thread.

flush

View source

Blocks until there is no saving happening.

save

View source

Triggers an async save of the policy to the given export_dir.

Only one save can be triggered at a time. If save or save_checkpoint are called while another save of either kind is still ongoing the saving is skipped.

If blocking is set then the call will block until any ongoing saves finish, and then a new save will be made before returning.

Args
export_dir Directory path for the saved_model of the policy.
blocking If True the call to save will block until a save can be performed and finished. If a save was ongoing it will wait for that to finish, and then do a blocking save before returning.

save_checkpoint

View source

Triggers an async save of the policy checkpoint.

Only one save can be triggered at a time. If save or save_checkpoint are called while another save of either kind is still ongoing the saving is skipped.

If blocking is set then the call will block until any ongoing saves finish, and then a new save will be made before returning.

Args
export_dir Directory path for the checkpoint of the policy.
blocking If True the call to save will block until a save can be performed and finished. If a save was ongoing it will wait for that to finish, and then do a blocking save before returning.