Пример #1
0
def train(save_dir, **kwargs):
  """"""
  
  kwargs['config_file'] = kwargs.pop('config_file', '')
  load = kwargs.pop('load')
  try:
    if not load and os.path.isdir(save_dir):
      raw_input('Save directory already exists. Press <Enter> to continue or <Ctrl-c> to abort.')
      if os.path.isfile(os.path.join(save_dir, 'config.cfg')):
        os.remove(os.path.join(save_dir, 'config.cfg'))
  except KeyboardInterrupt:
    print()
    sys.exit(0)
  network = Network(**kwargs)
  network.train(load=load)
  return
Пример #2
0
def train(save_dir, **kwargs):
    """"""

    load = kwargs.pop('load')
    try:
        if not load and os.path.isdir(save_dir):
            raw_input(
                'Save directory already exists. Press <Enter> to continue or <Ctrl-c> to abort.'
            )
            if os.path.isfile(os.path.join(save_dir, 'config.cfg')):
                os.remove(os.path.join(save_dir, 'config.cfg'))
    except KeyboardInterrupt:
        sys.exit(0)

    #print (kwargs)
    #print ("train files:",kwargs['train_files'])
    print("initializing")
    network = Network(**kwargs)
    print("initialized")
    network.train(load=load)
    return