Get model after PBT

I’m using a PBT scheduler to search for the optimal hyper-parameters for my model.
is there a way for tune to automatically keep not only the best hyper-parameters but the best model
a) while it trains with a defined frequency?
b) how do I fetch the best model after the training ends?

1 Like

Hey @dbk80 , great question. You can always extract the model from a tune/RLlib checkpoint by:

  1. Restoring the entire RLlib Trainer from the checkpoint:
trainer = PPOTrainer(config=[orig config])
trainer.restore([path to checkpoint file])
  1. then export the model from the trainer
trainer.export_policy_model("/tmp/dir/onnx", onnx=[onnx version, e.g. 1])

thanks @sven1977 for the quick response!

1 Like