Saving Trained QLearner #1143
-
I trained a QLearner, and I want to save it to be used later. One way I can think of is export the _q_values attribute to a json file, then load the json file later and assign it to the new QLearner. However, one problem I came accross is loading json file takes quite a bit of time, and I need to reformat the loaded json file to collections.defaultdict, which became a bit confusing. So I am wondering is there any better ways to save my trained agent? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hmmm.... do you mean the tabular Q-learner? I assume you mean the Python Tabular QLearner. AFAIK that's not currently built-in, but you could just serialize the entire QLearning object every X iterations using pickle and reload that from disk, right? Does that work? If you mean the C++ tabular q-learning, you'd have to do it manually.. but that functionality would make a nice contribution :) If you mean the Q-learning with function approximation, it'd depend on which ML framework; most of them already support it but in different ways. Probably easiest to first point me out to the specific implementation/file you're talking about and I'll follow-up if necessary. |
Beta Was this translation helpful? Give feedback.
Hmmm.... do you mean the tabular Q-learner? I assume you mean the Python Tabular QLearner. AFAIK that's not currently built-in, but you could just serialize the entire QLearning object every X iterations using pickle and reload that from disk, right? Does that work?
If you mean the C++ tabular q-learning, you'd have to do it manually.. but that functionality would make a nice contribution :)
If you mean the Q-learning with function approximation, it'd depend on which ML framework; most of them already support it but in different ways.
Probably easiest to first point me out to the specific implementation/file you're talking about and I'll follow-up if necessary.