コード例 #1
0
ファイル: t01_hw.py プロジェクト: rscv5/tframe
def main(_):
  console.start('{} on CIFAR-10 task'.format(model_name.upper()))

  th = core.th
  # ---------------------------------------------------------------------------
  # 0. date set setup
  # ---------------------------------------------------------------------------
  # ---------------------------------------------------------------------------
  # 1. folder/file names and device
  # ---------------------------------------------------------------------------
  th.job_dir += '/{:02d}_{}'.format(id, model_name)
  summ_name = model_name
  th.prefix = '{}_'.format(date_string())
  th.suffix = '_t00'
  th.visible_gpu_id = 0

  # ---------------------------------------------------------------------------
  # 2. model setup
  # ---------------------------------------------------------------------------
  th.model = model
  th.centralize_data = True

  th.num_layers = 50
  th.layer_width = 100
  th.spatial_activation = 'tanh'
  th.bias_initializer = -5.

  # ---------------------------------------------------------------------------
  # 3. trainer setup
  # ---------------------------------------------------------------------------
  th.epoch = 200
  th.batch_size = 128
  th.validation_per_round = 1

  th.optimizer = tf.train.AdamOptimizer
  th.learning_rate = 0.0004

  th.patience = 5
  th.early_stop = False
  th.validate_train_set = True
  th.val_decimals = 6

  # ---------------------------------------------------------------------------
  # 4. summary and note setup
  th.export_tensors_upon_validation = True
  # th.export_gates = True

  th.train = True
  th.save_model = True
  th.overwrite = True

  # ---------------------------------------------------------------------------
  # 5. other stuff and activate
  # ---------------------------------------------------------------------------
  th.mark = '{}({}x{}-{})'.format(
    model_name, th.layer_width, th.num_layers, th.spatial_activation)
  th.gather_summ_name = th.prefix + summ_name + th.suffix +  '.sum'
  core.activate()
コード例 #2
0
def main(_):
    console.start('{} on CIFAR-10 task'.format(model_name.upper()))

    th = core.th
    # ---------------------------------------------------------------------------
    # 0. date set setup
    # ---------------------------------------------------------------------------
    # ---------------------------------------------------------------------------
    # 1. folder/file names and device
    # ---------------------------------------------------------------------------
    th.job_dir += '/{:02d}_{}'.format(id, model_name)
    summ_name = model_name
    prefix = '{}_'.format(date_string())
    suffix = ''
    th.visible_gpu_id = 0

    # ---------------------------------------------------------------------------
    # 2. model setup
    # ---------------------------------------------------------------------------
    th.model = model
    th.dropout = 0.2

    # ---------------------------------------------------------------------------
    # 3. trainer setup
    # ---------------------------------------------------------------------------
    th.epoch = 1000
    th.batch_size = 64
    th.validation_per_round = 5

    th.optimizer = tf.train.AdamOptimizer
    th.learning_rate = 0.001

    th.patience = 5

    # ---------------------------------------------------------------------------
    # 4. summary and note setup
    # ---------------------------------------------------------------------------
    th.train = True
    th.save_model = True
    th.overwrite = True

    # ---------------------------------------------------------------------------
    # 5. other stuff and activate
    # ---------------------------------------------------------------------------
    tail = suffix
    th.mark = prefix + '{}({}){}'.format(model_name, th.num_layers, tail)
    th.gather_summ_name = prefix + summ_name + tail + '.sum'
    core.activate(True)
コード例 #3
0
def main(_):
    console.start('{} on CIFAR-10 task'.format(model_name.upper()))

    th = core.th
    # ---------------------------------------------------------------------------
    # 0. date set setup
    # ---------------------------------------------------------------------------
    # ---------------------------------------------------------------------------
    # 1. folder/file names and device
    # ---------------------------------------------------------------------------
    th.job_dir += '/{:02d}_{}'.format(id, model_name)
    summ_name = model_name
    th.prefix = '{}_'.format(date_string())
    th.visible_gpu_id = 1

    # ---------------------------------------------------------------------------
    # 2. model setup
    # ---------------------------------------------------------------------------
    th.model = model
    th.spatial_activation = 'relu'
    th.developer_code = '1024-512'
    th.fc_dims = [int(s) for s in th.developer_code.split('-')]

    th.use_batchnorm = False
    th.dropout = 0.0
    th.centralize_data = True

    # ---------------------------------------------------------------------------
    # 3. trainer setup
    # ---------------------------------------------------------------------------
    th.epoch = 1
    th.batch_size = 64
    th.validation_per_round = 5

    th.optimizer = tf.train.AdamOptimizer
    th.learning_rate = 0.001

    th.patience = 5

    th.lives = 1
    th.lr_decay = 0.6

    th.clip_threshold = 10.0
    th.reset_optimizer_after_resurrection = False
    th.summary = True

    # ---------------------------------------------------------------------------
    # 4. summary and note setup
    # ---------------------------------------------------------------------------
    th.train = True
    th.save_model = True
    th.overwrite = True

    th.print_cycle = 20

    # ---------------------------------------------------------------------------
    # 5. other stuff and activate
    # ---------------------------------------------------------------------------
    tail = ''
    th.mark = '{}({})'.format(model_name, '-'.join(
        [str(dim) for dim in th.fc_dims])) + tail
    th.gather_summ_name = th.prefix + summ_name + tail + '.sum'
    core.activate()