nrontsis / PILCO

Bayesian Reinforcement Learning in Tensorflow
MIT License
314 stars 84 forks source link

How do you save your trained model? #54

Open emsal0 opened 3 years ago

emsal0 commented 3 years ago

I've tried using pickle but it's unable to serialize the PILCO object after training.

Is there a builtin save method? Or does another kind of serialization work? Thanks.

Pengxiao-Gao commented 3 years ago

I've tried using pickle but it's unable to serialize the PILCO object after training.

Is there a builtin save method? Or does another kind of serialization work? Thanks.

Hi, there was function to save and load model in pull requests Utils pr #17 when pilco using TF1 and GP1, but now no attribute 'read_values' in GP2. Have you any solutions now?

Shubham831831 commented 2 years ago

Hello, We can save controller parameters (best_parameters variable in pilco) by using pickle and recreating the controller based on these parameters. Procedure :

  1. Save best_parameters of controller in pickle file during each iteration.
  2. Recreate controller using controller.py and these parameters.
  3. Use this controller on environment.

Example: For RBF controller best_parameters contains: DataX, DataY, and Lengthscales. With these parameters, we can recreate RBF controller.