|
|
@ -33,6 +33,7 @@ class Learner(Process):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
super(Learner, self).__init__()
|
|
|
|
super(Learner, self).__init__()
|
|
|
|
|
|
|
|
self._arch = {'init':_args}
|
|
|
|
self.ndx = 0
|
|
|
|
self.ndx = 0
|
|
|
|
self._queue = Queue()
|
|
|
|
self._queue = Queue()
|
|
|
|
self.lock = RLock()
|
|
|
|
self.lock = RLock()
|
|
|
@ -44,6 +45,8 @@ class Learner(Process):
|
|
|
|
self.gpu = None
|
|
|
|
self.gpu = None
|
|
|
|
|
|
|
|
|
|
|
|
self.info = _args['info']
|
|
|
|
self.info = _args['info']
|
|
|
|
|
|
|
|
if 'context' not in self.info :
|
|
|
|
|
|
|
|
self.info['context'] = self.info['from']
|
|
|
|
self.columns = self.info['columns'] if 'columns' in self.info else None
|
|
|
|
self.columns = self.info['columns'] if 'columns' in self.info else None
|
|
|
|
self.store = _args['store']
|
|
|
|
self.store = _args['store']
|
|
|
|
|
|
|
|
|
|
|
@ -97,9 +100,12 @@ class Learner(Process):
|
|
|
|
# __info = (pd.DataFrame(self._states)[['name','path','args']]).to_dict(orient='records')
|
|
|
|
# __info = (pd.DataFrame(self._states)[['name','path','args']]).to_dict(orient='records')
|
|
|
|
if self._states :
|
|
|
|
if self._states :
|
|
|
|
__info = {}
|
|
|
|
__info = {}
|
|
|
|
|
|
|
|
# print (self._states)
|
|
|
|
for key in self._states :
|
|
|
|
for key in self._states :
|
|
|
|
__info[key] = [{"name":_item['name'],"args":_item['args'],"path":_item['path']} for _item in self._states[key]]
|
|
|
|
_pipeline = self._states[key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# __info[key] = ([{'name':_payload['name']} for _payload in _pipeline])
|
|
|
|
|
|
|
|
__info[key] = [{"name":_item['name'],"args":_item['args'],"path":_item['path']} for _item in self._states[key] if _item ]
|
|
|
|
self.log(object='state-space',action='load',input=__info)
|
|
|
|
self.log(object='state-space',action='load',input=__info)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -270,18 +276,23 @@ class Trainer(Learner):
|
|
|
|
#
|
|
|
|
#
|
|
|
|
_epochs = [_e for _e in gTrain.logs['epochs'] if _e['path'] != '']
|
|
|
|
_epochs = [_e for _e in gTrain.logs['epochs'] if _e['path'] != '']
|
|
|
|
_epochs.sort(key=lambda _item: _item['loss'],reverse=False)
|
|
|
|
_epochs.sort(key=lambda _item: _item['loss'],reverse=False)
|
|
|
|
|
|
|
|
|
|
|
|
_args['network_args']['max_epochs'] = _epochs[0]['epochs']
|
|
|
|
_args['network_args']['max_epochs'] = _epochs[0]['epochs']
|
|
|
|
self.log(action='autopilot',input={'epoch':_epochs[0]})
|
|
|
|
self.log(action='autopilot',input={'epoch':_epochs[0]})
|
|
|
|
g = Generator(**_args)
|
|
|
|
|
|
|
|
# g.run()
|
|
|
|
# g.run()
|
|
|
|
|
|
|
|
|
|
|
|
end = datetime.now() #.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
|
end = datetime.now() #.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
|
_min = float((end-beg).seconds/ 60)
|
|
|
|
_min = float((end-beg).seconds/ 60)
|
|
|
|
_logs = {'action':'train','input':{'start':beg.strftime('%Y-%m-%d %H:%M:%S'),'minutes':_min,"unique_counts":self._encoder._io[0]}}
|
|
|
|
_logs = {'action':'train','input':{'start':beg.strftime('%Y-%m-%d %H:%M:%S'),'minutes':_min,"unique_counts":self._encoder._io[0]}}
|
|
|
|
self.log(**_logs)
|
|
|
|
self.log(**_logs)
|
|
|
|
self._g = g
|
|
|
|
|
|
|
|
if self.autopilot :
|
|
|
|
if self.autopilot :
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# g = Generator(**_args)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g = Generator(**self._arch['init'])
|
|
|
|
|
|
|
|
self._g = g
|
|
|
|
self._g.run()
|
|
|
|
self._g.run()
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#@TODO Find a way to have the data in the object ....
|
|
|
|
#@TODO Find a way to have the data in the object ....
|
|
|
@ -300,10 +311,15 @@ class Generator (Learner):
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# We need to load the mapping information for the space we are working with ...
|
|
|
|
# We need to load the mapping information for the space we are working with ...
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.network_args['candidates'] = int(_args['candidates']) if 'candidates' in _args else 1
|
|
|
|
self.network_args['candidates'] = int(_args['candidates']) if 'candidates' in _args else 1
|
|
|
|
filename = os.sep.join([self.network_args['logs'],'output',self.network_args['context'],'map.json'])
|
|
|
|
# filename = os.sep.join([self.network_args['logs'],'output',self.network_args['context'],'map.json'])
|
|
|
|
|
|
|
|
_suffix = self.network_args['context']
|
|
|
|
|
|
|
|
filename = os.sep.join([self.network_args['logs'],'output',self.network_args['context'],'meta-',_suffix,'.json'])
|
|
|
|
self.log(**{'action':'init-map','input':{'filename':filename,'exists':os.path.exists(filename)}})
|
|
|
|
self.log(**{'action':'init-map','input':{'filename':filename,'exists':os.path.exists(filename)}})
|
|
|
|
if os.path.exists(filename):
|
|
|
|
if os.path.exists(filename):
|
|
|
|
|
|
|
|
|
|
|
|
file = open(filename)
|
|
|
|
file = open(filename)
|
|
|
|
self._map = json.loads(file.read())
|
|
|
|
self._map = json.loads(file.read())
|
|
|
|
file.close()
|
|
|
|
file.close()
|
|
|
@ -580,6 +596,7 @@ class factory :
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
if _args['apply'] in [apply.RANDOM] :
|
|
|
|
if _args['apply'] in [apply.RANDOM] :
|
|
|
|
pthread = Shuffle(**_args)
|
|
|
|
pthread = Shuffle(**_args)
|
|
|
|