Register base flags. Args: data_dir: Create a flag for specifying the input data directory. model_dir: Create a flag for specifying the model file directory. clean: Create a flag for removing the model_dir. train_epochs: Create a flag to specify the number of training epochs.
(data_dir=True,
model_dir=True,
clean=False,
train_epochs=False,
epochs_between_evals=False,
stop_threshold=False,
batch_size=True,
num_gpu=False,
hooks=False,
export_dir=False,
distribution_strategy=False,
run_eagerly=False)
| 20 | |
| 21 | |
| 22 | def define_base(data_dir=True, |
| 23 | model_dir=True, |
| 24 | clean=False, |
| 25 | train_epochs=False, |
| 26 | epochs_between_evals=False, |
| 27 | stop_threshold=False, |
| 28 | batch_size=True, |
| 29 | num_gpu=False, |
| 30 | hooks=False, |
| 31 | export_dir=False, |
| 32 | distribution_strategy=False, |
| 33 | run_eagerly=False): |
| 34 | """Register base flags. |
| 35 | |
| 36 | Args: |
| 37 | data_dir: Create a flag for specifying the input data directory. |
| 38 | model_dir: Create a flag for specifying the model file directory. |
| 39 | clean: Create a flag for removing the model_dir. |
| 40 | train_epochs: Create a flag to specify the number of training epochs. |
| 41 | epochs_between_evals: Create a flag to specify the frequency of testing. |
| 42 | stop_threshold: Create a flag to specify a threshold accuracy or other eval |
| 43 | metric which should trigger the end of training. |
| 44 | batch_size: Create a flag to specify the batch size. |
| 45 | num_gpu: Create a flag to specify the number of GPUs used. |
| 46 | hooks: Create a flag to specify hooks for logging. |
| 47 | export_dir: Create a flag to specify where a SavedModel should be exported. |
| 48 | distribution_strategy: Create a flag to specify which Distribution Strategy |
| 49 | to use. |
| 50 | run_eagerly: Create a flag to specify to run eagerly op by op. |
| 51 | |
| 52 | Returns: |
| 53 | A list of flags for core.py to marks as key flags. |
| 54 | """ |
| 55 | key_flags = [] |
| 56 | |
| 57 | if data_dir: |
| 58 | flags.DEFINE_string( |
| 59 | name="data_dir", |
| 60 | short_name="dd", |
| 61 | default="/tmp", |
| 62 | help=help_wrap("The location of the input data.")) |
| 63 | key_flags.append("data_dir") |
| 64 | |
| 65 | if model_dir: |
| 66 | flags.DEFINE_string( |
| 67 | name="model_dir", |
| 68 | short_name="md", |
| 69 | default="/tmp", |
| 70 | help=help_wrap("The location of the model checkpoint files.")) |
| 71 | key_flags.append("model_dir") |
| 72 | |
| 73 | if clean: |
| 74 | flags.DEFINE_boolean( |
| 75 | name="clean", |
| 76 | default=False, |
| 77 | help=help_wrap("If set, model_dir will be removed if it exists.")) |
| 78 | key_flags.append("clean") |
| 79 |
nothing calls this directly
no test coverage detected