in tensorflow_fold/blocks/plan.py [0:0]
def _register_options(register, default_plan_name='plan'):
"""Calls a function once for each option a plan needs.
Arguments:
register: Register is a function which takes four arguments, namely,
1. The function you'd use to define the option as a flag.
2. The name of the option.
3. The default value for the option.
4. A doc-string for the option.
default_plan_name: A default value for the plan_name option.
"""
register(
flags.DEFINE_string,
'mode', 'train', 'One of train or eval or infer.')
register(
flags.DEFINE_bool,
'debug', False,
'Whether tfdbg should be enabled. For now only works for local runs, not '
'remotely on borg.')
# Flags for checkpoints and summaries.
register(
flags.DEFINE_string,
'logdir_base', '/tmp/', 'Path base for checkpoints and summaries.')
register(
flags.DEFINE_string,
'plan_name', default_plan_name, 'Plan name.')
register(
flags.DEFINE_integer,
'run_id', 0, 'Run ID. Checkpoints and summaries are stored under '
'`os.path.join(logdir_base, plan_name, \'run_\' + run_id)`. In train '
'mode, you can set --run_id=-1 to create a new unique new run_id.')
register(
flags.DEFINE_integer,
'save_summaries_secs', 120,
'Time interval between computations of summaries for the event log. Set '
'to zero to disable summaries.')
# Flags for data processing
register(
flags.DEFINE_integer,
'num_multiprocess_processes', 0, 'Number of worked processes to use '
'for multiprocessing when building loom inputs. Defaults to the cpu '
'count. Zero to disable multiprocessing')
register(
flags.DEFINE_integer,
'truncate_examples', 0,
'If non-zero, truncates datasets to have at most this many examples.')
# Flags for replication.
register(
flags.DEFINE_string,
'master', '',
'TensorFlow master to use.')
# Flags for training.
register(
flags.DEFINE_string,
'optimizer_spec', '',
'An optimizer spec used to construct the optimizer. Default is ADAM.')
register(
flags.DEFINE_string,
'learning_rate_decay_spec', '',
'A spec to construct the learning rate decay algorithm. Default is none.'
'For example: '
'"algorithm=exponential_decay, decay_rate=0.9, decay_steps=10000"')
register(
flags.DEFINE_integer,
'learning_rate_decay_steps', 10000,
'The decay steps to use in exponential learning rate decay:'
'decayed_rate=learning_rate * decay_rate ^ (global_step / decay_steps).')
register(
flags.DEFINE_integer,
'batch_size', 128,
'Number of examples per batch.')
register(
flags.DEFINE_integer,
'epochs', 20,
'Number of training epochs. Zero to run forever.')
register(
flags.DEFINE_integer,
'task', 0,
'Task ID of the replica running the training.')
register(
flags.DEFINE_integer,
'ps_tasks', 0,
'Number of PS Tasks in the training job.')
register(
flags.DEFINE_integer,
'worker_replicas', 1, 'Number of train worker replicas. When '
'num_dequeuers is specified, num_queues will be '
'min(num_dequeuers, ps_tasks), and worker_replicas must be at least '
'num_queues + num_dequeuers to ensure that there is at least one '
'enqueuing worker per queue.')
register(
flags.DEFINE_integer,
'num_dequeuers', 0, 'Number of dequeuing workers. If specified, ps_tasks '
'must be positive, num_queues will be min(num_dequeuers, ps_tasks), '
'worker_replicas must be at least num_queues + num_dequeuers to ensure '
'that there is at least one enqueuing worker per queue.')
register(
flags.DEFINE_integer,
'queue_capacity', 0, 'Capacity for shared queues. If unspecified and '
'num_dequeuers is specified, defaults to 4x batch_size.')
register(
flags.DEFINE_integer,
'batches_per_epoch', 1000,
'How many batches to consider an epoch when examples are absent. Has no '
'effect when examples is present (because an epoch is defined as '
'a full pass through the training examples). ')
register(
flags.DEFINE_integer,
'save_model_secs', 120,
'Time interval between creation of model checkpoints. Note that if a '
'dev set is provided then we save the best performing models, and this '
'is ignored.')
# Flags for eval.
register(
flags.DEFINE_integer,
'eval_interval_secs', 120,
'Time interval between eval runs (when running in a loop). Set to zero '
'to run a single eval and then exit.')
register(
flags.DEFINE_bool,
'save_best', True,
'Whether eval mode should save a checkpoint if this model has the best '
'loss so far. This can be disabled for example when evaluating '
'performance on multiple data sets.')
# Flags for inference.
register(
flags.DEFINE_string,
'infer_from', 'train',
'Subdirectory to load the latest checkpoint from. Typically \'train\' '
'or \'eval\'.')