diff --git a/examples/frameworks/tensorflow/absl_flags.py b/examples/frameworks/tensorflow/absl_flags.py new file mode 100644 index 00000000..58d8c08e --- /dev/null +++ b/examples/frameworks/tensorflow/absl_flags.py @@ -0,0 +1,31 @@ +# ClearML - example code, absl parameter logging +# +import sys + +from absl import app +from absl import flags +from absl import logging + +from clearml import Task + +FLAGS = flags.FLAGS + +flags.DEFINE_string("echo", None, "Text to echo.") +flags.DEFINE_string("another_str", "My string", "A string", module_name="test") + +# Connecting ClearML with the current process, +# from here on everything is logged automatically +task = Task.init(project_name="examples", task_name="Abseil example") + +flags.DEFINE_integer("echo3", 3, "Text to echo.") +flags.DEFINE_string("echo5", "5", "Text to echo.", module_name="test") + + +def main(_): + print("Running under Python {0[0]}.{0[1]}.{0[2]}".format(sys.version_info), file=sys.stderr) + logging.info("echo is %s.", FLAGS.echo) + logging.info("echo3 is %s.", FLAGS.echo3) + + +if __name__ == "__main__": + app.run(main) diff --git a/examples/frameworks/tensorflow/requirements.txt b/examples/frameworks/tensorflow/requirements.txt index a1f9ba5f..07c070b3 100644 --- a/examples/frameworks/tensorflow/requirements.txt +++ b/examples/frameworks/tensorflow/requirements.txt @@ -1,3 +1,4 @@ +absl-py>=0.7.1 tensorboard>=2.0 tensorflow>=2.0 clearml \ No newline at end of file diff --git a/examples/reporting/hyper_parameters.py b/examples/reporting/hyper_parameters.py index b3802781..5e0eae45 100644 --- a/examples/reporting/hyper_parameters.py +++ b/examples/reporting/hyper_parameters.py @@ -1,4 +1,4 @@ -# ClearML - example code, ArgumentParser parameter logging, absl parameter logging, and dictionary parameter logging +# ClearML - example code, ArgumentParser parameter logging and dictionary parameter logging # from __future__ import absolute_import from __future__ import division @@ -7,25 +7,13 @@ from __future__ import print_function import sys from argparse import ArgumentParser -from absl import app -from absl import flags -from absl import logging from clearml import Task - -FLAGS = flags.FLAGS - -flags.DEFINE_string('echo', None, 'Text to echo.') -flags.DEFINE_string('another_str', 'My string', 'A string', module_name='test') - # Connecting ClearML with the current process, # from here on everything is logged automatically task = Task.init(project_name='examples', task_name='hyper-parameters example') -flags.DEFINE_integer('echo3', 3, 'Text to echo.') -flags.DEFINE_string('echo5', '5', 'Text to echo.', module_name='test') - parameters = { 'list': [1, 2, 3], 'dict': {'a': 1, 'b': 2}, @@ -57,11 +45,6 @@ complex_nested_dict_configuration = task.connect_configuration( print(complex_nested_dict_configuration) -def main(_): - print('Running under Python {0[0]}.{0[1]}.{0[2]}'.format(sys.version_info), file=sys.stderr) - logging.info('echo is %s.', FLAGS.echo) - - if __name__ == '__main__': parser = ArgumentParser() parser.add_argument('--argparser_int_value', help='integer value', type=int, default=1) @@ -70,4 +53,6 @@ if __name__ == '__main__': args = parser.parse_args() - app.run(main) + print('Running under Python {0[0]}.{0[1]}.{0[2]}'.format(sys.version_info), file=sys.stderr) + task_params = task.get_parameters() + print("Task parameters are: {}".format(task_params)) diff --git a/examples/reporting/requirements.txt b/examples/reporting/requirements.txt index dcb630be..f02c1f79 100644 --- a/examples/reporting/requirements.txt +++ b/examples/reporting/requirements.txt @@ -1,4 +1,3 @@ -absl-py>=0.7.1 bokeh>=1.4.0 matplotlib >= 3.1.1 ; python_version >= '3.6' matplotlib >= 2.2.4 ; python_version < '3.6'