Added flag to alt_create_or_edit_session() that specifies whether to return the ddpg models
This commit is contained in:
parent
288805aae3
commit
9cc119e129
|
@ -1553,6 +1553,7 @@ def alt_create_or_edit_session(request):
|
|||
session_knobs = data.pop('session_knobs', None)
|
||||
disable_others = data.pop('disable_others', False)
|
||||
hyperparams = data.pop('hyperparameters', None)
|
||||
return_ddpg_model = data.pop('return_ddpg_model', False)
|
||||
ts = now()
|
||||
|
||||
if request.path == reverse('backdoor_create_session'):
|
||||
|
@ -1634,10 +1635,16 @@ def alt_create_or_edit_session(request):
|
|||
res['hardware_id'] = res['hardware']
|
||||
res['hardware'] = model_to_dict(session.hardware)
|
||||
res['algorithm'] = AlgorithmType.name(res['algorithm'])
|
||||
if session.ddpg_actor_model is not None:
|
||||
res['ddpg_actor_model'] = base64.encodebytes(session.ddpg_actor_model).decode('utf8')
|
||||
res['ddpg_critic_model'] = base64.encodebytes(session.ddpg_critic_model).decode('utf8')
|
||||
res['ddpg_replay_memory'] = base64.encodebytes(session.ddpg_reply_memory).decode('utf8')
|
||||
if return_ddpg_model:
|
||||
if session.ddpg_actor_model is not None:
|
||||
res['ddpg_actor_model'] = base64.encodebytes(session.ddpg_actor_model).decode('utf8')
|
||||
res['ddpg_critic_model'] = base64.encodebytes(session.ddpg_critic_model).decode('utf8')
|
||||
res['ddpg_replay_memory'] = base64.encodebytes(
|
||||
session.ddpg_reply_memory).decode('utf8')
|
||||
else:
|
||||
res['ddpg_actor_model'] = None
|
||||
res['ddpg_critic_model'] = None
|
||||
res['ddpg_replay_memory'] = None
|
||||
sk = SessionKnob.objects.get_knobs_for_session(session)
|
||||
sess_knobs = {}
|
||||
for knob in sk:
|
||||
|
|
Loading…
Reference in New Issue