Skip to content

Commit 7f9ab2b

Browse files
authored
fix: Mount metadata dir only if it exists (#2052)
1 parent 39c6d5a commit 7f9ab2b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/sagemaker/local/image.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,12 @@ def _prepare_training_volumes(
469469

470470
volumes.append(_Volume(model_dir, "/opt/ml/model"))
471471

472-
# Mount the metadata directory on the notebook instance,
473-
# this is used by some DeepEngine libraries
474-
volumes.append(_Volume("/opt/ml/metadata", "/opt/ml/metadata"))
472+
# Mount the metadata directory if present.
473+
# Only expected to be present on SM notebook instances.
474+
# This is used by some DeepEngine libraries
475+
metadata_dir = "/opt/ml/metadata"
476+
if os.path.isdir(metadata_dir):
477+
volumes.append(_Volume(metadata_dir, metadata_dir))
475478

476479
# Set up the channels for the containers. For local data we will
477480
# mount the local directory to the container. For S3 Data we will download the S3 data

0 commit comments

Comments
 (0)