@@ -104,7 +104,8 @@ def train(self, input_data_config, output_data_config, hyperparameters, job_name
104
104
os .mkdir (shared_dir )
105
105
106
106
data_dir = self ._create_tmp_folder ()
107
- volumes = self ._prepare_training_volumes (data_dir , input_data_config , hyperparameters )
107
+ volumes = self ._prepare_training_volumes (data_dir , input_data_config , output_data_config ,
108
+ hyperparameters )
108
109
109
110
# Create the configuration files for each container that we will create
110
111
# Each container will map the additional local volumes (if any).
@@ -281,7 +282,8 @@ def write_config_files(self, host, hyperparameters, input_data_config):
281
282
_write_json_file (os .path .join (config_path , 'resourceconfig.json' ), resource_config )
282
283
_write_json_file (os .path .join (config_path , 'inputdataconfig.json' ), json_input_data_config )
283
284
284
- def _prepare_training_volumes (self , data_dir , input_data_config , hyperparameters ):
285
+ def _prepare_training_volumes (self , data_dir , input_data_config , output_data_config ,
286
+ hyperparameters ):
285
287
shared_dir = os .path .join (self .container_root , 'shared' )
286
288
model_dir = os .path .join (self .container_root , 'model' )
287
289
volumes = []
@@ -309,6 +311,14 @@ def _prepare_training_volumes(self, data_dir, input_data_config, hyperparameters
309
311
# Also mount a directory that all the containers can access.
310
312
volumes .append (_Volume (shared_dir , '/opt/ml/shared' ))
311
313
314
+ parsed_uri = urlparse (output_data_config ['S3OutputPath' ])
315
+ if parsed_uri .scheme == 'file' \
316
+ and sagemaker .rl .estimator .SAGEMAKER_OUTPUT_LOCATION in hyperparameters :
317
+ intermediate_dir = os .path .join (parsed_uri .path , 'output' , 'intermediate' )
318
+ if not os .path .exists (intermediate_dir ):
319
+ os .makedirs (intermediate_dir )
320
+ volumes .append (_Volume (intermediate_dir , '/opt/ml/output/intermediate' ))
321
+
312
322
return volumes
313
323
314
324
def _prepare_serving_volumes (self , model_location ):
0 commit comments