Set up for input steps data. Remove parent run id file writing.

This commit is contained in:
Mario Bourgoin 2019-10-16 16:24:56 -04:00
Родитель 0bbb8a8d5c
Коммит 2f69b2a958
1 изменённых файлов: 4 добавлений и 16 удалений

Просмотреть файл

@ -200,11 +200,9 @@
" parser.add_argument('--verbose',\n",
" help='the verbosity of the estimator',\n",
" type=int, default=-1)\n",
" parser.add_argument('--steps-data', dest=\"steps_data\",\n",
" parser.add_argument('--input-steps-data', dest=\"input_steps_data\",\n",
" help='to share data between different steps in a pipeline',\n",
" default='outputs')\n",
" parser.add_argument('--save-run-id', dest=\"save_run_id\",\n",
" help='the parent run id file base name', default='None')\n",
" default='data')\n",
" parser.add_argument('--hyperparameters',\n",
" help='hyperparameter config file base name', default='None')\n",
" args = parser.parse_args()\n",
@ -246,13 +244,10 @@
" model_path = os.path.join(outputs_path, '{}.pkl'.format(args.save))\n",
" \n",
" # Paths for steps data\n",
" steps_data_path = args.steps_data\n",
" run_id_path = os.path.join(steps_data_path, args.save_run_id)\n",
" hyperparameters_path = os.path.join(steps_data_path, args.hyperparameters)\n",
" hyperparameters_path = os.path.join(args.input_steps_data, args.hyperparameters)\n",
"\n",
" # Create the outputs folder.\n",
" os.makedirs(outputs_path, exist_ok=True)\n",
" os.makedirs(args.steps_data, exist_ok=True)\n",
" \n",
" # Create a dict of hyperparameters from the input flags.\n",
" hyperparameters = {\n",
@ -434,14 +429,7 @@
" print('Saving the model to {}'.format(model_path))\n",
" joblib.dump(model, model_path)\n",
" print('{}: {:.2f} MB'\n",
" .format(model_path, os.path.getsize(model_path)/(2**20)))\n",
" \n",
" # Write the parent run id to a file.\n",
" if args.save_run_id != 'None' and not os.path.isfile(run_id_path):\n",
" print('Saving the run id to {}'.format(run_id_path))\n",
" parent_run_id = run.parent.id\n",
" with open(run_id_path, \"w\") as fp:\n",
" fp.write(parent_run_id)"
" .format(model_path, os.path.getsize(model_path)/(2**20)))"
]
},
{