How to generate the model during each trial

I want to save for each trial the best model. The name of the model will be equal to the name of the trial. so if the name is blaxj the my model will be blaxj.pkl. How can do that?
is there is anyway to access the trial_id inside the function train which in my case create a neural network, then apply compile and fit methods?

Hey @tam, sorry, no there is no access to the trial ID from within Trainer, because the Trial is “wrapped” around the Trainer (and therefore also the Policy+Model) by tune. Trials are in fact only used when you run RLlib via tune.run().
We could add this information somewhere (e.g. to the config similar to what we do for the evaluation workers), but I’ll let the tune guys comment on that.
@kai @rliaw ?