no need track trial id
@@ -19,7 +19,6 @@ import argparse
import logging
import os
import sys
-import time
import hypertune
import numpy as np
@@ -50,6 +49,16 @@ def _train_and_evaluate(estimator, dataset, output_dir):
logging.info(scores)
+ # Write model and eval metrics to `output_dir`
+ model_output_path = os.path.join(
+ output_dir, 'models', metadata.MODEL_FILE_NAME)
+
+ metric_output_path = os.path.join(
+ output_dir, 'metrics', metadata.METRIC_FILE_NAME)
+
+ utils.dump_object(estimator, model_output_path)
+ utils.dump_object(scores, metric_output_path)
+
# The default name of the metric is training/hptuning/metric.
# We recommend that you assign a custom name
# The only functional difference is that if you use a custom name,
@@ -61,21 +70,6 @@ def _train_and_evaluate(estimator, dataset, output_dir):
metric_value=np.mean(scores),
global_step=1000)
- timestamp = str(int(time.time()))
- trial_id = str(hpt.trial_id)
-
- # Write model and eval metrics to `output_dir`
- trial_folder = os.path.join(output_dir, '{}_{}'.format(trial_id, timestamp))
-
- model_output_path = os.path.join(
- trial_folder, 'MODEL', metadata.MODEL_FILE_NAME)
-
- metric_output_path = os.path.join(
- trial_folder, 'METRIC', metadata.METRIC_FILE_NAME)
-
- utils.dump_object(estimator, model_output_path)
- utils.dump_object(scores, metric_output_path)
-
def run_experiment(flags):
"""Testbed for running model training and evaluation."""
