Exemplo n.º 1
0
def copy_experiment(src_experiment, dst_exp_name, dst_uri, log_source_info=False, log_batch=False):
    src_client, dst_client, dst_exp = copy_run.setup(dst_exp_name, dst_uri, log_source_info)
    src_exp = mlflow_utils.get_experiment(src_client, src_experiment)
    print("src_experiment_name:",src_exp.name)
    print("src_experiment_id:",src_exp.experiment_id)
    infos = src_client.list_run_infos(src_exp.experiment_id)
    for j,info in enumerate(infos):
        print("Copying run {}/{}: {}".format((j+1),len(infos),info.run_id),flush=True)
        copy_run.copy_run2(src_client, info.run_id, dst_client, dst_exp.experiment_id, log_source_info, log_batch)
Exemplo n.º 2
0
 def copy_experiment(self, src_exp_id_or_name, dst_exp_name):
     src_exp = mlflow_utils.get_experiment(self.src_client, src_exp_id_or_name)
     dst_exp = self.get_experiment(self.dst_client, dst_exp_name)
     print("src_experiment_name:",src_exp.name)
     print("src_experiment_id:",src_exp.experiment_id)
     infos = self.src_client.list_run_infos(src_exp.experiment_id)
     for j,info in enumerate(infos):
         print("Copying run {}/{}: {}".format((j+1),len(infos),info.run_id),flush=True)
         self.run_copier._copy_run(info.run_id, dst_exp.experiment_id)
Exemplo n.º 3
0
def export_experiment(exp_id_or_name, output, log_source_info=False):
    exp = mlflow_utils.get_experiment(client, exp_id_or_name)
    exp_id = exp.experiment_id

    print("Exporting experiment '{}' (ID {}) to '{}'".format(
        exp.name, exp.experiment_id, output),
          flush=True)
    if output.endswith(".zip"):
        export_experiment_to_zip(exp_id, output, log_source_info)
    else:
        os.makedirs(output)
        export_experiment_to_dir(exp_id, output, log_source_info)
Exemplo n.º 4
0
 def export_experiment(self,
                       exp_id_or_name,
                       output,
                       export_metadata_tags=False,
                       notebook_formats=["SOURCE"]):
     exp = mlflow_utils.get_experiment(self.client, exp_id_or_name)
     exp_id = exp.experiment_id
     print("Exporting experiment '{}' (ID {}) to '{}'".format(
         exp.name, exp.experiment_id, output),
           flush=True)
     if output.endswith(".zip"):
         self.export_experiment_to_zip(exp_id, output, export_metadata_tags)
     else:
         self.fs.mkdirs(output)
         self.export_experiment_to_dir(exp_id, output)
    parser.add_argument("--pretty_time", dest="pretty_time", help="Show info", required=False, default=False, action='store_true')
    parser.add_argument("--duration", dest="duration", help="Show duration", required=False, default=False, action='store_true')
    parser.add_argument("--nan_to_blank", dest="nan_to_blank", help="nan_to_blank", required=False, default=False, action='store_true')
    parser.add_argument("--skip_params", dest="skip_params", help="skip_params", required=False, default=False, action='store_true')
    parser.add_argument("--skip_metrics", dest="skip_metrics", help="skip_metrics", required=False, default=False, action='store_true')
    parser.add_argument("--skip_tags", dest="skip_tags", help="skip_tags", required=False, default=False, action='store_true')
    parser.add_argument("--csv_file", dest="csv_file", help="CSV file")

    args = parser.parse_args()
    print("Options:")
    for arg in vars(args):
        print("  {}: {}".format(arg,getattr(args, arg)))

    client = mlflow.tracking.MlflowClient()
    smart_client = MlflowSmartClient()
    exp = mlflow_utils.get_experiment(client, args.experiment_id_or_name)
    exp_id = exp.experiment_id
    print("experiment_id:",exp_id)
    runs = smart_client.list_runs(exp_id)

    converter = RunsToPandasConverter(args.sort, args.pretty_time, args.duration, args.skip_params, args.skip_metrics, args.skip_tags)

    df = converter.to_pandas_df(runs)

    print(tabulate(df, headers='keys', tablefmt='psql'))

    path = "exp_runs_{}.csv".format(exp_id) if args.csv_file is None else args.csv_file
    print("Output CSV file:",path)
    with open(path, 'w') as f:
        df.to_csv(f, index=False)