Example #1
0
_HIDDEN_LAYER_DIMS = [10]
_BATCH_SIZE = 32
_NUM_TRAIN_STEPS = 1000
_NUM_EVAL_STEPS = 100
_WARMUP_PROP = 0.1
_COOLDOWN_PROP = 0.1
_WARM_START_FROM = None
_SAVE_SUMMARY_STEPS = 100
_SAVE_CHECKPOINT_SECS = 3600
_LEARNING_RATE = 2e-5
_NUM_GPUS = 1

pipeline_name = '-'.join([_MLP_PROJECT, _MLP_SUBPROJECT, _PIPELINE_TYPE])
pipeline_mod = '.'.join(
    [_MLP_SUBPROJECT, 'pipelines', _RUNNER, _PIPELINE_TYPE])
pipeline_root, model_uri, schema_uri, transform_graph_uri = pipeline_dirs(
    _RUN_DIR, _RUN_STR, _MLP_PROJECT, _MLP_SUBPROJECT, pipeline_name)
print(transform_graph_uri)

trainer_fn = train.trainer_factory(
    batch_size=_BATCH_SIZE,
    learning_rate=_LEARNING_RATE,
    hidden_layer_dims=_HIDDEN_LAYER_DIMS,
    categorical_feature_keys=_CATEGORICAL_FEATURE_KEYS,
    numerical_feature_keys=_NUMERICAL_FEATURE_KEYS,
    label_key=_LABEL_KEY,
    warmup_prop=_WARMUP_PROP,
    cooldown_prop=_COOLDOWN_PROP,
    # warm_start_from=_WARM_START_FROM,
    save_summary_steps=_SAVE_SUMMARY_STEPS,
    save_checkpoints_secs=_SAVE_CHECKPOINT_SECS)
Example #2
0
  full._MLP_SUBPROJECT,
  _PIPELINE_TYPE
])
pipeline_mod = '.'.join([
  full._MLP_PROJECT,
  full._MLP_SUBPROJECT,
  'pipelines',
  full._RUNNER,
  _PIPELINE_TYPE
])
proj_root = os.path.join(full._RUN_DIR, 'tfx', pipeline_name)

pipeline_root, _, __, ___ = pipeline_dirs(
  full._RUN_DIR,
  _RUN_STR,
  full._MLP_PROJECT,
  full._MLP_SUBPROJECT,
  pipeline_name
)

trainer_fn = train.trainer_factory(
  batch_size=full._BATCH_SIZE,
  learning_rate=_LEARNING_RATE,
  hidden_layer_dims=full._HIDDEN_LAYER_DIMS,
  categorical_feature_keys=full._CATEGORICAL_FEATURE_KEYS,
  numerical_feature_keys=full._NUMERICAL_FEATURE_KEYS,
  label_key=full._LABEL_KEY,
  warmup_prop=_WARMUP_PROP,
  cooldown_prop=_COOLDOWN_PROP,
  # warm_start_from=full.model_uri,
  save_summary_steps=_SAVE_SUMMARY_STEPS,