def test_log_param_writes_params_to_redis(self): self._set_job_id('my_id') log_param('this_param', 'cool_value') log_param('that_param', 42) expected_loaded_parameters = { 'this_param': 'cool_value', 'that_param': 42 } self._assert_flattened_parameter_keys_in_project_job_parameter_names_set( 'default', expected_loaded_parameters) self._assert_flattened_parameter_values_for_job_in_job_parameters( 'my_id', expected_loaded_parameters) self._assert_flattened_parameter_keys_in_project_input_parameter_names_set( 'default', expected_loaded_parameters) self._assert_flattened_parameter_names_for_job_in_job_input_parameters( 'my_id', expected_loaded_parameters)
""" This sample main.py shows basic Atlas functionality. In this script, we will log some arbitrary values & artifacts that can be viewed in the Atlas GUI """ import foundations depth = 3 epochs = 5 batch_size = 256 lrate = 1e-3 # Log some hyper-parameters foundations.log_param('depth', depth) foundations.log_params({'epochs': epochs, 'batch_size': batch_size, 'learning_rate': lrate}) # Log some metrics accuracy = 0.9 loss = 0.1 foundations.log_metric('accuracy', accuracy) foundations.log_metric('loss', loss) # Log an artifact that is already saved to disk foundations.save_artifact('README.txt', 'Project_README')
import foundations foundations.log_metric('key', 'value') foundations.set_tag('key', value='value') foundations.log_param('param', 'param_value') print('Hello World!')
import foundations from foundations_contrib.global_state import current_foundations_context, redis_connection foundations.log_metric('ugh', 10) with open('thomas_text.txt', 'w') as f: f.write('ugh_square') foundations.save_artifact('thomas_text.txt', 'just_some_artifact') foundations.log_param('blah', 20) redis_connection.set('foundations_testing_job_id', current_foundations_context().pipeline_context().job_id)
import numpy as np import foundations model_params = { 'num_freq_bin': 240, 'num_conv_blocks': 8, 'num_conv_filters': 32, 'spatial_dropout_fraction': 0.05, 'num_dense_layers': 1, 'num_dense_neurons': 50, 'dense_dropout': 0, 'learning_rate': 0.0001, 'epochs': 100, 'batch_size': 156, 'residual_con': 2, 'use_default': True, 'model_save_dir': 'fitted_objects' } for k, v in model_params.items(): foundations.log_param(k, v) train_accuracy = np.random.rand() foundations.log_metric("train_accuracy", train_accuracy) foundations.log_metric("val_accuracy", train_accuracy * 0.85) # foundations.save_artifact('visualize_inference_spectrogram.png', key='spectrogram')
import foundations from time import sleep foundations.log_param("param_float", 1.) foundations.log_param("param_large_float", 999999999.8888888888888888) foundations.log_param("param_list_of_floats", [1., 2.]) foundations.log_param("param_long_list_of_floats", [ 1., 2., 1., 2., 1., 2., 1., 2., 1., 2., 1., 2., 1., 2., 1., 2., 1., 2., 1., 2., ]) foundations.log_param("param_long_list_of_long_floats", [ 999999999.8888888888888888, 999999999.8888888888888888, 999999999.8888888888888888, 999999999.8888888888888888,
import foundations from time import sleep foundations.log_param("param_int", 1) foundations.log_param("param_large_int", 8888888888888888888888888) foundations.log_param("param_list_of_ints", [1, 2]) foundations.log_param("param_long_list_of_ints", [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ]) foundations.log_param("param_long_list_of_long_ints", [ 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888, 8888888888888888888888888 ]) foundations.log_param("param_mixed_type", 1) for i in range(20): foundations.log_param("param_repeat", i) sleep(.1)
import foundations from time import sleep foundations.log_param("param_str", str(1.)) foundations.log_param( "param_long_str", "asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdf" ) foundations.log_param("param_long_list_of_str", [ "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe", "qwe",