Python absl.flags.validator() Examples
The following are 4
code examples of absl.flags.validator().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
absl.flags
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: movielens_main.py From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 | 6 votes |
def define_movie_flags(): """Define flags for movie dataset training.""" wide_deep_run_loop.define_wide_deep_flags() flags.DEFINE_enum( name="dataset", default=movielens.ML_1M, enum_values=movielens.DATASETS, case_sensitive=False, help=flags_core.help_wrap("Dataset to be trained and evaluated.")) flags.adopt_module_key_flags(wide_deep_run_loop) flags_core.set_defaults(data_dir="/tmp/movielens-data/", model_dir='/tmp/movie_model', model_type="deep", train_epochs=50, epochs_between_evals=5, inter_op_parallelism_threads=0, intra_op_parallelism_threads=0, batch_size=256) @flags.validator("stop_threshold", message="stop_threshold not supported for movielens model") def _no_stop(stop_threshold): return stop_threshold is None
Example #2
Source File: movielens_main.py From g-tensorflow-models with Apache License 2.0 | 6 votes |
def define_movie_flags(): """Define flags for movie dataset training.""" wide_deep_run_loop.define_wide_deep_flags() flags.DEFINE_enum( name="dataset", default=movielens.ML_1M, enum_values=movielens.DATASETS, case_sensitive=False, help=flags_core.help_wrap("Dataset to be trained and evaluated.")) flags.adopt_module_key_flags(wide_deep_run_loop) flags_core.set_defaults(data_dir="/tmp/movielens-data/", model_dir='/tmp/movie_model', model_type="deep", train_epochs=50, epochs_between_evals=5, inter_op_parallelism_threads=0, intra_op_parallelism_threads=0, batch_size=256) @flags.validator("stop_threshold", message="stop_threshold not supported for movielens model") def _no_stop(stop_threshold): return stop_threshold is None
Example #3
Source File: movielens_main.py From multilabel-image-classification-tensorflow with MIT License | 6 votes |
def define_movie_flags(): """Define flags for movie dataset training.""" wide_deep_run_loop.define_wide_deep_flags() flags.DEFINE_enum( name="dataset", default=movielens.ML_1M, enum_values=movielens.DATASETS, case_sensitive=False, help=flags_core.help_wrap("Dataset to be trained and evaluated.")) flags.adopt_module_key_flags(wide_deep_run_loop) flags_core.set_defaults(data_dir="/tmp/movielens-data/", model_dir='/tmp/movie_model', model_type="deep", train_epochs=50, epochs_between_evals=5, inter_op_parallelism_threads=0, intra_op_parallelism_threads=0, batch_size=256) @flags.validator("stop_threshold", message="stop_threshold not supported for movielens model") def _no_stop(stop_threshold): return stop_threshold is None
Example #4
Source File: argparse_flags_test.py From abseil-py with Apache License 2.0 | 5 votes |
def test_absl_validators(self): @flags.validator('absl_integer', flag_values=self._absl_flags) def ensure_positive(value): return value > 0 parser = argparse_flags.ArgumentParser( inherited_absl_flags=self._absl_flags) with self.assertRaises(SystemExit): parser.parse_args(['--absl_integer', '-2']) del ensure_positive