experiment_saver

class aitoolbox.experiment.experiment_saver.AbstractExperimentSaver[source]

Bases: abc.ABC

abstract save_experiment(model, result_package, training_history, experiment_timestamp=None, save_true_pred_labels=False, separate_files=False, protect_existing_folder=True)[source]

Method which all the experiment savers need to implement which instructs how the experiment should be saved

Parameters
  • model

  • result_package (aitoolbox.ExperimentSave.result_package.AbstractResultPackage) –

  • training_history (aitoolbox.experiment.training_history.TrainingHistory) –

  • experiment_timestamp (str) – time stamp of the training start

  • save_true_pred_labels (bool) – should ground truth labels also be saved

  • separate_files (bool) – should the results be saved in separate pickle files or should all of the results be batched together in a single results file

  • protect_existing_folder (bool) – can override potentially already existing folder or not

Returns

string paths where the experiment files were saved

Return type

list

class aitoolbox.experiment.experiment_saver.BaseFullExperimentSaver(model_saver, results_saver, project_name, experiment_name)[source]

Bases: aitoolbox.experiment.experiment_saver.AbstractExperimentSaver

Base full experiment saver functionality used by the underlying experiment saver derivations

Parameters
save_experiment(model, result_package, training_history, experiment_timestamp=None, save_true_pred_labels=False, separate_files=False, protect_existing_folder=True)[source]

Save the experiment snapshot formed out of the model and model’s results

Parameters
  • model (dict or keras.Model) – model representation. If used with PyTorch it is a simple dict under the hood. In the case of Keras training this would be the keras Model.

  • result_package (aitoolbox.experiment.result_package.abstract_result_packages.AbstractResultPackage) –

  • training_history (aitoolbox.experiment.training_history.TrainingHistory) –

  • experiment_timestamp (str) – time stamp at the start of training

  • save_true_pred_labels (bool) – should ground truth labels also be saved

  • separate_files (bool) – should the results be saved in separate pickle files or should all of the results be batched together in a single results file

  • protect_existing_folder (bool) – can override potentially already existing folder or not

Returns

cloud_model_path, cloud_results_path

Return type

(str, str)

class aitoolbox.experiment.experiment_saver.BaseFullExperimentS3Saver(model_saver, project_name, experiment_name, bucket_name='model-result', cloud_dir_prefix='', local_model_result_folder_path='~/project/model_result')[source]

Bases: aitoolbox.experiment.experiment_saver.BaseFullExperimentSaver

Base experiment saver implementing the S3 saving functionality

This is used by the underlying experiment S3 saver derivations

Parameters
  • model_saver (aitoolbox.cloud.AWS.model_save.AbstractModelSaver) – selected cloud model saver implementing the saving logic for the desired cloud storage provider file saving

  • project_name (str) – root name of the project

  • experiment_name (str) – name of the particular experiment

  • bucket_name (str) – name of the bucket in the cloud storage

  • cloud_dir_prefix (str) – path to the folder inside the bucket where the experiments are going to be saved

  • local_model_result_folder_path (str) – root local path where project folder will be created

class aitoolbox.experiment.experiment_saver.FullPyTorchExperimentS3Saver(project_name, experiment_name, bucket_name='model-result', cloud_dir_prefix='', local_model_result_folder_path='~/project/model_result')[source]

Bases: aitoolbox.experiment.experiment_saver.BaseFullExperimentS3Saver

S3 saver for PyTorch experiments

Parameters
  • project_name (str) – root name of the project

  • experiment_name (str) – name of the particular experiment

  • bucket_name (str) – name of the bucket in the cloud storage

  • cloud_dir_prefix (str) – path to the folder inside the bucket where the experiments are going to be saved

  • local_model_result_folder_path (str) – root local path where project folder will be created

class aitoolbox.experiment.experiment_saver.FullKerasExperimentS3Saver(project_name, experiment_name, bucket_name='model-result', cloud_dir_prefix='', local_model_result_folder_path='~/project/model_result')[source]

Bases: aitoolbox.experiment.experiment_saver.BaseFullExperimentS3Saver

S3 saver for Keras experiments

Parameters
  • project_name (str) – root name of the project

  • experiment_name (str) – name of the particular experiment

  • bucket_name (str) – name of the bucket in the cloud storage

  • cloud_dir_prefix (str) – path to the folder inside the bucket where the experiments are going to be saved

  • local_model_result_folder_path (str) – root local path where project folder will be created

class aitoolbox.experiment.experiment_saver.BaseFullExperimentGoogleStorageSaver(model_saver, project_name, experiment_name, bucket_name='model-result', cloud_dir_prefix='', local_model_result_folder_path='~/project/model_result')[source]

Bases: aitoolbox.experiment.experiment_saver.BaseFullExperimentSaver

Base experiment saver implementing the Google Storage saving functionality

This is used by the underlying experiment Google Storage saver derivations

Parameters
  • model_saver (aitoolbox.cloud.AWS.model_save.AbstractModelSaver) – selected cloud model saver implementing the saving logic for the desired cloud storage provider file saving

  • project_name (str) – root name of the project

  • experiment_name (str) – name of the particular experiment

  • bucket_name (str) – name of the bucket in the cloud storage

  • cloud_dir_prefix (str) – path to the folder inside the bucket where the experiments are going to be saved

  • local_model_result_folder_path (str) – root local path where project folder will be created

class aitoolbox.experiment.experiment_saver.FullPyTorchExperimentGoogleStorageSaver(project_name, experiment_name, bucket_name='model-result', cloud_dir_prefix='', local_model_result_folder_path='~/project/model_result')[source]

Bases: aitoolbox.experiment.experiment_saver.BaseFullExperimentGoogleStorageSaver

Google Storage saver for PyTorch experiments

Parameters
  • project_name (str) – root name of the project

  • experiment_name (str) – name of the particular experiment

  • bucket_name (str) – name of the bucket in the cloud storage

  • cloud_dir_prefix (str) – path to the folder inside the bucket where the experiments are going to be saved

  • local_model_result_folder_path (str) – root local path where project folder will be created

class aitoolbox.experiment.experiment_saver.FullKerasExperimentGoogleStorageSaver(project_name, experiment_name, bucket_name='model-result', cloud_dir_prefix='', local_model_result_folder_path='~/project/model_result')[source]

Bases: aitoolbox.experiment.experiment_saver.BaseFullExperimentGoogleStorageSaver

Google Storage saver for Keras experiments

Parameters
  • project_name (str) – root name of the project

  • experiment_name (str) – name of the particular experiment

  • bucket_name (str) – name of the bucket in the cloud storage

  • cloud_dir_prefix (str) – path to the folder inside the bucket where the experiments are going to be saved

  • local_model_result_folder_path (str) – root local path where project folder will be created