From c97c4678b89ff89bda6f1ea4573803d7e1bcb947 Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 2 Dec 2022 12:48:09 -0800 Subject: [PATCH 01/41] fix: type hint of PySparkProcessor __init__ (#3297) From de589419595fbf7bf76e55745f454864cc5998be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Perez?= Date: Fri, 2 Dec 2022 22:01:39 +0100 Subject: [PATCH 02/41] fix: fix PySparkProcessor __init__ params type (#3354) From 41dd3305c2673a4f85e54eec9858f37393c89431 Mon Sep 17 00:00:00 2001 From: Shreya Pandit Date: Fri, 2 Dec 2022 13:18:14 -0800 Subject: [PATCH 03/41] fix: Allow Py 3.7 for MMS Test Docker env (#3080) Co-authored-by: Mufaddal Rohawala --- tests/data/multimodel/container/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/data/multimodel/container/Dockerfile b/tests/data/multimodel/container/Dockerfile index 4792a429c1..71c38a6605 100644 --- a/tests/data/multimodel/container/Dockerfile +++ b/tests/data/multimodel/container/Dockerfile @@ -1,4 +1,5 @@ -FROM public.ecr.aws/ubuntu/ubuntu:18.04 +# added latest image from https://gallery.ecr.aws/lts/ubuntu +FROM public.ecr.aws/ubuntu/ubuntu:22.04 # Set a docker label to advertise multi-model support on the container LABEL com.amazonaws.sagemaker.capabilities.multi-models=true @@ -15,7 +16,7 @@ RUN apt-get update && \ curl \ vim \ && rm -rf /var/lib/apt/lists/* \ - && curl -O https://bootstrap.pypa.io/pip/3.6/get-pip.py \ + && curl -O https://bootstrap.pypa.io/pip/get-pip.py \ && python3 get-pip.py RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 From 1e23a3f6a7cf554aa537c5c4e21e35548053a6ee Mon Sep 17 00:00:00 2001 From: maldil Date: Fri, 2 Dec 2022 13:19:59 -0800 Subject: [PATCH 04/41] refactoring : using with statement (#3286) --- src/sagemaker/git_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sagemaker/git_utils.py b/src/sagemaker/git_utils.py index 80bd62d5be..c424753286 100644 --- a/src/sagemaker/git_utils.py +++ b/src/sagemaker/git_utils.py @@ -279,9 +279,8 @@ def _run_clone_command(repo_url, dest_dir): subprocess.check_call(["git", "clone", repo_url, dest_dir], env=my_env) elif repo_url.startswith("git@"): with tempfile.NamedTemporaryFile() as sshnoprompt: - write_pipe = open(sshnoprompt.name, "w") - write_pipe.write("ssh -oBatchMode=yes $@") - write_pipe.close() + with open(sshnoprompt.name, "w") as write_pipe: + write_pipe.write("ssh -oBatchMode=yes $@") os.chmod(sshnoprompt.name, 0o511) my_env["GIT_SSH"] = sshnoprompt.name subprocess.check_call(["git", "clone", repo_url, dest_dir], env=my_env) From 19efadf043678a6c7da4122368d6141e1ec2df10 Mon Sep 17 00:00:00 2001 From: Shreya Pandit Date: Fri, 2 Dec 2022 13:21:34 -0800 Subject: [PATCH 05/41] Update local_requirements.txt PyYAML version (#3095) Co-authored-by: Basil Beirouti Co-authored-by: Kalyani Nikure <110067132+knikure@users.noreply.github.com> --- requirements/extras/local_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/extras/local_requirements.txt b/requirements/extras/local_requirements.txt index 5304d82b2a..5f2c85c2fe 100644 --- a/requirements/extras/local_requirements.txt +++ b/requirements/extras/local_requirements.txt @@ -1,4 +1,4 @@ urllib3==1.26.8 docker-compose==1.29.2 docker>=5.0.2,<7.0.0 -PyYAML==5.4.1 +PyYAML==6.0.0 From 76f7782db112b38cb7e058dffb1508f2d34fb50b Mon Sep 17 00:00:00 2001 From: arjkesh <33526713+arjkesh@users.noreply.github.com> Date: Fri, 2 Dec 2022 13:22:35 -0800 Subject: [PATCH 06/41] feature: Update TF 2.9 and TF 2.10 inference DLCs (#3465) --- .../image_uri_config/tensorflow.json | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/src/sagemaker/image_uri_config/tensorflow.json b/src/sagemaker/image_uri_config/tensorflow.json index 6a01c3e3e6..0122dcd3ca 100644 --- a/src/sagemaker/image_uri_config/tensorflow.json +++ b/src/sagemaker/image_uri_config/tensorflow.json @@ -285,7 +285,9 @@ "2.5": "2.5.1", "2.6": "2.6.3", "2.7": "2.7.0", - "2.8": "2.8.0" + "2.8": "2.8.0", + "2.9": "2.9.2", + "2.10": "2.10.0" }, "versions": { "1.10.0": { @@ -1468,6 +1470,68 @@ "us-west-2": "763104351884" }, "repository": "tensorflow-inference" + }, + "2.9.2": { + "registries": { + "af-south-1": "626614931356", + "ap-east-1": "871362719292", + "ap-northeast-1": "763104351884", + "ap-northeast-2": "763104351884", + "ap-northeast-3": "364406365360", + "ap-south-1": "763104351884", + "ap-southeast-1": "763104351884", + "ap-southeast-2": "763104351884", + "ap-southeast-3": "907027046896", + "ca-central-1": "763104351884", + "cn-north-1": "727897471807", + "cn-northwest-1": "727897471807", + "eu-central-1": "763104351884", + "eu-north-1": "763104351884", + "eu-south-1": "692866216735", + "eu-west-1": "763104351884", + "eu-west-2": "763104351884", + "eu-west-3": "763104351884", + "me-south-1": "217643126080", + "sa-east-1": "763104351884", + "us-east-1": "763104351884", + "us-east-2": "763104351884", + "us-gov-west-1": "442386744353", + "us-iso-east-1": "886529160074", + "us-west-1": "763104351884", + "us-west-2": "763104351884" + }, + "repository": "tensorflow-inference" + }, + "2.10.0": { + "registries": { + "af-south-1": "626614931356", + "ap-east-1": "871362719292", + "ap-northeast-1": "763104351884", + "ap-northeast-2": "763104351884", + "ap-northeast-3": "364406365360", + "ap-south-1": "763104351884", + "ap-southeast-1": "763104351884", + "ap-southeast-2": "763104351884", + "ap-southeast-3": "907027046896", + "ca-central-1": "763104351884", + "cn-north-1": "727897471807", + "cn-northwest-1": "727897471807", + "eu-central-1": "763104351884", + "eu-north-1": "763104351884", + "eu-south-1": "692866216735", + "eu-west-1": "763104351884", + "eu-west-2": "763104351884", + "eu-west-3": "763104351884", + "me-south-1": "217643126080", + "sa-east-1": "763104351884", + "us-east-1": "763104351884", + "us-east-2": "763104351884", + "us-gov-west-1": "442386744353", + "us-iso-east-1": "886529160074", + "us-west-1": "763104351884", + "us-west-2": "763104351884" + }, + "repository": "tensorflow-inference" } } }, From fde07388dc26cb270a0a0dfba91439c64e87751a Mon Sep 17 00:00:00 2001 From: Keshav Chandak Date: Sat, 3 Dec 2022 03:41:10 +0530 Subject: [PATCH 07/41] feature: Added transform with monitoring pipeline step in transformer (#3438) Co-authored-by: Keshav Chandak --- src/sagemaker/transformer.py | 158 +++++++++++++++++++++++++++++++- tests/integ/test_transformer.py | 66 ++++++++++++- 2 files changed, 220 insertions(+), 4 deletions(-) diff --git a/src/sagemaker/transformer.py b/src/sagemaker/transformer.py index cfcc637b99..97278abdd0 100644 --- a/src/sagemaker/transformer.py +++ b/src/sagemaker/transformer.py @@ -14,14 +14,17 @@ from __future__ import absolute_import from typing import Union, Optional, List, Dict -from botocore import exceptions +import logging +import copy +import time +from botocore import exceptions from sagemaker.job import _Job -from sagemaker.session import Session +from sagemaker.session import Session, get_execution_role from sagemaker.inputs import BatchDataCaptureConfig from sagemaker.workflow.entities import PipelineVariable from sagemaker.workflow.functions import Join -from sagemaker.workflow.pipeline_context import runnable_by_pipeline +from sagemaker.workflow.pipeline_context import runnable_by_pipeline, PipelineSession from sagemaker.workflow import is_pipeline_variable from sagemaker.workflow.execution_variables import ExecutionVariables from sagemaker.utils import base_name_from_image, name_from_base @@ -266,6 +269,155 @@ def transform( if wait: self.latest_transform_job.wait(logs=logs) + def transform_with_monitoring( + self, + monitoring_config, + monitoring_resource_config, + data: str, + data_type: str = "S3Prefix", + content_type: str = None, + compression_type: str = None, + split_type: str = None, + input_filter: str = None, + output_filter: str = None, + join_source: str = None, + model_client_config: Dict[str, str] = None, + batch_data_capture_config: BatchDataCaptureConfig = None, + monitor_before_transform: bool = False, + supplied_baseline_statistics: str = None, + supplied_baseline_constraints: str = None, + wait: bool = True, + pipeline_name: str = None, + role: str = None, + ): + """Runs a transform job with monitoring job. + + Note that this function will not start a transform job immediately, + instead, it will create a SageMaker Pipeline and execute it. + If you provide an existing pipeline_name, no new pipeline will be created, otherwise, + each transform_with_monitoring call will create a new pipeline and execute. + + Args: + monitoring_config (Union[ + `sagemaker.workflow.quality_check_step.QualityCheckConfig`, + `sagemaker.workflow.quality_check_step.ClarifyCheckConfig` + ]): the monitoring configuration used for run model monitoring. + monitoring_resource_config (`sagemaker.workflow.check_job_config.CheckJobConfig`): + the check job (processing job) cluster resource configuration. + transform_step_args (_JobStepArguments): the transform step transform arguments. + data (str): Input data location in S3 for the transform job + data_type (str): What the S3 location defines (default: 'S3Prefix'). + Valid values: + * 'S3Prefix' - the S3 URI defines a key name prefix. All objects with this prefix + will be used as inputs for the transform job. + * 'ManifestFile' - the S3 URI points to a single manifest file listing each S3 + object to use as an input for the transform job. + content_type (str): MIME type of the input data (default: None). + compression_type (str): Compression type of the input data, if + compressed (default: None). Valid values: 'Gzip', None. + split_type (str): The record delimiter for the input object + (default: 'None'). Valid values: 'None', 'Line', 'RecordIO', and + 'TFRecord'. + input_filter (str): A JSONPath to select a portion of the input to + pass to the algorithm container for inference. If you omit the + field, it gets the value '$', representing the entire input. + For CSV data, each row is taken as a JSON array, + so only index-based JSONPaths can be applied, e.g. $[0], $[1:]. + CSV data should follow the `RFC format `_. + See `Supported JSONPath Operators + `_ + for a table of supported JSONPath operators. + For more information, see the SageMaker API documentation for + `CreateTransformJob + `_. + Some examples: "$[1:]", "$.features" (default: None). + output_filter (str): A JSONPath to select a portion of the + joined/original output to return as the output. + For more information, see the SageMaker API documentation for + `CreateTransformJob + `_. + Some examples: "$[1:]", "$.prediction" (default: None). + join_source (str): The source of data to be joined to the transform + output. It can be set to 'Input' meaning the entire input record + will be joined to the inference result. You can use OutputFilter + to select the useful portion before uploading to S3. (default: + None). Valid values: Input, None. + model_client_config (dict[str, str]): Model configuration. + Dictionary contains two optional keys, + 'InvocationsTimeoutInSeconds', and 'InvocationsMaxRetries'. + (default: ``None``). + batch_data_capture_config (BatchDataCaptureConfig): Configuration object which + specifies the configurations related to the batch data capture for the transform job + (default: ``None``). + monitor_before_transform (bgool): If to run data quality + or model explainability monitoring type, + a true value of this flag indicates running the check step before the transform job. + fail_on_violation (Union[bool, PipelineVariable]): A opt-out flag to not to fail the + check step when a violation is detected. + supplied_baseline_statistics (Union[str, PipelineVariable]): The S3 path + to the supplied statistics object representing the statistics JSON file + which will be used for drift to check (default: None). + supplied_baseline_constraints (Union[str, PipelineVariable]): The S3 path + to the supplied constraints object representing the constraints JSON file + which will be used for drift to check (default: None). + wait (bool): To determine if needed to wait for the pipeline execution to complete + pipeline_name (str): The name of the Pipeline for the monitoring and transfrom step + role (str): Execution role + """ + + transformer = self + if not isinstance(self.sagemaker_session, PipelineSession): + sagemaker_session = self.sagemaker_session + self.sagemaker_session = None + transformer = copy.deepcopy(self) + transformer.sagemaker_session = PipelineSession() + self.sagemaker_session = sagemaker_session + + transform_step_args = transformer.transform( + data=data, + data_type=data_type, + content_type=content_type, + compression_type=compression_type, + split_type=split_type, + input_filter=input_filter, + output_filter=output_filter, + batch_data_capture_config=batch_data_capture_config, + join_source=join_source, + model_client_config=model_client_config, + ) + + from sagemaker.workflow.monitor_batch_transform_step import MonitorBatchTransformStep + + monitoring_batch_step = MonitorBatchTransformStep( + name="MonitorBatchTransformStep", + display_name="MonitorBatchTransformStep", + description="", + transform_step_args=transform_step_args, + monitor_configuration=monitoring_config, + check_job_configuration=monitoring_resource_config, + monitor_before_transform=monitor_before_transform, + supplied_baseline_constraints=supplied_baseline_constraints, + supplied_baseline_statistics=supplied_baseline_statistics, + ) + + pipeline_name = ( + pipeline_name if pipeline_name else f"TransformWithMonitoring{int(time.time())}" + ) + # if pipeline exists, just start the execution + from sagemaker.workflow.pipeline import Pipeline + + pipeline = Pipeline( + name=pipeline_name, + steps=[monitoring_batch_step], + sagemaker_session=transformer.sagemaker_session, + ) + pipeline.upsert(role_arn=role if role else get_execution_role()) + execution = pipeline.start() + if wait: + logging.info("Waiting for transform with monitoring to execute ...") + execution.wait() + return execution + def delete_model(self): """Delete the corresponding SageMaker model for this Transformer.""" self.sagemaker_session.delete_model(self.model_name) diff --git a/tests/integ/test_transformer.py b/tests/integ/test_transformer.py index a0e37ffc77..1de333b987 100644 --- a/tests/integ/test_transformer.py +++ b/tests/integ/test_transformer.py @@ -25,6 +25,7 @@ from sagemaker.transformer import Transformer from sagemaker.estimator import Estimator from sagemaker.inputs import BatchDataCaptureConfig +from sagemaker.xgboost import XGBoostModel from sagemaker.utils import unique_name_from_base from tests.integ import ( datasets, @@ -36,7 +37,7 @@ from tests.integ.timeout import timeout, timeout_and_delete_model_with_transformer from tests.integ.vpc_test_utils import get_or_create_vpc_resources -from sagemaker.model_monitor import DatasetFormat, Statistics +from sagemaker.model_monitor import DatasetFormat, Statistics, Constraints from sagemaker.workflow.check_job_config import CheckJobConfig from sagemaker.workflow.quality_check_step import ( @@ -645,3 +646,66 @@ def _create_transformer_and_transform_job( job_name=unique_name_from_base("test-transform"), ) return transformer + + +def test_transformer_and_monitoring_job( + pipeline_session, + sagemaker_session, + role, + pipeline_name, + check_job_config, + data_bias_check_config, +): + xgb_model_data_s3 = pipeline_session.upload_data( + path=os.path.join(os.path.join(DATA_DIR, "xgboost_abalone"), "xgb_model.tar.gz"), + key_prefix="integ-test-data/xgboost/model", + ) + data_bias_supplied_baseline_constraints = Constraints.from_file_path( + constraints_file_path=os.path.join( + DATA_DIR, "pipeline/clarify_check_step/data_bias/good_cases/analysis.json" + ), + sagemaker_session=sagemaker_session, + ).file_s3_uri + + xgb_model = XGBoostModel( + model_data=xgb_model_data_s3, + framework_version="1.3-1", + role=role, + sagemaker_session=sagemaker_session, + entry_point=os.path.join(os.path.join(DATA_DIR, "xgboost_abalone"), "inference.py"), + enable_network_isolation=True, + ) + + xgb_model.deploy(_INSTANCE_COUNT, _INSTANCE_TYPE) + + transform_output = f"s3://{sagemaker_session.default_bucket()}/{pipeline_name}Transform" + transformer = Transformer( + model_name=xgb_model.name, + strategy="SingleRecord", + instance_type="ml.m5.xlarge", + instance_count=1, + output_path=transform_output, + sagemaker_session=pipeline_session, + ) + + transform_input = pipeline_session.upload_data( + path=os.path.join(DATA_DIR, "xgboost_abalone", "abalone"), + key_prefix="integ-test-data/xgboost_abalone/abalone", + ) + + execution = transformer.transform_with_monitoring( + monitoring_config=data_bias_check_config, + monitoring_resource_config=check_job_config, + data=transform_input, + content_type="text/libsvm", + supplied_baseline_constraints=data_bias_supplied_baseline_constraints, + role=role, + ) + + execution_steps = execution.list_steps() + assert len(execution_steps) == 2 + + for execution_step in execution_steps: + assert execution_step["StepStatus"] == "Succeeded" + + xgb_model.delete_model() From 7f9f3b04b6704a4d2378b5d9aa3d37de9db45729 Mon Sep 17 00:00:00 2001 From: Clayton Parnell <42805768+claytonparnell@users.noreply.github.com> Date: Fri, 2 Dec 2022 17:12:34 -0500 Subject: [PATCH 08/41] fix: Fix bug forcing uploaded tar to be named sourcedir (#3412) --- src/sagemaker/processing.py | 19 +++++++++++-------- tests/integ/test_xgboost.py | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/sagemaker/processing.py b/src/sagemaker/processing.py index db6ce2badd..308783578d 100644 --- a/src/sagemaker/processing.py +++ b/src/sagemaker/processing.py @@ -1587,13 +1587,13 @@ def run( # type: ignore[override] framework script to run.Path (absolute or relative) to the local Python source file which should be executed as the entry point to training. When `code` is an S3 URI, ignore `source_dir`, - `dependencies, and `git_config`. If ``source_dir`` is specified, + `dependencies`, and `git_config`. If ``source_dir`` is specified, then ``code`` must point to a file located at the root of ``source_dir``. source_dir (str): Path (absolute, relative or an S3 URI) to a directory with any other processing source code dependencies aside from the entry point file (default: None). If ``source_dir`` is an S3 URI, it must - point to a tar.gz file. Structure within this directory are preserved - when processing on Amazon SageMaker (default: None). + point to a file named `sourcedir.tar.gz`. Structure within this directory + are preserved when processing on Amazon SageMaker (default: None). dependencies (list[str]): A list of paths to directories (absolute or relative) with any additional libraries that will be exported to the container (default: []). The library folders will be @@ -1730,12 +1730,15 @@ def _pack_and_upload_code( "sagemaker_session unspecified when creating your Processor to have one set up " "automatically." ) + if "/sourcedir.tar.gz" in estimator.uploaded_code.s3_prefix: + # Upload the bootstrapping code as s3://.../jobname/source/runproc.sh. + entrypoint_s3_uri = estimator.uploaded_code.s3_prefix.replace( + "sourcedir.tar.gz", + "runproc.sh", + ) + else: + raise RuntimeError("S3 source_dir file must be named `sourcedir.tar.gz.`") - # Upload the bootstrapping code as s3://.../jobname/source/runproc.sh. - entrypoint_s3_uri = estimator.uploaded_code.s3_prefix.replace( - "sourcedir.tar.gz", - "runproc.sh", - ) script = estimator.uploaded_code.script_name s3_runproc_sh = S3Uploader.upload_string_as_file_body( self._generate_framework_script(script), diff --git a/tests/integ/test_xgboost.py b/tests/integ/test_xgboost.py index 733ab4665a..df06a8863a 100644 --- a/tests/integ/test_xgboost.py +++ b/tests/integ/test_xgboost.py @@ -40,6 +40,26 @@ def xgboost_training_job( ) +def test_sourcedir_naming( + sagemaker_session, + xgboost_latest_version, + xgboost_latest_py_version, + cpu_instance_type, +): + with pytest.raises(RuntimeError): + processor = XGBoostProcessor( + framework_version=xgboost_latest_version, + role=ROLE, + instance_count=1, + instance_type=cpu_instance_type, + sagemaker_session=sagemaker_session, + ) + processor.run( + source_dir="s3://bucket/deps.tar.gz", + code="main_script.py", + ) + + @pytest.mark.release def test_framework_processing_job_with_deps( sagemaker_session, From 5d5976726cb8e0cf7143d86b4abb4b665842fd14 Mon Sep 17 00:00:00 2001 From: Navin Soni Date: Fri, 2 Dec 2022 14:32:01 -0800 Subject: [PATCH 09/41] feature: Add Code Owners file (#3503) Co-authored-by: Navin Soni --- CODEOWNERS | 1 + requirements/extras/local_requirements.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000000..7f7ac28644 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @aws/sagemaker-ml-frameworks diff --git a/requirements/extras/local_requirements.txt b/requirements/extras/local_requirements.txt index 5f2c85c2fe..5304d82b2a 100644 --- a/requirements/extras/local_requirements.txt +++ b/requirements/extras/local_requirements.txt @@ -1,4 +1,4 @@ urllib3==1.26.8 docker-compose==1.29.2 docker>=5.0.2,<7.0.0 -PyYAML==6.0.0 +PyYAML==5.4.1 From 0f5cf1824c0b116c9b218c803f3b94a85e09fd45 Mon Sep 17 00:00:00 2001 From: ci Date: Sat, 3 Dec 2022 03:22:39 +0000 Subject: [PATCH 10/41] prepare release v2.119.0 --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ VERSION | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95e4a7b9cf..b8b3155231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## v2.119.0 (2022-12-03) + +### Features + + * Add Code Owners file + * Added transform with monitoring pipeline step in transformer + * Update TF 2.9 and TF 2.10 inference DLCs + * make estimator accept json file as modelparallel config + * SageMaker Training Compiler does not support p4de instances + * Add support for SparkML v3.3 + +### Bug Fixes and Other Changes + + * Fix bug forcing uploaded tar to be named sourcedir + * Update local_requirements.txt PyYAML version + * refactoring : using with statement + * Allow Py 3.7 for MMS Test Docker env + * fix PySparkProcessor __init__ params type + * type hint of PySparkProcessor __init__ + * Return ARM XGB/SKLearn tags if `image_scope` is `inference_graviton` + * Update scipy to 1.7.3 to support M1 development envs + * Fixing type hints for Spark processor that has instance type/count params in reverse order + * Add DeepAR ap-northeast-3 repository. + * Fix AsyncInferenceConfig documentation typo + * fix ml_inf to ml_inf1 in Neo multi-version support + * Fix type annotations + * add neo mvp region accounts + ## v2.118.0 (2022-12-01) ### Features diff --git a/VERSION b/VERSION index 34d47b7f52..23fe2bf317 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.118.1.dev0 +2.119.0 From f1f0013dc0375aa22805b3a59b82cd2b1a08d40a Mon Sep 17 00:00:00 2001 From: ci Date: Sat, 3 Dec 2022 03:22:41 +0000 Subject: [PATCH 11/41] update development version to v2.119.1.dev0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 23fe2bf317..dda4128cf2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.119.0 +2.119.1.dev0 From bb4b6897971a4e5ae0cbde948ef1682a64232b41 Mon Sep 17 00:00:00 2001 From: Radhika Bhat <78102284+RadhikaB-97@users.noreply.github.com> Date: Mon, 5 Dec 2022 10:06:58 -0800 Subject: [PATCH 12/41] feature: Add DXB region to frameworks by DLC (#3387) * Add DXB region * Remove change from neuron * Adding DXB to TF 2.1.0 and 2.1.1 --- src/sagemaker/image_uri_config/autogluon.json | 12 ++++ .../huggingface-training-compiler.json | 3 + .../image_uri_config/huggingface.json | 31 +++++++++ src/sagemaker/image_uri_config/mxnet.json | 13 ++++ src/sagemaker/image_uri_config/pytorch.json | 28 ++++++++ .../image_uri_config/tensorflow.json | 65 +++++++++++++++++++ 6 files changed, 152 insertions(+) diff --git a/src/sagemaker/image_uri_config/autogluon.json b/src/sagemaker/image_uri_config/autogluon.json index 3cc488c55d..0963520e02 100644 --- a/src/sagemaker/image_uri_config/autogluon.json +++ b/src/sagemaker/image_uri_config/autogluon.json @@ -26,6 +26,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -56,6 +57,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -86,6 +88,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -116,6 +119,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -146,6 +150,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -176,6 +181,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -217,6 +223,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -250,6 +257,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -283,6 +291,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -316,6 +325,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -349,6 +359,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -382,6 +393,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", diff --git a/src/sagemaker/image_uri_config/huggingface-training-compiler.json b/src/sagemaker/image_uri_config/huggingface-training-compiler.json index e771e2a548..482264b773 100644 --- a/src/sagemaker/image_uri_config/huggingface-training-compiler.json +++ b/src/sagemaker/image_uri_config/huggingface-training-compiler.json @@ -60,6 +60,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -89,6 +90,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -123,6 +125,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", diff --git a/src/sagemaker/image_uri_config/huggingface.json b/src/sagemaker/image_uri_config/huggingface.json index 317c17030a..e995c6e8ea 100644 --- a/src/sagemaker/image_uri_config/huggingface.json +++ b/src/sagemaker/image_uri_config/huggingface.json @@ -38,6 +38,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -70,6 +71,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -108,6 +110,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -140,6 +143,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -180,6 +184,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -213,6 +218,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -246,6 +252,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -279,6 +286,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -320,6 +328,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -353,6 +362,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -386,6 +396,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -419,6 +430,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -458,6 +470,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -491,6 +504,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -530,6 +544,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -563,6 +578,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -602,6 +618,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -635,6 +652,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -687,6 +705,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -720,6 +739,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -753,6 +773,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -794,6 +815,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -827,6 +849,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -860,6 +883,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -893,6 +917,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -932,6 +957,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -965,6 +991,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1004,6 +1031,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1037,6 +1065,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1076,6 +1105,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1109,6 +1139,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", diff --git a/src/sagemaker/image_uri_config/mxnet.json b/src/sagemaker/image_uri_config/mxnet.json index 12bc40fccf..14bb74f6a6 100644 --- a/src/sagemaker/image_uri_config/mxnet.json +++ b/src/sagemaker/image_uri_config/mxnet.json @@ -245,6 +245,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -277,6 +278,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -309,6 +311,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -341,6 +344,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -373,6 +377,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -632,6 +637,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -664,6 +670,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -696,6 +703,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -728,6 +736,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -760,6 +769,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -865,6 +875,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -897,6 +908,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -929,6 +941,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", diff --git a/src/sagemaker/image_uri_config/pytorch.json b/src/sagemaker/image_uri_config/pytorch.json index 3bf8016ba8..e1de6ca663 100644 --- a/src/sagemaker/image_uri_config/pytorch.json +++ b/src/sagemaker/image_uri_config/pytorch.json @@ -195,6 +195,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -230,6 +231,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -264,6 +266,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -298,6 +301,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -333,6 +337,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -368,6 +373,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -403,6 +409,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -438,6 +445,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -472,6 +480,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -506,6 +515,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -540,6 +550,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -574,6 +585,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -608,6 +620,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -642,6 +655,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -879,6 +893,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -914,6 +929,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -949,6 +965,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -983,6 +1000,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1018,6 +1036,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1053,6 +1072,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1088,6 +1108,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1123,6 +1144,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1157,6 +1179,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1191,6 +1214,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1225,6 +1249,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1259,6 +1284,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1293,6 +1319,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1327,6 +1354,7 @@ "eu-west-3": "763104351884", "eu-south-1": "692866216735", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", diff --git a/src/sagemaker/image_uri_config/tensorflow.json b/src/sagemaker/image_uri_config/tensorflow.json index 0122dcd3ca..bb05682f67 100644 --- a/src/sagemaker/image_uri_config/tensorflow.json +++ b/src/sagemaker/image_uri_config/tensorflow.json @@ -154,6 +154,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -185,6 +186,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -216,6 +218,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -247,6 +250,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -401,6 +405,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -432,6 +437,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -463,6 +469,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -494,6 +501,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -525,6 +533,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -556,6 +565,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -587,6 +597,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -810,6 +821,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -841,6 +853,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -872,6 +885,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -903,6 +917,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -934,6 +949,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -965,6 +981,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -996,6 +1013,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1027,6 +1045,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1058,6 +1077,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1089,6 +1109,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1120,6 +1141,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1151,6 +1173,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1182,6 +1205,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1213,6 +1237,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1244,6 +1269,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1275,6 +1301,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1306,6 +1333,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1337,6 +1365,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1368,6 +1397,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1399,6 +1429,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1430,6 +1461,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1461,6 +1493,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1760,6 +1793,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1796,6 +1830,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1831,6 +1866,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1867,6 +1903,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1903,6 +1940,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1939,6 +1977,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -1975,6 +2014,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2202,6 +2242,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2237,6 +2278,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2272,6 +2314,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2306,6 +2349,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2340,6 +2384,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2375,6 +2420,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2410,6 +2456,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2444,6 +2491,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2478,6 +2526,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2512,6 +2561,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2546,6 +2596,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2580,6 +2631,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2614,6 +2666,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2648,6 +2701,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2682,6 +2736,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2716,6 +2771,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2750,6 +2806,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2784,6 +2841,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2818,6 +2876,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2852,6 +2911,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2886,6 +2946,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2920,6 +2981,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2954,6 +3016,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -2988,6 +3051,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", @@ -3022,6 +3086,7 @@ "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", From b68bcd9344deba8e3bedf7ccb0adb31498735b13 Mon Sep 17 00:00:00 2001 From: Brock Wade Date: Mon, 5 Dec 2022 14:11:34 -0800 Subject: [PATCH 13/41] fix: support idempotency for framework and spark processors (#3460) Co-authored-by: Brock Wade Co-authored-by: Mufaddal Rohawala <89424143+mufaddal-rohawala@users.noreply.github.com> --- src/sagemaker/processing.py | 8 +- src/sagemaker/spark/processing.py | 37 +- src/sagemaker/workflow/utilities.py | 7 +- tests/data/spark/code/java/TestJarFile.jar | Bin 0 -> 1714 bytes .../hello-java-spark/HelloJavaSparkApp.jar | Bin 0 -> 1714 bytes .../unit/sagemaker/workflow/test_pipeline.py | 8 +- .../workflow/test_processing_step.py | 277 +++++++++++++- .../sagemaker/workflow/test_training_step.py | 354 +++++++++++++++--- .../sagemaker/workflow/test_transform_step.py | 8 + .../sagemaker/workflow/test_tuning_step.py | 58 +-- 10 files changed, 661 insertions(+), 96 deletions(-) create mode 100644 tests/data/spark/code/java/TestJarFile.jar create mode 100644 tests/data/spark/code/java/hello-java-spark/HelloJavaSparkApp.jar diff --git a/src/sagemaker/processing.py b/src/sagemaker/processing.py index 308783578d..81e3d34b1d 100644 --- a/src/sagemaker/processing.py +++ b/src/sagemaker/processing.py @@ -23,6 +23,7 @@ import logging from textwrap import dedent from typing import Dict, List, Optional, Union +from copy import copy import attr @@ -1830,14 +1831,17 @@ def _patch_inputs_with_payload(self, inputs, s3_payload) -> List[ProcessingInput # a7399455f5386d83ddc5cb15c0db00c04bd518ec/src/sagemaker/processing.py#L425-L426 if inputs is None: inputs = [] - inputs.append( + + # make a shallow copy of user inputs + patched_inputs = copy(inputs) + patched_inputs.append( ProcessingInput( input_name="code", source=s3_payload, destination="/opt/ml/processing/input/code/", ) ) - return inputs + return patched_inputs def _set_entrypoint(self, command, user_script_name): """Framework processor override for setting processing job entrypoint. diff --git a/src/sagemaker/spark/processing.py b/src/sagemaker/spark/processing.py index dc3d26a355..912bc90d80 100644 --- a/src/sagemaker/spark/processing.py +++ b/src/sagemaker/spark/processing.py @@ -30,6 +30,7 @@ from enum import Enum from io import BytesIO from urllib.parse import urlparse +from copy import copy from typing import Union, List, Dict, Optional @@ -279,6 +280,10 @@ def run( def _extend_processing_args(self, inputs, outputs, **kwargs): """Extends processing job args such as inputs.""" + # make a shallow copy of user outputs + outputs = outputs or [] + extended_outputs = copy(outputs) + if kwargs.get("spark_event_logs_s3_uri"): spark_event_logs_s3_uri = kwargs.get("spark_event_logs_s3_uri") self._validate_s3_uri(spark_event_logs_s3_uri) @@ -297,16 +302,21 @@ def _extend_processing_args(self, inputs, outputs, **kwargs): s3_upload_mode="Continuous", ) - outputs = outputs or [] - outputs.append(output) + extended_outputs.append(output) + + # make a shallow copy of user inputs + inputs = inputs or [] + extended_inputs = copy(inputs) if kwargs.get("configuration"): configuration = kwargs.get("configuration") self._validate_configuration(configuration) - inputs = inputs or [] - inputs.append(self._stage_configuration(configuration)) + extended_inputs.append(self._stage_configuration(configuration)) - return inputs, outputs + return ( + extended_inputs if extended_inputs else None, + extended_outputs if extended_outputs else None, + ) def start_history_server(self, spark_event_logs_s3_uri=None): """Starts a Spark history server. @@ -940,9 +950,16 @@ def _extend_processing_args(self, inputs, outputs, **kwargs): outputs: Processing outputs. kwargs: Additional keyword arguments passed to `super()`. """ + + if inputs is None: + inputs = [] + + # make a shallow copy of user inputs + extended_inputs = copy(inputs) + self.command = [_SparkProcessorBase._default_command] extended_inputs = self._handle_script_dependencies( - inputs, kwargs.get("submit_py_files"), FileType.PYTHON + extended_inputs, kwargs.get("submit_py_files"), FileType.PYTHON ) extended_inputs = self._handle_script_dependencies( extended_inputs, kwargs.get("submit_jars"), FileType.JAR @@ -1199,8 +1216,14 @@ def _extend_processing_args(self, inputs, outputs, **kwargs): else: raise ValueError("submit_class is required") + if inputs is None: + inputs = [] + + # make a shallow copy of user inputs + extended_inputs = copy(inputs) + extended_inputs = self._handle_script_dependencies( - inputs, kwargs.get("submit_jars"), FileType.JAR + extended_inputs, kwargs.get("submit_jars"), FileType.JAR ) extended_inputs = self._handle_script_dependencies( extended_inputs, kwargs.get("submit_files"), FileType.FILE diff --git a/src/sagemaker/workflow/utilities.py b/src/sagemaker/workflow/utilities.py index 89d7c5dfd9..08c170d424 100644 --- a/src/sagemaker/workflow/utilities.py +++ b/src/sagemaker/workflow/utilities.py @@ -114,11 +114,12 @@ def get_code_hash(step: Entity) -> str: if isinstance(step, ProcessingStep) and step.step_args: kwargs = step.step_args.func_kwargs source_dir = kwargs.get("source_dir") + submit_class = kwargs.get("submit_class") dependencies = get_processing_dependencies( [ kwargs.get("dependencies"), kwargs.get("submit_py_files"), - kwargs.get("submit_class"), + [submit_class] if submit_class else None, kwargs.get("submit_jars"), kwargs.get("submit_files"), ] @@ -168,7 +169,7 @@ def get_processing_code_hash(code: str, source_dir: str, dependencies: List[str] str: A hash string representing the unique code artifact(s) for the step """ - # FrameworkProcessor + # If FrameworkProcessor contains source_dir if source_dir: source_dir_url = urlparse(source_dir) if source_dir_url.scheme == "" or source_dir_url.scheme == "file": @@ -400,5 +401,5 @@ def execute_job_functions(step_args: _StepArguments): """ chained_args = step_args.func(*step_args.func_args, **step_args.func_kwargs) - if chained_args: + if isinstance(chained_args, _StepArguments): execute_job_functions(chained_args) diff --git a/tests/data/spark/code/java/TestJarFile.jar b/tests/data/spark/code/java/TestJarFile.jar new file mode 100644 index 0000000000000000000000000000000000000000..d528331d557da00908e31c46b2a0dd3dc250a2bf GIT binary patch literal 1714 zcmWIWW@Zs#;Nak32&_&EWk3R)3@i-3t|5-Po_=on|4uP5Ff#;rvvYt{FhP|C;M6Pv zQ~}rQ>*(j{<{BKL=j-;__snS@Z(Y5MyxzK6=gyqp9At3C_`%a6JuhD!Pv48Bt5`TA zUPvC1mX_4auz02x_VoEn)#uN(DxRsn&iqvLv4|1u2Dgc~Y@C2LfH24nTnr3AcNxV* zp?E+PD4UU*lasHTl~|UjTU?M>l&znfpR12si##qZiMfeY`FV-u#dtJp64qRtn4X%O zn4MaL#~6K5jDdIxw}(tfH>@PJxCHDxNU}f=RWCA4^Z><#7ce4%LGj>NP@o5nmEPT4 zha3c4fB)?=3}v}1?~$s$O;hJc(w#MhC*L&B^>k7F|4!|RkwJmw^vM@^ZbTbg%>MGD zm+}6Zogs4UvrW~{G>e_Sq%rjvyCrkm1j%#LG~x;ll{xxp9`tuS$+mI96m!?>jqc*F zmUDYt@G4ul|1M+k`QN#lmi*livHr1!m8grxm8+{7vd>(Rb%^U*cxRE#x^uBx^RN9~ zllGMzl-M^*=l9J9diW#|BN97$kjP>SlHA0+%rsz7>XlTK08{;$%cbW$b@a9cd7L|c z)%%R^np5Y!b@Z=k`}z2v^*!UKdr4c*L+8{rZBJm{`0R1^1h54%;aZXMFvtWh2HbfL zVZuQm6GsljZ3HL}BET0Q6RQ!(ITE*Fpgf5HhKvLaL(ZYNjRoaV1gIdzSXhq5Z8#{; zBEV774Tt7nL=pidSmdM(%EJgC4oo=&f*27h5a)w!z@DR#(-+8I*(j{<{BKL=j-;__snS@Z(Y5MyxzK6=gyqp9At3C_`%a6JuhD!Pv48Bt5`TA zUPvC1mX_4auz02x_VoEn)#uN(DxRsn&iqvLv4|1u2Dgc~Y@C2LfH24nTnr3AcNxV* zp?E+PD4UU*lasHTl~|UjTU?M>l&znfpR12si##qZiMfeY`FV-u#dtJp64qRtn4X%O zn4MaL#~6K5jDdIxw}(tfH>@PJxCHDxNU}f=RWCA4^Z><#7ce4%LGj>NP@o5nmEPT4 zha3c4fB)?=3}v}1?~$s$O;hJc(w#MhC*L&B^>k7F|4!|RkwJmw^vM@^ZbTbg%>MGD zm+}6Zogs4UvrW~{G>e_Sq%rjvyCrkm1j%#LG~x;ll{xxp9`tuS$+mI96m!?>jqc*F zmUDYt@G4ul|1M+k`QN#lmi*livHr1!m8grxm8+{7vd>(Rb%^U*cxRE#x^uBx^RN9~ zllGMzl-M^*=l9J9diW#|BN97$kjP>SlHA0+%rsz7>XlTK08{;$%cbW$b@a9cd7L|c z)%%R^np5Y!b@Z=k`}z2v^*!UKdr4c*L+8{rZBJm{`0R1^1h54%;aZXMFvtWh2HbfL zVZuQm6GsljZ3HL}BET0Q6RQ!(ITE*Fpgf5HhKvLaL(ZYNjRoaV1gIdzSXhq5Z8#{; zBEV774Tt7nL=pidSmdM(%EJgC4oo=&f*27h5a)w!z@DR#(-+8I Date: Mon, 5 Dec 2022 18:18:10 -0600 Subject: [PATCH 14/41] feature: Update registries with new region account number mappings. (#3492) --- src/sagemaker/image_uri_config/autogluon.json | 18 ++++ .../image_uri_config/huggingface-neuron.json | 3 + .../image_uri_config/huggingface.json | 39 +++++++ src/sagemaker/image_uri_config/mxnet.json | 24 +++++ src/sagemaker/image_uri_config/pytorch.json | 54 ++++++++++ .../image_uri_config/tensorflow.json | 102 ++++++++++++++++++ 6 files changed, 240 insertions(+) diff --git a/src/sagemaker/image_uri_config/autogluon.json b/src/sagemaker/image_uri_config/autogluon.json index 0963520e02..3a9f02142c 100644 --- a/src/sagemaker/image_uri_config/autogluon.json +++ b/src/sagemaker/image_uri_config/autogluon.json @@ -210,6 +210,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -217,11 +218,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -244,6 +247,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -251,11 +255,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -278,6 +284,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -285,11 +292,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -312,6 +321,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -319,11 +329,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -346,6 +358,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -353,11 +366,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -380,6 +395,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -387,11 +403,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/huggingface-neuron.json b/src/sagemaker/image_uri_config/huggingface-neuron.json index 1e2246cb11..47d6dbd1dc 100644 --- a/src/sagemaker/image_uri_config/huggingface-neuron.json +++ b/src/sagemaker/image_uri_config/huggingface-neuron.json @@ -15,17 +15,20 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ca-central-1": "763104351884", "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "sa-east-1": "763104351884", "us-east-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/huggingface.json b/src/sagemaker/image_uri_config/huggingface.json index e995c6e8ea..5b98fc0d02 100644 --- a/src/sagemaker/image_uri_config/huggingface.json +++ b/src/sagemaker/image_uri_config/huggingface.json @@ -692,6 +692,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -699,11 +700,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -726,6 +729,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -733,11 +737,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -760,6 +766,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -767,8 +774,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -802,6 +811,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -809,11 +819,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -836,6 +848,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -843,11 +856,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -870,6 +885,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -877,8 +893,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -904,6 +922,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -911,8 +930,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -944,6 +965,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -951,11 +973,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -978,6 +1002,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -985,8 +1010,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1018,6 +1045,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1025,11 +1053,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -1052,6 +1082,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1059,8 +1090,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1092,6 +1125,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1099,11 +1133,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -1126,6 +1162,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1133,8 +1170,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", diff --git a/src/sagemaker/image_uri_config/mxnet.json b/src/sagemaker/image_uri_config/mxnet.json index 14bb74f6a6..8d8733e480 100644 --- a/src/sagemaker/image_uri_config/mxnet.json +++ b/src/sagemaker/image_uri_config/mxnet.json @@ -624,6 +624,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -631,11 +632,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -657,6 +660,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -664,11 +668,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -690,6 +696,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -697,11 +704,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -723,6 +732,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -730,11 +740,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -756,6 +768,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -763,11 +776,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -862,6 +877,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -869,11 +885,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -895,6 +913,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -902,11 +921,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -928,6 +949,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -935,11 +957,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/pytorch.json b/src/sagemaker/image_uri_config/pytorch.json index e1de6ca663..18a382e591 100644 --- a/src/sagemaker/image_uri_config/pytorch.json +++ b/src/sagemaker/image_uri_config/pytorch.json @@ -17,6 +17,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -25,7 +26,9 @@ "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", "eu-north-1": "763104351884", + "eu-central-2": "380420809688", "eu-west-1": "763104351884", + "eu-south-2": "503227376785", "us-east-1": "763104351884", "us-east-2": "763104351884", "us-west-2": "763104351884" @@ -39,8 +42,11 @@ "registries": { "ap-northeast-1": "763104351884", "ap-northeast-2": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-3": "907027046896", + "eu-central-2": "380420809688", "eu-west-1": "763104351884", + "eu-south-2": "503227376785", "us-east-1": "763104351884", "us-east-2": "763104351884", "us-west-2": "763104351884" @@ -182,6 +188,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -189,11 +196,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -218,6 +227,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -225,11 +235,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -253,6 +265,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -260,11 +273,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -288,6 +303,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -295,11 +311,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -324,6 +342,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -331,11 +350,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -360,6 +381,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -367,11 +389,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -396,6 +420,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -403,11 +428,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -432,6 +459,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -439,11 +467,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -467,6 +497,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -474,11 +505,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -502,6 +535,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -509,11 +543,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -537,6 +573,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -544,11 +581,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -572,6 +611,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -579,11 +619,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -607,6 +649,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -614,11 +657,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -642,6 +687,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -649,11 +695,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "me-central-1": "914824155844", "sa-east-1": "763104351884", @@ -677,6 +725,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -684,11 +733,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "sa-east-1": "763104351884", "us-east-1": "763104351884", @@ -721,6 +772,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -728,11 +780,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "sa-east-1": "763104351884", "us-east-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/tensorflow.json b/src/sagemaker/image_uri_config/tensorflow.json index bb05682f67..a0f2bba014 100644 --- a/src/sagemaker/image_uri_config/tensorflow.json +++ b/src/sagemaker/image_uri_config/tensorflow.json @@ -141,6 +141,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -148,12 +149,14 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "me-south-1": "217643126080", + "eu-south-2": "503227376785", "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", @@ -173,6 +176,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -180,8 +184,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -205,6 +211,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -212,8 +219,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -237,6 +246,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -244,8 +254,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -392,6 +404,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -399,8 +412,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -424,6 +439,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -431,8 +447,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -456,6 +474,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -463,8 +482,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -488,6 +509,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -495,8 +517,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -520,6 +544,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -527,8 +552,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -552,6 +579,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -559,8 +587,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -584,6 +614,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -591,8 +622,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -808,6 +841,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -815,8 +849,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -840,6 +876,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -847,8 +884,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -872,6 +911,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -879,8 +919,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -904,6 +946,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -911,8 +954,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -936,6 +981,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -943,8 +989,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -968,6 +1016,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -975,8 +1024,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1000,6 +1051,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1007,8 +1059,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1032,6 +1086,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1039,8 +1094,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1064,6 +1121,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1071,8 +1129,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1096,6 +1156,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1103,8 +1164,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1128,6 +1191,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1135,8 +1199,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1160,6 +1226,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1167,8 +1234,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1192,6 +1261,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1199,8 +1269,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1224,6 +1296,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1231,8 +1304,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1256,6 +1331,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1263,8 +1339,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1288,6 +1366,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1295,8 +1374,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1320,6 +1401,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1327,8 +1409,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1352,6 +1436,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1359,8 +1444,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1384,6 +1471,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1391,8 +1479,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1416,6 +1506,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1423,8 +1514,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1448,6 +1541,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1455,8 +1549,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1480,6 +1576,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1487,8 +1584,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1587,6 +1686,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1594,11 +1694,13 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "me-south-1": "217643126080", "sa-east-1": "763104351884", "us-east-1": "763104351884", From 767da0afc5cfb11eb96b324debf9a310abaafbcc Mon Sep 17 00:00:00 2001 From: Loki Date: Wed, 7 Dec 2022 06:06:34 +0530 Subject: [PATCH 15/41] feature: Adding support for SageMaker Training Compiler in PyTorch estimator starting 1.12 (#3500) Co-authored-by: Ubuntu --- src/sagemaker/fw_utils.py | 2 +- .../pytorch-training-compiler.json | 41 ++ src/sagemaker/image_uris.py | 2 +- src/sagemaker/pytorch/__init__.py | 2 + src/sagemaker/pytorch/estimator.py | 60 +- .../pytorch/training_compiler/__init__.py | 0 .../pytorch/training_compiler/config.py | 151 +++++ tests/conftest.py | 1 + tests/data/huggingface_byoc/requirements.txt | 2 + tests/data/huggingface_byoc/run_glue.py | 568 ++++++++++++++++ tests/data/huggingface_byoc/train/dummy.csv | 1 + tests/integ/__init__.py | 2 +- tests/integ/test_training_compiler.py | 50 +- .../test_pytorch_compiler.py | 616 ++++++++++++++++++ 14 files changed, 1467 insertions(+), 31 deletions(-) create mode 100644 src/sagemaker/image_uri_config/pytorch-training-compiler.json create mode 100644 src/sagemaker/pytorch/training_compiler/__init__.py create mode 100644 src/sagemaker/pytorch/training_compiler/config.py create mode 100644 tests/data/huggingface_byoc/requirements.txt create mode 100644 tests/data/huggingface_byoc/run_glue.py create mode 100644 tests/data/huggingface_byoc/train/dummy.csv create mode 100644 tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py diff --git a/src/sagemaker/fw_utils.py b/src/sagemaker/fw_utils.py index d82d3596ac..5efe530396 100644 --- a/src/sagemaker/fw_utils.py +++ b/src/sagemaker/fw_utils.py @@ -493,7 +493,7 @@ def framework_name_from_image(image_uri): # We must support both the legacy and current image name format. name_pattern = re.compile( r"""^(?:sagemaker(?:-rl)?-)? - (tensorflow|mxnet|chainer|pytorch|scikit-learn|xgboost + (tensorflow|mxnet|chainer|pytorch|pytorch-trcomp|scikit-learn|xgboost |huggingface-tensorflow|huggingface-pytorch |huggingface-tensorflow-trcomp|huggingface-pytorch-trcomp)(?:-)? (scriptmode|training)? diff --git a/src/sagemaker/image_uri_config/pytorch-training-compiler.json b/src/sagemaker/image_uri_config/pytorch-training-compiler.json new file mode 100644 index 0000000000..892ff4237d --- /dev/null +++ b/src/sagemaker/image_uri_config/pytorch-training-compiler.json @@ -0,0 +1,41 @@ +{ + "training": { + "processors": [ + "gpu" + ], + "version_aliases": { + "1.12": "1.12.0" + }, + "versions": { + "1.12.0": { + "py_versions": [ + "py38" + ], + "registries": { + "af-south-1": "626614931356", + "ap-east-1": "871362719292", + "ap-northeast-1": "763104351884", + "ap-northeast-2": "763104351884", + "ap-northeast-3": "364406365360", + "ap-south-1": "763104351884", + "ap-southeast-1": "763104351884", + "ap-southeast-2": "763104351884", + "ca-central-1": "763104351884", + "eu-central-1": "763104351884", + "eu-north-1": "763104351884", + "eu-west-1": "763104351884", + "eu-west-2": "763104351884", + "eu-west-3": "763104351884", + "eu-south-1": "692866216735", + "me-south-1": "217643126080", + "sa-east-1": "763104351884", + "us-east-1": "763104351884", + "us-east-2": "763104351884", + "us-west-1": "763104351884", + "us-west-2": "763104351884" + }, + "repository": "pytorch-training" + } + } + } +} diff --git a/src/sagemaker/image_uris.py b/src/sagemaker/image_uris.py index 7d1d3bd835..c42ce02188 100644 --- a/src/sagemaker/image_uris.py +++ b/src/sagemaker/image_uris.py @@ -146,7 +146,7 @@ def retrieve( tolerate_deprecated_model, ) - if training_compiler_config and (framework == HUGGING_FACE_FRAMEWORK): + if training_compiler_config and (framework in [HUGGING_FACE_FRAMEWORK, "pytorch"]): final_image_scope = image_scope config = _config_for_framework_and_scope( framework + "-training-compiler", final_image_scope, accelerator_type diff --git a/src/sagemaker/pytorch/__init__.py b/src/sagemaker/pytorch/__init__.py index cac5f94b9a..e2d14f4163 100644 --- a/src/sagemaker/pytorch/__init__.py +++ b/src/sagemaker/pytorch/__init__.py @@ -16,3 +16,5 @@ from sagemaker.pytorch.estimator import PyTorch # noqa: F401 from sagemaker.pytorch.model import PyTorchModel, PyTorchPredictor # noqa: F401 from sagemaker.pytorch.processing import PyTorchProcessor # noqa: F401 + +from sagemaker.pytorch.training_compiler.config import TrainingCompilerConfig # noqa: F401 diff --git a/src/sagemaker/pytorch/estimator.py b/src/sagemaker/pytorch/estimator.py index 686de4a78c..29e254662f 100644 --- a/src/sagemaker/pytorch/estimator.py +++ b/src/sagemaker/pytorch/estimator.py @@ -28,6 +28,7 @@ ) from sagemaker.pytorch import defaults from sagemaker.pytorch.model import PyTorchModel +from sagemaker.pytorch.training_compiler.config import TrainingCompilerConfig from sagemaker.vpc_utils import VPC_CONFIG_DEFAULT from sagemaker.workflow.entities import PipelineVariable @@ -51,7 +52,8 @@ def __init__( hyperparameters: Optional[Dict[str, Union[str, PipelineVariable]]] = None, image_uri: Optional[Union[str, PipelineVariable]] = None, distribution: Optional[Dict] = None, - **kwargs + compiler_config: Optional[TrainingCompilerConfig] = None, + **kwargs, ): """This ``Estimator`` executes a PyTorch script in a managed PyTorch execution environment. @@ -208,6 +210,31 @@ def __init__( To learn more, see `Training with parameter servers `_. + **To enable distributed training with + `SageMaker Training Compiler `_ + for PyTorch:** + + .. code:: python + + { + "pytorchxla": { + "enabled": True + } + } + + To learn more, see `SageMaker Training Compiler + `_ + in the *Amazon SageMaker Developer Guide*. + + .. note:: + + When you use this PyTorch XLA option for distributed training strategy, + you must add the ``compiler_config`` parameter and activate SageMaker + Training Compiler. + + compiler_config (:class:`~sagemaker.pytorch.TrainingCompilerConfig`): + Configures SageMaker Training Compiler to accelerate training. + **kwargs: Additional kwargs passed to the :class:`~sagemaker.estimator.Framework` constructor. @@ -250,6 +277,25 @@ def __init__( self.distribution = distribution or {} + if compiler_config is not None: + if not isinstance(compiler_config, TrainingCompilerConfig): + error_string = ( + f"Expected instance of type {TrainingCompilerConfig}" + f"for argument compiler_config. " + f"Instead got {type(compiler_config)}" + ) + raise ValueError(error_string) + if compiler_config: + compiler_config.validate(self) + elif distribution is not None and "pytorchxla" in distribution: + raise ValueError( + "Distributed training through PyTorch XLA is currently only supported " + "when SageMaker Training Compiler is enabled. To learn more, " + "see Enable SageMaker Training Compiler at " + "https://docs.aws.amazon.com/sagemaker/latest/dg/training-compiler-enable.html." + ) + self.compiler_config = compiler_config + def _pytorch_distribution_configuration(self, distribution): """Returns a dict of distribution config for PyTorch training @@ -289,6 +335,12 @@ def hyperparameters(self): hyperparameters.update( EstimatorBase._json_encode_hyperparameters(additional_hyperparameters) ) + if self.compiler_config: + training_compiler_hyperparameters = self.compiler_config._to_hyperparameter_dict() + hyperparameters.update( + EstimatorBase._json_encode_hyperparameters(training_compiler_hyperparameters) + ) + return hyperparameters def create_model( @@ -299,7 +351,7 @@ def create_model( entry_point=None, source_dir=None, dependencies=None, - **kwargs + **kwargs, ): """Create a SageMaker ``PyTorchModel`` object that can be deployed to an ``Endpoint``. @@ -350,7 +402,7 @@ def create_model( sagemaker_session=self.sagemaker_session, vpc_config=self.get_vpc_config(vpc_config_override), dependencies=(dependencies or self.dependencies), - **kwargs + **kwargs, ) @classmethod @@ -371,6 +423,8 @@ def _prepare_init_params_from_job_description(cls, job_details, model_channel_na ) image_uri = init_params.pop("image_uri") framework, py_version, tag, _ = framework_name_from_image(image_uri) + if framework: + framework = framework.split("-")[0] if tag is None: framework_version = None diff --git a/src/sagemaker/pytorch/training_compiler/__init__.py b/src/sagemaker/pytorch/training_compiler/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/sagemaker/pytorch/training_compiler/config.py b/src/sagemaker/pytorch/training_compiler/config.py new file mode 100644 index 0000000000..7faf8acbbd --- /dev/null +++ b/src/sagemaker/pytorch/training_compiler/config.py @@ -0,0 +1,151 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +"""Configuration for the SageMaker Training Compiler.""" +from __future__ import absolute_import +import logging +from typing import Union +from packaging.specifiers import SpecifierSet +from packaging.version import Version + +from sagemaker.training_compiler.config import TrainingCompilerConfig as BaseConfig +from sagemaker.workflow.entities import PipelineVariable + +logger = logging.getLogger(__name__) + + +class TrainingCompilerConfig(BaseConfig): + """The SageMaker Training Compiler configuration class.""" + + SUPPORTED_INSTANCE_CLASS_PREFIXES = ["p3", "p3dn", "g4dn", "p4d", "g5"] + SUPPORTED_INSTANCE_TYPES_WITH_EFA = [ + "ml.g4dn.8xlarge", + "ml.g4dn.12xlarge", + "ml.g5.48xlarge", + "ml.p3dn.24xlarge", + "ml.p4d.24xlarge", + ] + + def __init__( + self, + enabled: Union[bool, PipelineVariable] = True, + debug: Union[bool, PipelineVariable] = False, + ): + """This class initializes a ``TrainingCompilerConfig`` instance. + + `Amazon SageMaker Training Compiler + `_ + is a feature of SageMaker Training + and speeds up training jobs by optimizing model execution graphs. + + You can compile PyTorch models + by passing the object of this configuration class to the ``compiler_config`` + parameter of the :class:`~sagemaker.pytorch.PyTorch` + estimator. + + Args: + enabled (bool or PipelineVariable): Optional. Switch to enable SageMaker + Training Compiler. The default is ``True``. + debug (bool or PipelineVariable): Optional. Whether to dump detailed logs + for debugging. This comes with a potential performance slowdown. + The default is ``False``. + + **Example**: The following code shows the basic usage of the + :class:`sagemaker.pytorch.TrainingCompilerConfig()` class + to run a PyTorch training job with the compiler. + + .. code-block:: python + + from sagemaker.pytorch import PyTorch, TrainingCompilerConfig + + pytorch_estimator=PyTorch( + ... + compiler_config=TrainingCompilerConfig() + ) + + .. seealso:: + + For more information about how to enable SageMaker Training Compiler + for various training settings such as distributed training, + see `Enable SageMaker Training Compiler + `_ + in the `Amazon SageMaker Training Compiler developer guide + `_. + + """ + + super(TrainingCompilerConfig, self).__init__(enabled=enabled, debug=debug) + + @classmethod + def validate( + cls, + estimator, + ): + """Checks if SageMaker Training Compiler is configured correctly. + + Args: + estimator (:class:`sagemaker.pytorch.PyTorch`): An estimator object. + If SageMaker Training Compiler is enabled, it will validate whether + the estimator is configured to be compatible with Training Compiler. + + Raises: + ValueError: Raised if the requested configuration is not compatible + with SageMaker Training Compiler. + """ + + super(TrainingCompilerConfig, cls).validate(estimator) + + if estimator.image_uri: + error_helper_string = ( + "Overriding the image URI is currently not supported " + "for SageMaker Training Compiler." + "Specify the following parameters to run the PyTorch training job " + "with SageMaker Training Compiler enabled: " + "framework_version, and compiler_config." + ) + raise ValueError(error_helper_string) + + if estimator.distribution: + pt_xla_present = "pytorchxla" in estimator.distribution + pt_xla_enabled = estimator.distribution.get("pytorchxla", {}).get("enabled", False) + if pt_xla_enabled: + if estimator.framework_version: + if Version(estimator.framework_version) in SpecifierSet("< 1.12"): + error_helper_string = ( + "Distribution mechanism 'pytorchxla' is currently only supported for " + "PyTorch >= 1.12 when SageMaker Training Compiler is enabled." + " Received framework_version={} which is unsupported." + ) + raise ValueError(error_helper_string.format(estimator.framework_version)) + if estimator.instance_type not in cls.SUPPORTED_INSTANCE_TYPES_WITH_EFA: + logger.warning( + "Consider using instances with EFA support when " + "training with PyTorch >= 1.12 and SageMaker Training Compiler " + "enabled. SageMaker Training Compiler leverages EFA to provide better " + "performance for distributed training." + ) + if not pt_xla_present: + if estimator.framework_version: + if Version(estimator.framework_version) in SpecifierSet(">= 1.12"): + error_helper_string = ( + "'pytorchxla' is the only distribution mechanism currently supported " + "for PyTorch >= 1.12 when SageMaker Training Compiler is enabled." + " Received distribution={} which is unsupported." + ) + raise ValueError(error_helper_string.format(estimator.distribution)) + elif estimator.instance_count and estimator.instance_count > 1: + if estimator.framework_version: + if Version(estimator.framework_version) in SpecifierSet(">= 1.12"): + logger.warning( + "Consider setting 'distribution' to 'pytorchxla' for distributed " + "training with PyTorch >= 1.12 and SageMaker Training Compiler enabled." + ) diff --git a/tests/conftest.py b/tests/conftest.py index e92d98112b..f6682ebb8c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -73,6 +73,7 @@ "neo_pytorch", "neo_tensorflow", "pytorch", + "pytorch_training_compiler", "ray_pytorch", "ray_tensorflow", "sklearn", diff --git a/tests/data/huggingface_byoc/requirements.txt b/tests/data/huggingface_byoc/requirements.txt new file mode 100644 index 0000000000..462542f1c1 --- /dev/null +++ b/tests/data/huggingface_byoc/requirements.txt @@ -0,0 +1,2 @@ +transformers +datasets diff --git a/tests/data/huggingface_byoc/run_glue.py b/tests/data/huggingface_byoc/run_glue.py new file mode 100644 index 0000000000..1060398fa4 --- /dev/null +++ b/tests/data/huggingface_byoc/run_glue.py @@ -0,0 +1,568 @@ +#!/usr/bin/env python +# coding=utf-8 +# Copyright 2020 The HuggingFace Inc. team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" Finetuning the library models for sequence classification on GLUE.""" +# You can also adapt this script on your own text classification task. Pointers for this are left as comments. + +import logging +import os +import random +import sys +from dataclasses import dataclass, field +from typing import Optional + +import numpy as np +from datasets import load_dataset, load_metric + +import transformers +from transformers import ( + AutoConfig, + AutoModelForSequenceClassification, + AutoTokenizer, + DataCollatorWithPadding, + EvalPrediction, + HfArgumentParser, + PretrainedConfig, + Trainer, + TrainingArguments, + default_data_collator, + set_seed, +) +from transformers.trainer_utils import get_last_checkpoint, is_main_process +from transformers.utils import check_min_version + + +# Will error if the minimal version of Transformers is not installed. Remove at your own risks. +check_min_version("4.5.0") + +task_to_keys = { + "cola": ("sentence", None), + "mnli": ("premise", "hypothesis"), + "mrpc": ("sentence1", "sentence2"), + "qnli": ("question", "sentence"), + "qqp": ("question1", "question2"), + "rte": ("sentence1", "sentence2"), + "sst2": ("sentence", None), + "stsb": ("sentence1", "sentence2"), + "wnli": ("sentence1", "sentence2"), +} + +logger = logging.getLogger(__name__) + + +@dataclass +class DataTrainingArguments: + """ + Arguments pertaining to what data we are going to input our model for training and eval. + + Using `HfArgumentParser` we can turn this class + into argparse arguments to be able to specify them on + the command line. + """ + + task_name: Optional[str] = field( + default=None, + metadata={"help": "The name of the task to train on: " + ", ".join(task_to_keys.keys())}, + ) + max_seq_length: int = field( + default=128, + metadata={ + "help": "The maximum total input sequence length after tokenization. Sequences longer " + "than this will be truncated, sequences shorter will be padded." + }, + ) + overwrite_cache: bool = field( + default=False, metadata={"help": "Overwrite the cached preprocessed datasets or not."} + ) + pad_to_max_length: bool = field( + default=True, + metadata={ + "help": "Whether to pad all samples to `max_seq_length`. " + "If False, will pad the samples dynamically when batching to the maximum length in the batch." + }, + ) + max_train_samples: Optional[int] = field( + default=None, + metadata={ + "help": "For debugging purposes or quicker training, truncate the number of training examples to this " + "value if set." + }, + ) + max_val_samples: Optional[int] = field( + default=None, + metadata={ + "help": "For debugging purposes or quicker training, truncate the number of validation examples to this " + "value if set." + }, + ) + max_test_samples: Optional[int] = field( + default=None, + metadata={ + "help": "For debugging purposes or quicker training, truncate the number of test examples to this " + "value if set." + }, + ) + train_file: Optional[str] = field( + default=None, metadata={"help": "A csv or a json file containing the training data."} + ) + validation_file: Optional[str] = field( + default=None, metadata={"help": "A csv or a json file containing the validation data."} + ) + test_file: Optional[str] = field( + default=None, metadata={"help": "A csv or a json file containing the test data."} + ) + + def __post_init__(self): + if self.task_name is not None: + self.task_name = self.task_name.lower() + if self.task_name not in task_to_keys.keys(): + raise ValueError( + "Unknown task, you should pick one in " + ",".join(task_to_keys.keys()) + ) + elif self.train_file is None or self.validation_file is None: + raise ValueError("Need either a GLUE task or a training/validation file.") + else: + train_extension = self.train_file.split(".")[-1] + assert train_extension in [ + "csv", + "json", + ], "`train_file` should be a csv or a json file." + validation_extension = self.validation_file.split(".")[-1] + assert ( + validation_extension == train_extension + ), "`validation_file` should have the same extension (csv or json) as `train_file`." + + +@dataclass +class ModelArguments: + """ + Arguments pertaining to which model/config/tokenizer we are going to fine-tune from. + """ + + model_name_or_path: str = field( + metadata={"help": "Path to pretrained model or model identifier from huggingface.co/models"} + ) + config_name: Optional[str] = field( + default=None, + metadata={"help": "Pretrained config name or path if not the same as model_name"}, + ) + tokenizer_name: Optional[str] = field( + default=None, + metadata={"help": "Pretrained tokenizer name or path if not the same as model_name"}, + ) + cache_dir: Optional[str] = field( + default=None, + metadata={ + "help": "Where do you want to store the pretrained models downloaded from huggingface.co" + }, + ) + use_fast_tokenizer: bool = field( + default=True, + metadata={ + "help": "Whether to use one of the fast tokenizer (backed by the tokenizers library) or not." + }, + ) + model_revision: str = field( + default="main", + metadata={ + "help": "The specific model version to use (can be a branch name, tag name or commit id)." + }, + ) + use_auth_token: bool = field( + default=False, + metadata={ + "help": "Will use the token generated when running `transformers-cli login` (necessary to use this script " + "with private models)." + }, + ) + + +def main(): + # See all possible arguments in src/transformers/training_args.py + # or by passing the --help flag to this script. + # We now keep distinct sets of args, for a cleaner separation of concerns. + + parser = HfArgumentParser((ModelArguments, DataTrainingArguments, TrainingArguments)) + if len(sys.argv) == 2 and sys.argv[1].endswith(".json"): + # If we pass only one argument to the script and it's the path to a json file, + # let's parse it to get our arguments. + model_args, data_args, training_args = parser.parse_json_file( + json_file=os.path.abspath(sys.argv[1]) + ) + else: + model_args, data_args, training_args = parser.parse_args_into_dataclasses() + + # Detecting last checkpoint. + last_checkpoint = None + if ( + os.path.isdir(training_args.output_dir) + and training_args.do_train + and not training_args.overwrite_output_dir + ): + last_checkpoint = get_last_checkpoint(training_args.output_dir) + if last_checkpoint is None and len(os.listdir(training_args.output_dir)) > 0: + raise ValueError( + f"Output directory ({training_args.output_dir}) already exists and is not empty. " + "Use --overwrite_output_dir to overcome." + ) + elif last_checkpoint is not None: + logger.info( + f"Checkpoint detected, resuming training at {last_checkpoint}. To avoid this behavior, change " + "the `--output_dir` or add `--overwrite_output_dir` to train from scratch." + ) + + # Setup logging + logging.basicConfig( + format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", + datefmt="%m/%d/%Y %H:%M:%S", + handlers=[logging.StreamHandler(sys.stdout)], + ) + logger.setLevel(logging.INFO if is_main_process(training_args.local_rank) else logging.WARN) + + # Log on each process the small summary: + logger.warning( + f"Process rank: {training_args.local_rank}, device: {training_args.device}, n_gpu: {training_args.n_gpu}" + + f"distributed training: {bool(training_args.local_rank != -1)}, 16-bits training: {training_args.fp16}" + ) + # Set the verbosity to info of the Transformers logger (on main process only): + if is_main_process(training_args.local_rank): + transformers.utils.logging.set_verbosity_info() + transformers.utils.logging.enable_default_handler() + transformers.utils.logging.enable_explicit_format() + logger.info(f"Training/evaluation parameters {training_args}") + + # Set seed before initializing model. + set_seed(training_args.seed) + + # Get the datasets: you can either provide your own CSV/JSON training and evaluation files (see below) + # or specify a GLUE benchmark task (the dataset will be downloaded automatically from the datasets Hub). + # + # For CSV/JSON files, this script will use as labels the column called 'label' and as pair of sentences the + # sentences in columns called 'sentence1' and 'sentence2' if such column exists or the first two columns not named + # label if at least two columns are provided. + # + # If the CSVs/JSONs contain only one non-label column, the script does single sentence classification on this + # single column. You can easily tweak this behavior (see below) + # + # In distributed training, the load_dataset function guarantee that only one local process can concurrently + # download the dataset. + if data_args.task_name is not None: + # Downloading and loading a dataset from the hub. + datasets = load_dataset("glue", data_args.task_name) + else: + # Loading a dataset from your local files. + # CSV/JSON training and evaluation files are needed. + data_files = {"train": data_args.train_file, "validation": data_args.validation_file} + + # Get the test dataset: you can provide your own CSV/JSON test file (see below) + # when you use `do_predict` without specifying a GLUE benchmark task. + if training_args.do_predict: + if data_args.test_file is not None: + train_extension = data_args.train_file.split(".")[-1] + test_extension = data_args.test_file.split(".")[-1] + assert ( + test_extension == train_extension + ), "`test_file` should have the same extension (csv or json) as `train_file`." + data_files["test"] = data_args.test_file + else: + raise ValueError("Need either a GLUE task or a test file for `do_predict`.") + + for key in data_files.keys(): + logger.info(f"load a local file for {key}: {data_files[key]}") + + if data_args.train_file.endswith(".csv"): + # Loading a dataset from local csv files + datasets = load_dataset("csv", data_files=data_files) + else: + # Loading a dataset from local json files + datasets = load_dataset("json", data_files=data_files) + # See more about loading any type of standard or custom dataset at + # https://huggingface.co/docs/datasets/loading_datasets.html. + + # Labels + if data_args.task_name is not None: + is_regression = data_args.task_name == "stsb" + if not is_regression: + label_list = datasets["train"].features["label"].names + num_labels = len(label_list) + else: + num_labels = 1 + else: + # Trying to have good defaults here, don't hesitate to tweak to your needs. + is_regression = datasets["train"].features["label"].dtype in ["float32", "float64"] + if is_regression: + num_labels = 1 + else: + # A useful fast method: + # https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.unique + label_list = datasets["train"].unique("label") + label_list.sort() # Let's sort it for determinism + num_labels = len(label_list) + + # Load pretrained model and tokenizer + # + # In distributed training, the .from_pretrained methods guarantee that only one local process can concurrently + # download model & vocab. + config = AutoConfig.from_pretrained( + model_args.config_name if model_args.config_name else model_args.model_name_or_path, + num_labels=num_labels, + finetuning_task=data_args.task_name, + cache_dir=model_args.cache_dir, + revision=model_args.model_revision, + use_auth_token=True if model_args.use_auth_token else None, + ) + tokenizer = AutoTokenizer.from_pretrained( + model_args.tokenizer_name if model_args.tokenizer_name else model_args.model_name_or_path, + cache_dir=model_args.cache_dir, + use_fast=model_args.use_fast_tokenizer, + revision=model_args.model_revision, + use_auth_token=True if model_args.use_auth_token else None, + ) + model = AutoModelForSequenceClassification.from_pretrained( + model_args.model_name_or_path, + from_tf=bool(".ckpt" in model_args.model_name_or_path), + config=config, + cache_dir=model_args.cache_dir, + revision=model_args.model_revision, + use_auth_token=True if model_args.use_auth_token else None, + ) + + # Preprocessing the datasets + if data_args.task_name is not None: + sentence1_key, sentence2_key = task_to_keys[data_args.task_name] + else: + # Again, we try to have some nice defaults but don't hesitate to tweak to your use case. + non_label_column_names = [ + name for name in datasets["train"].column_names if name != "label" + ] + if "sentence1" in non_label_column_names and "sentence2" in non_label_column_names: + sentence1_key, sentence2_key = "sentence1", "sentence2" + else: + if len(non_label_column_names) >= 2: + sentence1_key, sentence2_key = non_label_column_names[:2] + else: + sentence1_key, sentence2_key = non_label_column_names[0], None + + # Padding strategy + if data_args.pad_to_max_length: + padding = "max_length" + else: + # We will pad later, dynamically at batch creation, to the max sequence length in each batch + padding = False + + # Some models have set the order of the labels to use, so let's make sure we do use it. + label_to_id = None + if ( + model.config.label2id != PretrainedConfig(num_labels=num_labels).label2id + and data_args.task_name is not None + and not is_regression + ): + # Some have all caps in their config, some don't. + label_name_to_id = {k.lower(): v for k, v in model.config.label2id.items()} + if list(sorted(label_name_to_id.keys())) == list(sorted(label_list)): + label_to_id = {i: int(label_name_to_id[label_list[i]]) for i in range(num_labels)} + else: + logger.warn( + "Your model seems to have been trained with labels, but they don't match the dataset: ", + f"model labels: {list(sorted(label_name_to_id.keys()))}, dataset labels: {list(sorted(label_list))}." + "\nIgnoring the model labels as a result.", + ) + elif data_args.task_name is None and not is_regression: + label_to_id = {v: i for i, v in enumerate(label_list)} + + if data_args.max_seq_length > tokenizer.model_max_length: + logger.warn( + f"The max_seq_length passed ({data_args.max_seq_length}) is larger than the maximum length for the" + f"model ({tokenizer.model_max_length}). Using max_seq_length={tokenizer.model_max_length}." + ) + max_seq_length = min(data_args.max_seq_length, tokenizer.model_max_length) + + def preprocess_function(examples): + # Tokenize the texts + args = ( + (examples[sentence1_key],) + if sentence2_key is None + else (examples[sentence1_key], examples[sentence2_key]) + ) + result = tokenizer(*args, padding=padding, max_length=max_seq_length, truncation=True) + + # Map labels to IDs (not necessary for GLUE tasks) + if label_to_id is not None and "label" in examples: + result["label"] = [(label_to_id[l] if l != -1 else -1) for l in examples["label"]] + return result + + datasets = datasets.map( + preprocess_function, batched=True, load_from_cache_file=not data_args.overwrite_cache + ) + if training_args.do_train: + if "train" not in datasets: + raise ValueError("--do_train requires a train dataset") + train_dataset = datasets["train"] + if data_args.max_train_samples is not None: + train_dataset = train_dataset.select(range(data_args.max_train_samples)) + + if training_args.do_eval: + if "validation" not in datasets and "validation_matched" not in datasets: + raise ValueError("--do_eval requires a validation dataset") + eval_dataset = datasets[ + "validation_matched" if data_args.task_name == "mnli" else "validation" + ] + if data_args.max_val_samples is not None: + eval_dataset = eval_dataset.select(range(data_args.max_val_samples)) + + if ( + training_args.do_predict + or data_args.task_name is not None + or data_args.test_file is not None + ): + if "test" not in datasets and "test_matched" not in datasets: + raise ValueError("--do_predict requires a test dataset") + test_dataset = datasets["test_matched" if data_args.task_name == "mnli" else "test"] + if data_args.max_test_samples is not None: + test_dataset = test_dataset.select(range(data_args.max_test_samples)) + + # Log a few random samples from the training set: + if training_args.do_train: + for index in random.sample(range(len(train_dataset)), 3): + logger.info(f"Sample {index} of the training set: {train_dataset[index]}.") + + # Get the metric function + if data_args.task_name is not None: + metric = load_metric("glue", data_args.task_name) + # TODO: When datasets metrics include regular accuracy, make an else here and remove special branch from + # compute_metrics + + # You can define your custom compute_metrics function. It takes an `EvalPrediction` object (a namedtuple with a + # predictions and label_ids field) and has to return a dictionary string to float. + def compute_metrics(p: EvalPrediction): + preds = p.predictions[0] if isinstance(p.predictions, tuple) else p.predictions + preds = np.squeeze(preds) if is_regression else np.argmax(preds, axis=1) + if data_args.task_name is not None: + result = metric.compute(predictions=preds, references=p.label_ids) + if len(result) > 1: + result["combined_score"] = np.mean(list(result.values())).item() + return result + elif is_regression: + return {"mse": ((preds - p.label_ids) ** 2).mean().item()} + else: + return {"accuracy": (preds == p.label_ids).astype(np.float32).mean().item()} + + # Data collator will default to DataCollatorWithPadding, so we change it if we already did the padding. + if data_args.pad_to_max_length: + data_collator = default_data_collator + elif training_args.fp16: + data_collator = DataCollatorWithPadding(tokenizer, pad_to_multiple_of=8) + else: + data_collator = None + + # Initialize our Trainer + trainer = Trainer( + model=model, + args=training_args, + train_dataset=train_dataset if training_args.do_train else None, + eval_dataset=eval_dataset if training_args.do_eval else None, + compute_metrics=compute_metrics, + tokenizer=tokenizer, + data_collator=data_collator, + ) + + # Training + if training_args.do_train: + checkpoint = None + if last_checkpoint is not None: + checkpoint = last_checkpoint + elif os.path.isdir(model_args.model_name_or_path): + # Check the config from that potential checkpoint has the right number of labels before using it as a + # checkpoint. + if AutoConfig.from_pretrained(model_args.model_name_or_path).num_labels == num_labels: + checkpoint = model_args.model_name_or_path + + train_result = trainer.train(resume_from_checkpoint=checkpoint) + metrics = train_result.metrics + max_train_samples = ( + data_args.max_train_samples + if data_args.max_train_samples is not None + else len(train_dataset) + ) + metrics["train_samples"] = min(max_train_samples, len(train_dataset)) + + trainer.save_model() # Saves the tokenizer too for easy upload + + trainer.log_metrics("train", metrics) + trainer.save_metrics("train", metrics) + trainer.save_state() + + # Evaluation + if training_args.do_eval: + logger.info("*** Evaluate ***") + + # Loop to handle MNLI double evaluation (matched, mis-matched) + tasks = [data_args.task_name] + eval_datasets = [eval_dataset] + if data_args.task_name == "mnli": + tasks.append("mnli-mm") + eval_datasets.append(datasets["validation_mismatched"]) + + for eval_dataset, task in zip(eval_datasets, tasks): + metrics = trainer.evaluate(eval_dataset=eval_dataset) + + max_val_samples = ( + data_args.max_val_samples + if data_args.max_val_samples is not None + else len(eval_dataset) + ) + metrics["eval_samples"] = min(max_val_samples, len(eval_dataset)) + + trainer.log_metrics("eval", metrics) + trainer.save_metrics("eval", metrics) + + if training_args.do_predict: + logger.info("*** Test ***") + + # Loop to handle MNLI double evaluation (matched, mis-matched) + tasks = [data_args.task_name] + test_datasets = [test_dataset] + if data_args.task_name == "mnli": + tasks.append("mnli-mm") + test_datasets.append(datasets["test_mismatched"]) + + for test_dataset, task in zip(test_datasets, tasks): + # Removing the `label` columns because it contains -1 and Trainer won't like that. + test_dataset.remove_columns_("label") + predictions = trainer.predict(test_dataset=test_dataset).predictions + predictions = ( + np.squeeze(predictions) if is_regression else np.argmax(predictions, axis=1) + ) + + output_test_file = os.path.join(training_args.output_dir, f"test_results_{task}.txt") + if trainer.is_world_process_zero(): + with open(output_test_file, "w") as writer: + logger.info(f"***** Test results {task} *****") + writer.write("index\tprediction\n") + for index, item in enumerate(predictions): + if is_regression: + writer.write(f"{index}\t{item:3.3f}\n") + else: + item = label_list[item] + writer.write(f"{index}\t{item}\n") + + +def _mp_fn(index): + # For xla_spawn (TPUs) + main() + + +if __name__ == "__main__": + main() diff --git a/tests/data/huggingface_byoc/train/dummy.csv b/tests/data/huggingface_byoc/train/dummy.csv new file mode 100644 index 0000000000..fb1539d552 --- /dev/null +++ b/tests/data/huggingface_byoc/train/dummy.csv @@ -0,0 +1 @@ +# dummy data \ No newline at end of file diff --git a/tests/integ/__init__.py b/tests/integ/__init__.py index 00ed09577b..9133fc8904 100644 --- a/tests/integ/__init__.py +++ b/tests/integ/__init__.py @@ -158,7 +158,7 @@ "ap-northeast-1", "eu-central-1", ] -# TODO: SM Training Compiler team to add all supported regions. + TRAINING_COMPILER_SUPPORTED_REGIONS = [ "af-south-1", "ap-east-1", diff --git a/tests/integ/test_training_compiler.py b/tests/integ/test_training_compiler.py index 67de050ed1..724cd8890c 100644 --- a/tests/integ/test_training_compiler.py +++ b/tests/integ/test_training_compiler.py @@ -20,6 +20,8 @@ from sagemaker.huggingface import TrainingCompilerConfig as HFTrainingCompilerConfig from sagemaker.tensorflow import TensorFlow from sagemaker.tensorflow import TrainingCompilerConfig as TFTrainingCompilerConfig +from sagemaker.pytorch import PyTorch +from sagemaker.pytorch import TrainingCompilerConfig as PTTrainingCompilerConfig from tests import integ from tests.integ import DATA_DIR, TRAINING_DEFAULT_TIMEOUT_MINUTES @@ -48,8 +50,7 @@ def imagenet_val_set(request, sagemaker_session, tmpdir_factory): key_prefix="Imagenet/TFRecords/validation", ) train_input = sagemaker_session.upload_data( - path=local_path, - key_prefix="integ-test-data/trcomp/tensorflow/imagenet/val", + path=local_path, key_prefix="integ-test-data/trcomp/tensorflow/imagenet/val" ) return train_input @@ -84,8 +85,8 @@ def skip_if_incompatible(gpu_instance_type, request): @pytest.mark.parametrize( "gpu_instance_type,instance_count", [ - ("ml.p3.2xlarge", 1), - ("ml.p3.16xlarge", 2), + pytest.param("ml.p3.2xlarge", 1, marks=pytest.mark.release), + pytest.param("ml.p3.16xlarge", 2), ], ) def test_huggingface_pytorch( @@ -129,27 +130,32 @@ def test_huggingface_pytorch( hf.fit(huggingface_dummy_dataset) -@pytest.mark.release -def test_huggingface_pytorch_release( +@pytest.mark.parametrize( + "gpu_instance_type,instance_count", + [ + pytest.param("ml.p3.2xlarge", 1, marks=pytest.mark.release), + pytest.param("ml.p3.16xlarge", 2), + ], +) +def test_pytorch( sagemaker_session, gpu_instance_type, - huggingface_training_compiler_latest_version, - huggingface_training_compiler_pytorch_latest_version, + instance_count, + pytorch_training_compiler_latest_version, huggingface_dummy_dataset, ): """ - Test the HuggingFace estimator with PyTorch + Test the PyTorch estimator """ with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES): - data_path = os.path.join(DATA_DIR, "huggingface") - hf = HuggingFace( + hf = PyTorch( py_version="py38", - entry_point=os.path.join(data_path, "run_glue.py"), + source_dir=os.path.join(DATA_DIR, "huggingface_byoc"), + entry_point="run_glue.py", role="SageMakerRole", - transformers_version=huggingface_training_compiler_latest_version, - pytorch_version=huggingface_training_compiler_pytorch_latest_version, - instance_count=1, + framework_version=pytorch_training_compiler_latest_version, + instance_count=instance_count, instance_type=gpu_instance_type, hyperparameters={ "model_name_or_path": "distilbert-base-cased", @@ -163,7 +169,8 @@ def test_huggingface_pytorch_release( }, sagemaker_session=sagemaker_session, disable_profiler=True, - compiler_config=HFTrainingCompilerConfig(), + compiler_config=PTTrainingCompilerConfig(), + distribution={"pytorchxla": {"enabled": True}} if instance_count > 1 else None, ) hf.fit(huggingface_dummy_dataset) @@ -209,10 +216,7 @@ def test_huggingface_tensorflow( @pytest.mark.release def test_tensorflow( - sagemaker_session, - gpu_instance_type, - tensorflow_training_latest_version, - imagenet_val_set, + sagemaker_session, gpu_instance_type, tensorflow_training_latest_version, imagenet_val_set ): """ Test the TensorFlow estimator @@ -264,8 +268,4 @@ def test_tensorflow( compiler_config=TFTrainingCompilerConfig(), ) - tf.fit( - inputs=imagenet_val_set, - logs=True, - wait=True, - ) + tf.fit(inputs=imagenet_val_set, logs=True, wait=True) diff --git a/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py b/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py new file mode 100644 index 0000000000..0fe2402695 --- /dev/null +++ b/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py @@ -0,0 +1,616 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +from __future__ import absolute_import +import logging + +import json +import os + +import pytest +from mock import MagicMock, Mock, patch, ANY +from packaging.version import Version + +from sagemaker import image_uris +from sagemaker.pytorch import PyTorch, TrainingCompilerConfig +from sagemaker.pytorch.model import PyTorchModel +from sagemaker.instance_group import InstanceGroup + +from tests.unit.sagemaker.training_compiler import EC2_GPU_INSTANCE_CLASSES + + +DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "..", "data") +SCRIPT_PATH = os.path.join(DATA_DIR, "dummy_script.py") +SERVING_SCRIPT_FILE = "another_dummy_script.py" +MODEL_DATA = "s3://some/data.tar.gz" +ENV = {"DUMMY_ENV_VAR": "dummy_value"} +TIMESTAMP = "2017-11-06-14:14:15.672" +TIME = 1510006209.073025 +BUCKET_NAME = "mybucket" +INSTANCE_COUNT = 1 +INSTANCE_TYPE = "ml.p3.2xlarge" +IMAGE_URI = "pytorch" +JOB_NAME = "{}-{}".format(IMAGE_URI, TIMESTAMP) +ROLE = "Dummy" +REGION = "us-east-1" +GPU = "ml.p3.2xlarge" +SUPPORTED_GPU_INSTANCE_CLASSES = {"p3", "p3dn", "g4dn", "p4d", "g5"} +UNSUPPORTED_GPU_INSTANCE_CLASSES = EC2_GPU_INSTANCE_CLASSES - SUPPORTED_GPU_INSTANCE_CLASSES + +LIST_TAGS_RESULT = {"Tags": [{"Key": "TagtestKey", "Value": "TagtestValue"}]} + +EXPERIMENT_CONFIG = { + "ExperimentName": "exp", + "TrialName": "trial", + "TrialComponentDisplayName": "tc", +} + + +@pytest.fixture(scope="module") +def cpu_instance_type(): + return "ml.m5.xlarge" + + +@pytest.fixture(name="sagemaker_session", scope="function") +def fixture_sagemaker_session(): + boto_mock = Mock(name="boto_session", region_name=REGION) + session = Mock( + name="sagemaker_session", + boto_session=boto_mock, + boto_region_name=REGION, + config=None, + local_mode=False, + s3_resource=None, + s3_client=None, + ) + + describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} + session.sagemaker_client.describe_training_job = Mock(return_value=describe) + session.sagemaker_client.list_tags = Mock(return_value=LIST_TAGS_RESULT) + session.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) + session.expand_role = Mock(name="expand_role", return_value=ROLE) + return session + + +def _get_full_gpu_image_uri(version, instance_type, training_compiler_config): + return image_uris.retrieve( + "pytorch-training-compiler", + REGION, + version=version, + py_version="py38", + instance_type=instance_type, + image_scope="training", + container_version=None, + training_compiler_config=training_compiler_config, + ) + + +def _create_train_job(version, instance_type, training_compiler_config, instance_count=1): + return { + "image_uri": _get_full_gpu_image_uri(version, instance_type, training_compiler_config), + "input_mode": "File", + "input_config": [ + { + "ChannelName": "training", + "DataSource": { + "S3DataSource": { + "S3DataDistributionType": "FullyReplicated", + "S3DataType": "S3Prefix", + } + }, + } + ], + "role": ROLE, + "job_name": JOB_NAME, + "output_config": {"S3OutputPath": "s3://{}/".format(BUCKET_NAME)}, + "resource_config": { + "InstanceType": instance_type, + "InstanceCount": instance_count, + "VolumeSizeInGB": 30, + }, + "hyperparameters": { + "sagemaker_program": json.dumps("dummy_script.py"), + "sagemaker_container_log_level": str(logging.INFO), + "sagemaker_job_name": json.dumps(JOB_NAME), + "sagemaker_submit_directory": json.dumps( + "s3://{}/{}/source/sourcedir.tar.gz".format(BUCKET_NAME, JOB_NAME) + ), + "sagemaker_region": '"us-east-1"', + }, + "stop_condition": {"MaxRuntimeInSeconds": 24 * 60 * 60}, + "tags": None, + "vpc_config": None, + "metric_definitions": None, + "environment": None, + "retry_strategy": None, + "experiment_config": EXPERIMENT_CONFIG, + "debugger_hook_config": { + "CollectionConfigurations": [], + "S3OutputPath": "s3://{}/".format(BUCKET_NAME), + }, + "profiler_rule_configs": [ + { + "RuleConfigurationName": "ProfilerReport-1510006209", + "RuleEvaluatorImage": "503895931360.dkr.ecr.us-east-1.amazonaws.com/sagemaker-debugger-rules:latest", + "RuleParameters": {"rule_to_invoke": "ProfilerReport"}, + } + ], + "profiler_config": {"S3OutputPath": "s3://{}/".format(BUCKET_NAME)}, + } + + +def test_unsupported_BYOC( + pytorch_training_compiler_version, +): + byoc = ( + "1.dkr.ecr.us-east-1.amazonaws.com/pytorch-trcomp-training:" + "1.12.0-" + "gpu-" + "py38-cu113-ubuntu20.04" + ) + with pytest.raises(ValueError): + PyTorch( + image_uri=byoc, + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_count=INSTANCE_COUNT, + instance_type=INSTANCE_TYPE, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + ).fit() + + +def test_unsupported_cpu_instance(cpu_instance_type, pytorch_training_compiler_version): + with pytest.raises(ValueError): + PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_count=INSTANCE_COUNT, + instance_type=cpu_instance_type, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + ).fit() + + +@pytest.mark.parametrize("unsupported_gpu_instance_class", UNSUPPORTED_GPU_INSTANCE_CLASSES) +def test_unsupported_gpu_instance( + unsupported_gpu_instance_class, pytorch_training_compiler_version +): + with pytest.raises(ValueError): + PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_count=INSTANCE_COUNT, + instance_type=f"ml.{unsupported_gpu_instance_class}.xlarge", + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + ).fit() + + +@pytest.mark.xfail(reason="With only 1 supported version, user input is ignored.") +def test_unsupported_framework_version(): + with pytest.raises(ValueError): + PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_count=INSTANCE_COUNT, + instance_type=INSTANCE_TYPE, + framework_version="99.99.99", + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + ).fit() + + +def test_unsupported_python_2( + pytorch_training_compiler_version, +): + with pytest.raises(ValueError): + PyTorch( + py_version="py27", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_count=INSTANCE_COUNT, + instance_type=INSTANCE_TYPE, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + ).fit() + + +def test_unsupported_instance_group( + pytorch_training_compiler_version, +): + if Version(pytorch_training_compiler_version) < Version("1.12"): + pytest.skip("This test is intended for PyTorch 1.12 and above") + with pytest.raises(ValueError): + PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_groups=[ + InstanceGroup("ml.p3dn.24xlarge", "ml.p3dn.24xlarge", 16), + InstanceGroup("ml.p4d.24xlarge", "ml.p4d.24xlarge", 16), + ], + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + ).fit() + + +def test_unsupported_distribution( + pytorch_training_compiler_version, +): + if Version(pytorch_training_compiler_version) < Version("1.12"): + pytest.skip("This test is intended for PyTorch 1.12 and above") + with pytest.raises(ValueError): + PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_count=2, + instance_type=INSTANCE_TYPE, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + distribution={"smdistributed": {"dataparallel": {"enabled": True}}}, + ).fit() + + with pytest.raises(ValueError): + PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_count=2, + instance_type=INSTANCE_TYPE, + transformers_version="4.17", + pytorch_version="1.10", + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + distribution={"pytorchxla": {"enabled": True}}, + ).fit() + + with pytest.raises(ValueError): + PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + instance_count=2, + instance_type=INSTANCE_TYPE, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + distribution={"mpi": {"enabled": True}}, + ).fit() + + +@patch("sagemaker.utils.repack_model", MagicMock()) +@patch("sagemaker.utils.create_tar_file", MagicMock()) +@patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) +@patch("time.time", return_value=TIME) +@pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) +def test_pytorchxla_distribution( + time, name_from_base, sagemaker_session, pytorch_training_compiler_version, instance_class +): + if Version(pytorch_training_compiler_version) < Version("1.12"): + pytest.skip("This test is intended for PyTorch 1.12 and above") + compiler_config = TrainingCompilerConfig() + instance_type = f"ml.{instance_class}.xlarge" + + pt = PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + sagemaker_session=sagemaker_session, + instance_count=2, + instance_type=instance_type, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(), + distribution={"pytorchxla": {"enabled": True}}, + ) + + inputs = "s3://mybucket/train" + + pt.fit(inputs=inputs, experiment_config=EXPERIMENT_CONFIG) + + sagemaker_call_names = [c[0] for c in sagemaker_session.method_calls] + assert sagemaker_call_names == ["train", "logs_for_job"] + boto_call_names = [c[0] for c in sagemaker_session.boto_session.method_calls] + assert boto_call_names == ["resource"] + + expected_train_args = _create_train_job( + pytorch_training_compiler_version, instance_type, compiler_config, instance_count=2 + ) + expected_train_args["input_config"][0]["DataSource"]["S3DataSource"]["S3Uri"] = inputs + expected_train_args["enable_sagemaker_metrics"] = False + expected_train_args["hyperparameters"][TrainingCompilerConfig.HP_ENABLE_COMPILER] = json.dumps( + True + ) + expected_train_args["hyperparameters"][PyTorch.LAUNCH_PT_XLA_ENV_NAME] = json.dumps(True) + expected_train_args["hyperparameters"][TrainingCompilerConfig.HP_ENABLE_DEBUG] = json.dumps( + False + ) + + actual_train_args = sagemaker_session.method_calls[0][2] + assert ( + actual_train_args == expected_train_args + ), f"{json.dumps(actual_train_args, indent=2)} != {json.dumps(expected_train_args, indent=2)}" + + +@patch("sagemaker.utils.repack_model", MagicMock()) +@patch("sagemaker.utils.create_tar_file", MagicMock()) +@patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) +@patch("time.time", return_value=TIME) +@pytest.mark.parametrize("instance_class", SUPPORTED_GPU_INSTANCE_CLASSES) +def test_default_compiler_config( + time, name_from_base, sagemaker_session, pytorch_training_compiler_version, instance_class +): + compiler_config = TrainingCompilerConfig() + instance_type = f"ml.{instance_class}.xlarge" + + pt = PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + sagemaker_session=sagemaker_session, + instance_count=INSTANCE_COUNT, + instance_type=instance_type, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=compiler_config, + ) + + inputs = "s3://mybucket/train" + + pt.fit(inputs=inputs, experiment_config=EXPERIMENT_CONFIG) + + sagemaker_call_names = [c[0] for c in sagemaker_session.method_calls] + assert sagemaker_call_names == ["train", "logs_for_job"] + boto_call_names = [c[0] for c in sagemaker_session.boto_session.method_calls] + assert boto_call_names == ["resource"] + + expected_train_args = _create_train_job( + pytorch_training_compiler_version, instance_type, compiler_config + ) + expected_train_args["input_config"][0]["DataSource"]["S3DataSource"]["S3Uri"] = inputs + expected_train_args["enable_sagemaker_metrics"] = False + expected_train_args["hyperparameters"][TrainingCompilerConfig.HP_ENABLE_COMPILER] = json.dumps( + True + ) + expected_train_args["hyperparameters"][TrainingCompilerConfig.HP_ENABLE_DEBUG] = json.dumps( + False + ) + + actual_train_args = sagemaker_session.method_calls[0][2] + assert ( + actual_train_args == expected_train_args + ), f"{json.dumps(actual_train_args, indent=2)} != {json.dumps(expected_train_args, indent=2)}" + + +@patch("sagemaker.utils.repack_model", MagicMock()) +@patch("sagemaker.utils.create_tar_file", MagicMock()) +@patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) +@patch("time.time", return_value=TIME) +def test_debug_compiler_config( + time, name_from_base, sagemaker_session, pytorch_training_compiler_version +): + compiler_config = TrainingCompilerConfig(debug=True) + + pt = PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + sagemaker_session=sagemaker_session, + instance_count=INSTANCE_COUNT, + instance_type=INSTANCE_TYPE, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=compiler_config, + ) + + inputs = "s3://mybucket/train" + + pt.fit(inputs=inputs, experiment_config=EXPERIMENT_CONFIG) + + sagemaker_call_names = [c[0] for c in sagemaker_session.method_calls] + assert sagemaker_call_names == ["train", "logs_for_job"] + boto_call_names = [c[0] for c in sagemaker_session.boto_session.method_calls] + assert boto_call_names == ["resource"] + + expected_train_args = _create_train_job( + pytorch_training_compiler_version, INSTANCE_TYPE, compiler_config + ) + expected_train_args["input_config"][0]["DataSource"]["S3DataSource"]["S3Uri"] = inputs + expected_train_args["enable_sagemaker_metrics"] = False + expected_train_args["hyperparameters"][TrainingCompilerConfig.HP_ENABLE_COMPILER] = json.dumps( + True + ) + expected_train_args["hyperparameters"][TrainingCompilerConfig.HP_ENABLE_DEBUG] = json.dumps( + True + ) + + actual_train_args = sagemaker_session.method_calls[0][2] + assert ( + actual_train_args == expected_train_args + ), f"{json.dumps(actual_train_args, indent=2)} != {json.dumps(expected_train_args, indent=2)}" + + +@patch("sagemaker.utils.repack_model", MagicMock()) +@patch("sagemaker.utils.create_tar_file", MagicMock()) +@patch("sagemaker.estimator.name_from_base", return_value=JOB_NAME) +@patch("time.time", return_value=TIME) +def test_disable_compiler_config( + time, name_from_base, sagemaker_session, pytorch_training_compiler_version +): + compiler_config = TrainingCompilerConfig(enabled=False) + + pt = PyTorch( + py_version="py38", + entry_point=SCRIPT_PATH, + role=ROLE, + sagemaker_session=sagemaker_session, + instance_count=INSTANCE_COUNT, + instance_type=INSTANCE_TYPE, + framework_version=pytorch_training_compiler_version, + enable_sagemaker_metrics=False, + compiler_config=TrainingCompilerConfig(enabled=False), + ) + + inputs = "s3://mybucket/train" + + pt.fit(inputs=inputs, experiment_config=EXPERIMENT_CONFIG) + + sagemaker_call_names = [c[0] for c in sagemaker_session.method_calls] + assert sagemaker_call_names == ["train", "logs_for_job"] + boto_call_names = [c[0] for c in sagemaker_session.boto_session.method_calls] + assert boto_call_names == ["resource"] + + expected_train_args = _create_train_job( + pytorch_training_compiler_version, INSTANCE_TYPE, compiler_config + ) + expected_train_args["input_config"][0]["DataSource"]["S3DataSource"]["S3Uri"] = inputs + expected_train_args["enable_sagemaker_metrics"] = False + expected_train_args["hyperparameters"][TrainingCompilerConfig.HP_ENABLE_COMPILER] = json.dumps( + False + ) + expected_train_args["hyperparameters"][TrainingCompilerConfig.HP_ENABLE_DEBUG] = json.dumps( + False + ) + + actual_train_args = sagemaker_session.method_calls[0][2] + assert ( + actual_train_args == expected_train_args + ), f"{json.dumps(actual_train_args, indent=2)} != {json.dumps(expected_train_args, indent=2)}" + + +@pytest.mark.parametrize( + ["compiler_enabled", "debug_enabled"], [(True, False), (True, True), (False, False)] +) +def test_attach(sagemaker_session, compiler_enabled, debug_enabled): + training_image = ( + "1.dkr.ecr.us-east-1.amazonaws.com/pytorch-trcomp-training:" + "1.12.0-" + "gpu-" + "py38-cu113-ubuntu20.04" + ) + returned_job_description = { + "AlgorithmSpecification": {"TrainingInputMode": "File", "TrainingImage": training_image}, + "HyperParameters": { + "sagemaker_submit_directory": '"s3://some/sourcedir.tar.gz"', + "sagemaker_program": '"iris-dnn-classifier.py"', + "sagemaker_s3_uri_training": '"sagemaker-3/integ-test-data/tf_iris"', + "sagemaker_container_log_level": '"logging.INFO"', + "sagemaker_job_name": '"trcomp"', + "training_steps": "100", + "sagemaker_region": '"us-east-1"', + TrainingCompilerConfig.HP_ENABLE_COMPILER: json.dumps(compiler_enabled), + TrainingCompilerConfig.HP_ENABLE_DEBUG: json.dumps(debug_enabled), + }, + "RoleArn": "arn:aws:iam::366:role/SageMakerRole", + "ResourceConfig": { + "VolumeSizeInGB": 30, + "InstanceCount": 1, + "InstanceType": "ml.p3.2xlarge", + }, + "StoppingCondition": {"MaxRuntimeInSeconds": 24 * 60 * 60}, + "TrainingJobName": "trcomp", + "TrainingJobStatus": "Completed", + "TrainingJobArn": "arn:aws:sagemaker:us-west-2:336:training-job/trcomp", + "OutputDataConfig": {"KmsKeyId": "", "S3OutputPath": "s3://place/output/trcomp"}, + "TrainingJobOutput": {"S3TrainingJobOutput": "s3://here/output.tar.gz"}, + } + sagemaker_session.sagemaker_client.describe_training_job = Mock( + name="describe_training_job", return_value=returned_job_description + ) + + estimator = PyTorch.attach(training_job_name="trcomp", sagemaker_session=sagemaker_session) + assert estimator.latest_training_job.job_name == "trcomp" + assert estimator.py_version == "py38" + assert estimator.framework_version == "1.12.0" + assert estimator.role == "arn:aws:iam::366:role/SageMakerRole" + assert estimator.instance_count == 1 + assert estimator.max_run == 24 * 60 * 60 + assert estimator.input_mode == "File" + assert estimator.base_job_name == "trcomp" + assert estimator.output_path == "s3://place/output/trcomp" + assert estimator.output_kms_key == "" + assert estimator.hyperparameters()["training_steps"] == "100" + assert estimator.hyperparameters()[TrainingCompilerConfig.HP_ENABLE_COMPILER] == json.dumps( + compiler_enabled + ) + assert estimator.hyperparameters()[TrainingCompilerConfig.HP_ENABLE_DEBUG] == json.dumps( + debug_enabled + ) + assert estimator.source_dir == "s3://some/sourcedir.tar.gz" + assert estimator.entry_point == "iris-dnn-classifier.py" + + +@patch("sagemaker.utils.repack_model", MagicMock()) +@patch("sagemaker.utils.create_tar_file", MagicMock()) +def test_register_pytorch_model_auto_infer_framework( + sagemaker_session, pytorch_training_compiler_version +): + + model_package_group_name = "test-pt-register-model" + content_types = ["application/json"] + response_types = ["application/json"] + inference_instances = ["ml.m4.xlarge"] + transform_instances = ["ml.m4.xlarge"] + image_uri = "fakeimage" + + pt_model = PyTorchModel( + model_data="s3://some/data.tar.gz", + role=ROLE, + entry_point=SCRIPT_PATH, + framework_version=pytorch_training_compiler_version, + py_version="py38", + sagemaker_session=sagemaker_session, + ) + + pt_model.register( + content_types, + response_types, + inference_instances, + transform_instances, + model_package_group_name=model_package_group_name, + marketplace_cert=True, + image_uri=image_uri, + ) + + expected_create_model_package_request = { + "containers": [ + { + "Image": image_uri, + "Environment": ANY, + "ModelDataUrl": ANY, + "Framework": "PYTORCH", + "FrameworkVersion": pytorch_training_compiler_version, + } + ], + "content_types": content_types, + "response_types": response_types, + "inference_instances": inference_instances, + "transform_instances": transform_instances, + "model_package_group_name": model_package_group_name, + "marketplace_cert": True, + } + + sagemaker_session.create_model_package_from_containers.assert_called_with( + **expected_create_model_package_request + ) From d779d1b8296242eb15637e85272a1a50a7ee897b Mon Sep 17 00:00:00 2001 From: HappyAmazonian <91216626+HappyAmazonian@users.noreply.github.com> Date: Tue, 6 Dec 2022 16:37:16 -0800 Subject: [PATCH 16/41] feature: Add Neo image uri config for Pytorch 1.12 (#3507) --- .../image_uri_config/neo-pytorch.json | 36 ++++++++++++++++++- tests/data/pytorch_neo/code/inference.py | 4 +-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/sagemaker/image_uri_config/neo-pytorch.json b/src/sagemaker/image_uri_config/neo-pytorch.json index bd15a6450e..c46dd3de5d 100644 --- a/src/sagemaker/image_uri_config/neo-pytorch.json +++ b/src/sagemaker/image_uri_config/neo-pytorch.json @@ -11,7 +11,9 @@ "1.7.0": "1.7", "1.7.1": "1.7", "1.8.0": "1.8", - "1.8.1": "1.8" + "1.8.1": "1.8", + "1.12.0": "1.12", + "1.12.1": "1.12" }, "versions": { "1.4": { @@ -173,6 +175,38 @@ "us-west-2": "301217895009" }, "repository": "sagemaker-inference-pytorch" + }, + "1.12": { + "py_versions": ["py3"], + "registries": { + "af-south-1": "774647643957", + "ap-east-1": "110948597952", + "ap-northeast-1": "941853720454", + "ap-northeast-2": "151534178276", + "ap-northeast-3": "925152966179", + "ap-south-1": "763008648453", + "ap-southeast-1": "324986816169", + "ap-southeast-2": "355873309152", + "ca-central-1": "464438896020", + "cn-north-1": "472730292857", + "cn-northwest-1": "474822919863", + "eu-central-1": "746233611703", + "eu-north-1": "601324751636", + "eu-south-1": "966458181534", + "eu-west-1": "802834080501", + "eu-west-2": "205493899709", + "eu-west-3": "254080097072", + "me-south-1": "836785723513", + "sa-east-1": "756306329178", + "us-east-1": "785573368785", + "us-east-2": "007439368137", + "us-gov-west-1": "263933020539", + "us-iso-east-1": "167761179201", + "us-isob-east-1": "406031935815", + "us-west-1": "710691900526", + "us-west-2": "301217895009" + }, + "repository": "sagemaker-inference-pytorch" } } } diff --git a/tests/data/pytorch_neo/code/inference.py b/tests/data/pytorch_neo/code/inference.py index 5b89c2bebc..79fe66d716 100644 --- a/tests/data/pytorch_neo/code/inference.py +++ b/tests/data/pytorch_neo/code/inference.py @@ -71,8 +71,8 @@ def model_fn(model_dir): logger.info("model_fn") neopytorch.config(model_dir=model_dir, neo_runtime=True) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") - # The compiled model is saved as "model.pth" - model = torch.jit.load(os.path.join(model_dir, "model.pth"), map_location=device) + # The compiled model is saved as "model.pth" or "model.pt" + model = torch.jit.load(os.path.join(model_dir, "model.pt"), map_location=device) # It is recommended to run warm-up inference during model load sample_input_path = os.path.join(model_dir, "sample_input.pkl") From 83327fb9ef5eb5f44c9fd3f8925c7791576c9a37 Mon Sep 17 00:00:00 2001 From: ci Date: Wed, 7 Dec 2022 03:20:15 +0000 Subject: [PATCH 17/41] prepare release v2.120.0 --- CHANGELOG.md | 13 +++++++++++++ VERSION | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8b3155231..71894ff29d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## v2.120.0 (2022-12-07) + +### Features + + * Add Neo image uri config for Pytorch 1.12 + * Adding support for SageMaker Training Compiler in PyTorch estimator starting 1.12 + * Update registries with new region account number mappings. + * Add DXB region to frameworks by DLC + +### Bug Fixes and Other Changes + + * support idempotency for framework and spark processors + ## v2.119.0 (2022-12-03) ### Features diff --git a/VERSION b/VERSION index dda4128cf2..7de9d18b4e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.119.1.dev0 +2.120.0 From 5bffb04b78e8cd6422654008511aa61ca6f66efb Mon Sep 17 00:00:00 2001 From: ci Date: Wed, 7 Dec 2022 03:20:17 +0000 Subject: [PATCH 18/41] update development version to v2.120.1.dev0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7de9d18b4e..73c4cd6968 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.120.0 +2.120.1.dev0 From b828396c55082bc5f06092be41555729d775874a Mon Sep 17 00:00:00 2001 From: Malav Shastri <57682969+malav-shastri@users.noreply.github.com> Date: Wed, 7 Dec 2022 20:58:37 +0530 Subject: [PATCH 19/41] feature: Algorithms Region Expansion OSU/DXB (#3508) Co-authored-by: Malav Shastri --- .../image_uri_config/blazingtext.json | 2 ++ .../factorization-machines.json | 2 ++ .../image_uri_config/forecasting-deepar.json | 2 ++ .../image-classification.json | 2 ++ .../image_uri_config/ipinsights.json | 2 ++ src/sagemaker/image_uri_config/kmeans.json | 2 ++ src/sagemaker/image_uri_config/knn.json | 2 ++ .../image_uri_config/linear-learner.json | 2 ++ src/sagemaker/image_uri_config/ntm.json | 2 ++ .../image_uri_config/object-detection.json | 2 ++ .../image_uri_config/object2vec.json | 2 ++ src/sagemaker/image_uri_config/pca.json | 2 ++ .../image_uri_config/randomcutforest.json | 2 ++ .../semantic-segmentation.json | 2 ++ src/sagemaker/image_uri_config/seq2seq.json | 2 ++ src/sagemaker/image_uri_config/sklearn.json | 14 ++++++++ src/sagemaker/image_uri_config/xgboost.json | 36 +++++++++++++++++++ tests/unit/sagemaker/image_uris/test_algos.py | 4 +++ .../unit/sagemaker/image_uris/test_sklearn.py | 2 ++ .../unit/sagemaker/image_uris/test_xgboost.py | 4 +++ 20 files changed, 90 insertions(+) diff --git a/src/sagemaker/image_uri_config/blazingtext.json b/src/sagemaker/image_uri_config/blazingtext.json index c588d65c73..ae4295c59a 100644 --- a/src/sagemaker/image_uri_config/blazingtext.json +++ b/src/sagemaker/image_uri_config/blazingtext.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032" diff --git a/src/sagemaker/image_uri_config/factorization-machines.json b/src/sagemaker/image_uri_config/factorization-machines.json index 0f9930357f..8fb1895707 100644 --- a/src/sagemaker/image_uri_config/factorization-machines.json +++ b/src/sagemaker/image_uri_config/factorization-machines.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/forecasting-deepar.json b/src/sagemaker/image_uri_config/forecasting-deepar.json index 1acc96ed3e..e9beb7acb6 100644 --- a/src/sagemaker/image_uri_config/forecasting-deepar.json +++ b/src/sagemaker/image_uri_config/forecasting-deepar.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "522234722520", "us-east-2": "566113047672", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "156387875391" diff --git a/src/sagemaker/image_uri_config/image-classification.json b/src/sagemaker/image_uri_config/image-classification.json index 44ccb3f08d..61e037da08 100644 --- a/src/sagemaker/image_uri_config/image-classification.json +++ b/src/sagemaker/image_uri_config/image-classification.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032" diff --git a/src/sagemaker/image_uri_config/ipinsights.json b/src/sagemaker/image_uri_config/ipinsights.json index 4e56c149dc..cf3c70194f 100644 --- a/src/sagemaker/image_uri_config/ipinsights.json +++ b/src/sagemaker/image_uri_config/ipinsights.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/kmeans.json b/src/sagemaker/image_uri_config/kmeans.json index 952724ce11..e8e947f094 100644 --- a/src/sagemaker/image_uri_config/kmeans.json +++ b/src/sagemaker/image_uri_config/kmeans.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/knn.json b/src/sagemaker/image_uri_config/knn.json index 79b239966d..89e8ef6224 100644 --- a/src/sagemaker/image_uri_config/knn.json +++ b/src/sagemaker/image_uri_config/knn.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/linear-learner.json b/src/sagemaker/image_uri_config/linear-learner.json index bb027284ab..606edd3791 100644 --- a/src/sagemaker/image_uri_config/linear-learner.json +++ b/src/sagemaker/image_uri_config/linear-learner.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/ntm.json b/src/sagemaker/image_uri_config/ntm.json index 115264b346..16f9565405 100644 --- a/src/sagemaker/image_uri_config/ntm.json +++ b/src/sagemaker/image_uri_config/ntm.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/object-detection.json b/src/sagemaker/image_uri_config/object-detection.json index 6a7ba03695..67b60fe587 100644 --- a/src/sagemaker/image_uri_config/object-detection.json +++ b/src/sagemaker/image_uri_config/object-detection.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032" diff --git a/src/sagemaker/image_uri_config/object2vec.json b/src/sagemaker/image_uri_config/object2vec.json index 39614d1273..b166cc96ff 100644 --- a/src/sagemaker/image_uri_config/object2vec.json +++ b/src/sagemaker/image_uri_config/object2vec.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/pca.json b/src/sagemaker/image_uri_config/pca.json index 5f87d8528c..11982e2197 100644 --- a/src/sagemaker/image_uri_config/pca.json +++ b/src/sagemaker/image_uri_config/pca.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/randomcutforest.json b/src/sagemaker/image_uri_config/randomcutforest.json index ae7a3574be..15dc84dfc5 100644 --- a/src/sagemaker/image_uri_config/randomcutforest.json +++ b/src/sagemaker/image_uri_config/randomcutforest.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107" diff --git a/src/sagemaker/image_uri_config/semantic-segmentation.json b/src/sagemaker/image_uri_config/semantic-segmentation.json index 866dd606b4..f49bc43109 100644 --- a/src/sagemaker/image_uri_config/semantic-segmentation.json +++ b/src/sagemaker/image_uri_config/semantic-segmentation.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032" diff --git a/src/sagemaker/image_uri_config/seq2seq.json b/src/sagemaker/image_uri_config/seq2seq.json index bb3daf93b6..87810ad09d 100644 --- a/src/sagemaker/image_uri_config/seq2seq.json +++ b/src/sagemaker/image_uri_config/seq2seq.json @@ -22,10 +22,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032" diff --git a/src/sagemaker/image_uri_config/sklearn.json b/src/sagemaker/image_uri_config/sklearn.json index 7961fde282..4d093f5f62 100644 --- a/src/sagemaker/image_uri_config/sklearn.json +++ b/src/sagemaker/image_uri_config/sklearn.json @@ -24,10 +24,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -57,10 +59,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -90,10 +94,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -127,10 +133,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -160,10 +168,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -193,10 +203,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -230,10 +242,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" diff --git a/src/sagemaker/image_uri_config/xgboost.json b/src/sagemaker/image_uri_config/xgboost.json index a809083c4a..946e78ecc4 100644 --- a/src/sagemaker/image_uri_config/xgboost.json +++ b/src/sagemaker/image_uri_config/xgboost.json @@ -25,10 +25,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032" @@ -58,10 +60,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -91,10 +95,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -124,10 +130,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -155,10 +163,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -186,10 +196,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -217,10 +229,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -248,10 +262,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -286,10 +302,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032" @@ -319,10 +337,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -352,10 +372,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -385,10 +407,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -416,10 +440,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -447,10 +473,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -478,10 +506,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -509,10 +539,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -544,10 +576,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" @@ -575,10 +609,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249" diff --git a/tests/unit/sagemaker/image_uris/test_algos.py b/tests/unit/sagemaker/image_uris/test_algos.py index 454d375b4b..443727094a 100644 --- a/tests/unit/sagemaker/image_uris/test_algos.py +++ b/tests/unit/sagemaker/image_uris/test_algos.py @@ -68,10 +68,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "382416733822", "us-east-2": "404615174143", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "174872318107", @@ -155,10 +157,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032", diff --git a/tests/unit/sagemaker/image_uris/test_sklearn.py b/tests/unit/sagemaker/image_uris/test_sklearn.py index d0fcbdb300..8563753e8c 100644 --- a/tests/unit/sagemaker/image_uris/test_sklearn.py +++ b/tests/unit/sagemaker/image_uris/test_sklearn.py @@ -37,10 +37,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249", diff --git a/tests/unit/sagemaker/image_uris/test_xgboost.py b/tests/unit/sagemaker/image_uris/test_xgboost.py index 78ab7e10ee..4d0f9f1dc3 100644 --- a/tests/unit/sagemaker/image_uris/test_xgboost.py +++ b/tests/unit/sagemaker/image_uris/test_xgboost.py @@ -35,10 +35,12 @@ "eu-west-3": "749696950732", "eu-south-1": "257386234256", "me-south-1": "249704162688", + "me-central-1": "272398656194", "sa-east-1": "855470959533", "us-east-1": "811284229777", "us-east-2": "825641698319", "us-gov-west-1": "226302683700", + "us-gov-east-1": "237065988967", "us-iso-east-1": "490574956308", "us-west-1": "632365934929", "us-west-2": "433757028032", @@ -67,10 +69,12 @@ "eu-west-3": "659782779980", "eu-south-1": "978288397137", "me-south-1": "801668240914", + "me-central-1": "272398656194", "sa-east-1": "737474898029", "us-east-1": "683313688378", "us-east-2": "257758044811", "us-gov-west-1": "414596584902", + "us-gov-east-1": "237065988967", "us-iso-east-1": "833128469047", "us-west-1": "746614075791", "us-west-2": "246618743249", From 357f73226c9c5fe651ea74169cafe585e1092ad0 Mon Sep 17 00:00:00 2001 From: Navin Soni Date: Wed, 7 Dec 2022 10:36:33 -0800 Subject: [PATCH 20/41] fix: Add constraints file for apache-airflow (#3510) --- requirements/extras/test_requirements.txt | 1 + tox.ini | 2 ++ 2 files changed, 3 insertions(+) diff --git a/requirements/extras/test_requirements.txt b/requirements/extras/test_requirements.txt index b52f394bd0..fe93fd4d0e 100644 --- a/requirements/extras/test_requirements.txt +++ b/requirements/extras/test_requirements.txt @@ -11,6 +11,7 @@ contextlib2==21.6.0 awslogs==0.14.0 black==22.3.0 stopit==1.1.2 +# Update tox.ini to have correct version of airflow constraints file apache-airflow==2.4.1 apache-airflow-providers-amazon==4.0.0 attrs==22.1.0 diff --git a/tox.ini b/tox.ini index 2d5fdf0b40..3a398ca51d 100644 --- a/tox.ini +++ b/tox.ini @@ -73,6 +73,8 @@ passenv = # Can be used to specify which tests to run, e.g.: tox -- -s commands = python -c "import os; os.system('install-custom-pkgs --install-boto-wheels')" + pip install 'apache-airflow==2.4.1' --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.4.1/constraints-3.10.txt" + pytest --cov=sagemaker --cov-append {posargs} {env:IGNORE_COVERAGE:} coverage report -i --fail-under=86 deps = .[test] From a28d1dd129ecceb612d5e8927b6be72937711722 Mon Sep 17 00:00:00 2001 From: Brock Wade Date: Wed, 7 Dec 2022 19:14:12 -0800 Subject: [PATCH 21/41] fix: FrameworkProcessor S3 uploads (#3493) Co-authored-by: Brock Wade Co-authored-by: Mufaddal Rohawala <89424143+mufaddal-rohawala@users.noreply.github.com> --- src/sagemaker/processing.py | 47 +++- .../data/pipeline/test_source_dir/script_1.py | 11 + .../data/pipeline/test_source_dir/script_2.py | 9 + .../pipeline/test_source_dir_2/script_2.py | 9 + .../workflow/test_processing_steps.py | 249 +++++++++++++++++- .../integ/sagemaker/workflow/test_workflow.py | 8 +- 6 files changed, 322 insertions(+), 11 deletions(-) create mode 100644 tests/data/pipeline/test_source_dir/script_1.py create mode 100644 tests/data/pipeline/test_source_dir/script_2.py create mode 100644 tests/data/pipeline/test_source_dir_2/script_2.py diff --git a/src/sagemaker/processing.py b/src/sagemaker/processing.py index 81e3d34b1d..01d4361197 100644 --- a/src/sagemaker/processing.py +++ b/src/sagemaker/processing.py @@ -1741,13 +1741,7 @@ def _pack_and_upload_code( raise RuntimeError("S3 source_dir file must be named `sourcedir.tar.gz.`") script = estimator.uploaded_code.script_name - s3_runproc_sh = S3Uploader.upload_string_as_file_body( - self._generate_framework_script(script), - desired_s3_uri=entrypoint_s3_uri, - kms_key=kms_key, - sagemaker_session=self.sagemaker_session, - ) - logger.info("runproc.sh uploaded to %s", s3_runproc_sh) + s3_runproc_sh = self._create_and_upload_runproc(script, kms_key, entrypoint_s3_uri) return s3_runproc_sh, inputs, job_name @@ -1857,3 +1851,42 @@ def _set_entrypoint(self, command, user_script_name): ) ) self.entrypoint = self.framework_entrypoint_command + [user_script_location] + + def _create_and_upload_runproc(self, user_script, kms_key, entrypoint_s3_uri): + """Create runproc shell script and upload to S3 bucket. + + If leveraging a pipeline session with optimized S3 artifact paths, + the runproc.sh file is hashed and uploaded to a separate S3 location. + + + Args: + user_script (str): Relative path to ```code``` in the source bundle + - e.g. 'process.py'. + kms_key (str): THe kms key used for encryption. + entrypoint_s3_uri (str): The S3 upload path for the runproc script. + """ + from sagemaker.workflow.utilities import _pipeline_config, hash_object + + if _pipeline_config and _pipeline_config.pipeline_name: + runproc_file_str = self._generate_framework_script(user_script) + runproc_file_hash = hash_object(runproc_file_str) + s3_uri = ( + f"s3://{self.sagemaker_session.default_bucket()}/{_pipeline_config.pipeline_name}/" + f"code/{runproc_file_hash}/runproc.sh" + ) + s3_runproc_sh = S3Uploader.upload_string_as_file_body( + runproc_file_str, + desired_s3_uri=s3_uri, + kms_key=kms_key, + sagemaker_session=self.sagemaker_session, + ) + else: + s3_runproc_sh = S3Uploader.upload_string_as_file_body( + self._generate_framework_script(user_script), + desired_s3_uri=entrypoint_s3_uri, + kms_key=kms_key, + sagemaker_session=self.sagemaker_session, + ) + logger.info("runproc.sh uploaded to %s", s3_runproc_sh) + + return s3_runproc_sh diff --git a/tests/data/pipeline/test_source_dir/script_1.py b/tests/data/pipeline/test_source_dir/script_1.py new file mode 100644 index 0000000000..4a427b1898 --- /dev/null +++ b/tests/data/pipeline/test_source_dir/script_1.py @@ -0,0 +1,11 @@ +""" +Integ test file script_1.py +""" +import pathlib + +if __name__ == "__main__": + + print("writing file to /opt/ml/processing/test/test.py...") + pathlib.Path("/opt/ml/processing/test").mkdir(parents=True, exist_ok=True) + with open("/opt/ml/processing/test/test.py", "w") as f: + f.write('print("test...")') diff --git a/tests/data/pipeline/test_source_dir/script_2.py b/tests/data/pipeline/test_source_dir/script_2.py new file mode 100644 index 0000000000..6245dac987 --- /dev/null +++ b/tests/data/pipeline/test_source_dir/script_2.py @@ -0,0 +1,9 @@ +""" +Integ test file script_2.py +""" + +if __name__ == "__main__": + + print("reading file: /opt/ml/procesing/test/test.py") + with open("/opt/ml/processing/test/test.py", "r") as f: + print(f.read()) diff --git a/tests/data/pipeline/test_source_dir_2/script_2.py b/tests/data/pipeline/test_source_dir_2/script_2.py new file mode 100644 index 0000000000..6245dac987 --- /dev/null +++ b/tests/data/pipeline/test_source_dir_2/script_2.py @@ -0,0 +1,9 @@ +""" +Integ test file script_2.py +""" + +if __name__ == "__main__": + + print("reading file: /opt/ml/procesing/test/test.py") + with open("/opt/ml/processing/test/test.py", "r") as f: + print(f.read()) diff --git a/tests/integ/sagemaker/workflow/test_processing_steps.py b/tests/integ/sagemaker/workflow/test_processing_steps.py index 781bce85a7..238eff6123 100644 --- a/tests/integ/sagemaker/workflow/test_processing_steps.py +++ b/tests/integ/sagemaker/workflow/test_processing_steps.py @@ -17,15 +17,18 @@ import re import subprocess from datetime import datetime +from pathlib import Path import pytest from botocore.exceptions import WaiterError +from sagemaker.workflow.utilities import hash_files_or_dirs, hash_object from sagemaker import image_uris, get_execution_role, utils from sagemaker.dataset_definition import DatasetDefinition, AthenaDatasetDefinition -from sagemaker.processing import ProcessingInput, ProcessingOutput -from sagemaker.s3 import S3Uploader -from sagemaker.sklearn import SKLearnProcessor +from sagemaker.processing import ProcessingInput, ProcessingOutput, FrameworkProcessor +from sagemaker.s3 import S3Uploader, S3Downloader +from sagemaker.sklearn import SKLearnProcessor, SKLearn +from sagemaker.tensorflow import TensorFlow from sagemaker.workflow.parameters import ParameterInteger, ParameterString from sagemaker.workflow.pipeline import Pipeline from sagemaker.workflow.steps import ( @@ -379,6 +382,203 @@ def test_one_step_framework_processing_pipeline( pass +def test_multi_step_framework_processing_pipeline_same_source_dir( + pipeline_session, role, pipeline_name +): + default_bucket = pipeline_session.default_bucket() + cache_config = CacheConfig(enable_caching=True, expire_after="PT1H") + + SOURCE_DIR = "/pipeline/test_source_dir" + + framework_processor_tf = FrameworkProcessor( + role=role, + instance_type="ml.m5.xlarge", + instance_count=1, + estimator_cls=TensorFlow, + framework_version="2.9", + py_version="py39", + sagemaker_session=pipeline_session, + ) + + framework_processor_sk = FrameworkProcessor( + framework_version="1.0-1", + instance_type="ml.m5.xlarge", + instance_count=1, + base_job_name="my-job", + role=role, + estimator_cls=SKLearn, + sagemaker_session=pipeline_session, + ) + + step_1 = ProcessingStep( + name="Step-1", + step_args=framework_processor_tf.run( + code="script_1.py", + source_dir=DATA_DIR + SOURCE_DIR, + outputs=[ProcessingOutput(output_name="test", source="/opt/ml/processing/test")], + ), + cache_config=cache_config, + ) + + step_2 = ProcessingStep( + name="Step-2", + step_args=framework_processor_sk.run( + code="script_2.py", + source_dir=DATA_DIR + SOURCE_DIR, + inputs=[ + ProcessingInput( + source=step_1.properties.ProcessingOutputConfig.Outputs["test"].S3Output.S3Uri, + destination="/opt/ml/processing/test", + ), + ], + ), + cache_config=cache_config, + ) + + pipeline = Pipeline( + name=pipeline_name, steps=[step_1, step_2], sagemaker_session=pipeline_session + ) + try: + pipeline.create(role) + definition = json.loads(pipeline.definition()) + + source_dir_1_s3_uri, entry_point_1 = _verify_code_artifacts_of_framework_processing_step( + pipeline_session, + framework_processor_tf, + default_bucket, + pipeline_name, + definition["Steps"][0], + SOURCE_DIR, + "script_1.py", + ) + source_dir_2_s3_uri, entry_point_2 = _verify_code_artifacts_of_framework_processing_step( + pipeline_session, + framework_processor_sk, + default_bucket, + pipeline_name, + definition["Steps"][1], + SOURCE_DIR, + "script_2.py", + ) + + # the same local source_dirs should have the same s3 paths + assert source_dir_1_s3_uri == source_dir_2_s3_uri + + # verify different entry_point paths + assert entry_point_1 != entry_point_2 + + execution = pipeline.start(parameters={}) + try: + execution.wait(delay=540, max_attempts=3) + except WaiterError: + pass + + execution_steps = execution.list_steps() + assert len(execution_steps) == 2 + for step in execution_steps: + assert step["StepStatus"] == "Succeeded" + + finally: + try: + pipeline.delete() + except Exception: + pass + + +def test_multi_step_framework_processing_pipeline_different_source_dir( + pipeline_session, role, pipeline_name +): + default_bucket = pipeline_session.default_bucket() + cache_config = CacheConfig(enable_caching=True, expire_after="PT1H") + + SOURCE_DIR_1 = "/pipeline/test_source_dir" + SOURCE_DIR_2 = "/pipeline/test_source_dir_2" + + framework_processor_tf = FrameworkProcessor( + role=role, + instance_type="ml.m5.xlarge", + instance_count=1, + estimator_cls=TensorFlow, + framework_version="2.9", + py_version="py39", + sagemaker_session=pipeline_session, + ) + + step_1 = ProcessingStep( + name="Step-1", + step_args=framework_processor_tf.run( + code="script_1.py", + source_dir=DATA_DIR + SOURCE_DIR_1, + outputs=[ProcessingOutput(output_name="test", source="/opt/ml/processing/test")], + ), + cache_config=cache_config, + ) + + step_2 = ProcessingStep( + name="Step-2", + step_args=framework_processor_tf.run( + code="script_2.py", + source_dir=DATA_DIR + SOURCE_DIR_2, + inputs=[ + ProcessingInput( + source=step_1.properties.ProcessingOutputConfig.Outputs["test"].S3Output.S3Uri, + destination="/opt/ml/processing/test", + ), + ], + ), + cache_config=cache_config, + ) + + pipeline = Pipeline( + name=pipeline_name, steps=[step_1, step_2], sagemaker_session=pipeline_session + ) + try: + pipeline.create(role) + definition = json.loads(pipeline.definition()) + + source_dir_1_s3_uri, entry_point_1 = _verify_code_artifacts_of_framework_processing_step( + pipeline_session, + framework_processor_tf, + default_bucket, + pipeline_name, + definition["Steps"][0], + SOURCE_DIR_1, + "script_1.py", + ) + source_dir_2_s3_uri, entry_point_2 = _verify_code_artifacts_of_framework_processing_step( + pipeline_session, + framework_processor_tf, + default_bucket, + pipeline_name, + definition["Steps"][1], + SOURCE_DIR_2, + "script_2.py", + ) + + # different local source_dirs should have different s3 paths + assert source_dir_1_s3_uri != source_dir_2_s3_uri + + # verify different entry_point paths + assert entry_point_1 != entry_point_2 + + execution = pipeline.start(parameters={}) + try: + execution.wait(delay=540, max_attempts=3) + except WaiterError: + pass + + execution_steps = execution.list_steps() + assert len(execution_steps) == 2 + for step in execution_steps: + assert step["StepStatus"] == "Succeeded" + + finally: + try: + pipeline.delete() + except Exception: + pass + + def test_one_step_pyspark_processing_pipeline( sagemaker_session, role, @@ -796,3 +996,46 @@ def test_two_processing_job_depends_on( pipeline.delete() except Exception: pass + + +def _verify_code_artifacts_of_framework_processing_step( + pipeline_session, processor, bucket, pipeline_name, step_definition, source_dir, entry_point +): + + source_dir_s3_uri = ( + f"s3://{bucket}/{pipeline_name}" f"/code/{hash_files_or_dirs([f'{DATA_DIR}/{source_dir}'])}" + ) + + # verify runproc.sh prefix is different from code artifact prefix + runprocs = [] + for input_obj in step_definition["Arguments"]["ProcessingInputs"]: + if input_obj["InputName"] == "entrypoint": + s3_uri = input_obj["S3Input"]["S3Uri"] + runprocs.append(s3_uri) + + assert Path(s3_uri).parent != source_dir_s3_uri + + # verify only one entrypoint generated per step + assert len(runprocs) == 1 + + expected_source_dir_tar = ( + f"{pipeline_name}" + f"/code/{hash_files_or_dirs([DATA_DIR + '/pipeline/test_source_dir'])}/sourcedir.tar.gz" + ) + + step_script = processor._generate_framework_script(entry_point) + expected_step_artifact = f"{pipeline_name}/code/{hash_object(step_script)}/runproc.sh" + + expected_prefix = f"{pipeline_name}/code" + s3_code_objects = pipeline_session.list_s3_files(bucket=bucket, key_prefix=expected_prefix) + + # verify all distinct artifacts were uploaded + assert expected_source_dir_tar in s3_code_objects + assert expected_step_artifact in s3_code_objects + + # verify runprocs contain the correct commands + step_runproc = S3Downloader.read_file( + f"s3://{bucket}/{expected_step_artifact}", pipeline_session + ) + assert f"python {entry_point}" in step_runproc + return source_dir, expected_step_artifact diff --git a/tests/integ/sagemaker/workflow/test_workflow.py b/tests/integ/sagemaker/workflow/test_workflow.py index 634ef752d6..44f4e2d26e 100644 --- a/tests/integ/sagemaker/workflow/test_workflow.py +++ b/tests/integ/sagemaker/workflow/test_workflow.py @@ -1168,7 +1168,13 @@ def walk(): def test_caching_behavior( - pipeline_session, role, cpu_instance_type, pipeline_name, script_dir, athena_dataset_definition + pipeline_session, + role, + cpu_instance_type, + pipeline_name, + script_dir, + athena_dataset_definition, + region_name, ): default_bucket = pipeline_session.default_bucket() data_path = os.path.join(DATA_DIR, "workflow") From 11d24754b0a8228893f6663ac1ca5048b8a6e794 Mon Sep 17 00:00:00 2001 From: ci Date: Thu, 8 Dec 2022 06:16:54 +0000 Subject: [PATCH 22/41] prepare release v2.121.0 --- CHANGELOG.md | 11 +++++++++++ VERSION | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71894ff29d..29dad5f19f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## v2.121.0 (2022-12-08) + +### Features + + * Algorithms Region Expansion OSU/DXB + +### Bug Fixes and Other Changes + + * FrameworkProcessor S3 uploads + * Add constraints file for apache-airflow + ## v2.120.0 (2022-12-07) ### Features diff --git a/VERSION b/VERSION index 73c4cd6968..7f1e14b5a9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.120.1.dev0 +2.121.0 From 24171b5efcb9c528f159334d6252835ef10bbcb2 Mon Sep 17 00:00:00 2001 From: ci Date: Thu, 8 Dec 2022 06:16:55 +0000 Subject: [PATCH 23/41] update development version to v2.121.1.dev0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7f1e14b5a9..28b52ee8d5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.121.0 +2.121.1.dev0 From d5847d5ebad840c5f47204742302d91064904be8 Mon Sep 17 00:00:00 2001 From: Loki Date: Fri, 9 Dec 2022 03:10:14 +0530 Subject: [PATCH 24/41] Fix: Differentiate SageMaker Training Compiler's PT DLCs from base PT DLC (#3515) --- src/sagemaker/image_uri_config/pytorch-training-compiler.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sagemaker/image_uri_config/pytorch-training-compiler.json b/src/sagemaker/image_uri_config/pytorch-training-compiler.json index 892ff4237d..fd7df875a3 100644 --- a/src/sagemaker/image_uri_config/pytorch-training-compiler.json +++ b/src/sagemaker/image_uri_config/pytorch-training-compiler.json @@ -34,7 +34,7 @@ "us-west-1": "763104351884", "us-west-2": "763104351884" }, - "repository": "pytorch-training" + "repository": "pytorch-trcomp-training" } } } From 3f6ea884a564090f826fab46270429db553c7b3b Mon Sep 17 00:00:00 2001 From: evakravi <69981223+evakravi@users.noreply.github.com> Date: Thu, 8 Dec 2022 17:17:44 -0500 Subject: [PATCH 25/41] fix: Fix failing jumpstart cache unit tests (#3514) --- setup.py | 2 +- src/sagemaker/jumpstart/cache.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 4327045760..f366b147b8 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ def read_requirements(filename): "protobuf3-to-dict>=0.1.5,<1.0", "smdebug_rulesconfig==1.0.1", "importlib-metadata>=1.4.0,<5.0", - "packaging>=20.0", + "packaging==20.9", "pandas", "pathos", "schema", diff --git a/src/sagemaker/jumpstart/cache.py b/src/sagemaker/jumpstart/cache.py index 202edff9ad..db607770a7 100644 --- a/src/sagemaker/jumpstart/cache.py +++ b/src/sagemaker/jumpstart/cache.py @@ -20,7 +20,7 @@ import boto3 import botocore from packaging.version import Version -from packaging.specifiers import SpecifierSet +from packaging.specifiers import SpecifierSet, InvalidSpecifier from sagemaker.jumpstart.constants import ( ENV_VARIABLE_JUMPSTART_MANIFEST_LOCAL_ROOT_DIR_OVERRIDE, ENV_VARIABLE_JUMPSTART_SPECS_LOCAL_ROOT_DIR_OVERRIDE, @@ -371,7 +371,10 @@ def _select_version( return None return str(max(available_versions)) - spec = SpecifierSet(f"=={semantic_version_str}") + try: + spec = SpecifierSet(f"=={semantic_version_str}") + except InvalidSpecifier: + raise KeyError(f"Bad semantic version: {semantic_version_str}") available_versions_filtered = list(spec.filter(available_versions)) return ( str(max(available_versions_filtered)) if available_versions_filtered != [] else None From 4570aa6078e75ba0d259f8196891b7856790a435 Mon Sep 17 00:00:00 2001 From: qidewenwhen <32910701+qidewenwhen@users.noreply.github.com> Date: Thu, 8 Dec 2022 19:00:48 -0800 Subject: [PATCH 26/41] fix: Pop out ModelPackageName from pipeline definition (#3472) Co-authored-by: Dewen Qi --- src/sagemaker/workflow/_utils.py | 12 ++ .../sagemaker/workflow/test_model_steps.py | 1 + tests/unit/sagemaker/workflow/conftest.py | 75 +++++++++ .../sagemaker/workflow/test_model_step.py | 147 +++++++----------- tests/unit/sagemaker/workflow/test_utils.py | 54 +------ 5 files changed, 150 insertions(+), 139 deletions(-) create mode 100644 tests/unit/sagemaker/workflow/conftest.py diff --git a/src/sagemaker/workflow/_utils.py b/src/sagemaker/workflow/_utils.py index 8ba65f1eee..cdef9537c1 100644 --- a/src/sagemaker/workflow/_utils.py +++ b/src/sagemaker/workflow/_utils.py @@ -13,6 +13,7 @@ """Scrapper utilities to support repacking of models.""" from __future__ import absolute_import +import logging import os import shutil import tarfile @@ -37,6 +38,8 @@ if TYPE_CHECKING: from sagemaker.workflow.step_collections import StepCollection +logger = logging.getLogger(__name__) + FRAMEWORK_VERSION = "0.23-1" INSTANCE_TYPE = "ml.m5.large" REPACK_SCRIPT = "_repack_model.py" @@ -479,10 +482,19 @@ def arguments(self) -> RequestType: request_dict = get_create_model_package_request(**model_package_args) # these are not available in the workflow service and will cause rejection + warn_msg_template = ( + "Popping out '%s' from the pipeline definition " + "since it will be overridden in pipeline execution time." + ) if "CertifyForMarketplace" in request_dict: request_dict.pop("CertifyForMarketplace") + logger.warning(warn_msg_template, "CertifyForMarketplace") if "Description" in request_dict: request_dict.pop("Description") + logger.warning(warn_msg_template, "Description") + if "ModelPackageName" in request_dict: + request_dict.pop("ModelPackageName") + logger.warning(warn_msg_template, "ModelPackageName") return request_dict diff --git a/tests/integ/sagemaker/workflow/test_model_steps.py b/tests/integ/sagemaker/workflow/test_model_steps.py index 31c518b100..f25723c440 100644 --- a/tests/integ/sagemaker/workflow/test_model_steps.py +++ b/tests/integ/sagemaker/workflow/test_model_steps.py @@ -112,6 +112,7 @@ def test_pytorch_training_model_registration_and_creation_without_custom_inferen inference_instances=["ml.m5.xlarge"], transform_instances=["ml.m5.xlarge"], description="test-description", + model_package_name="model-pkg-name-will-be-popped-out", ) step_model_regis = ModelStep( name="pytorch-register-model", diff --git a/tests/unit/sagemaker/workflow/conftest.py b/tests/unit/sagemaker/workflow/conftest.py new file mode 100644 index 0000000000..9ea3d0bcac --- /dev/null +++ b/tests/unit/sagemaker/workflow/conftest.py @@ -0,0 +1,75 @@ +# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. +from __future__ import absolute_import + +from unittest.mock import Mock, PropertyMock + +import pytest + +from sagemaker import Session +from sagemaker.workflow.pipeline_context import PipelineSession + +REGION = "us-west-2" +BUCKET = "my-bucket" +ROLE = "DummyRole" +IMAGE_URI = "fakeimage" + + +@pytest.fixture(scope="module") +def client(): + """Mock client. + + Considerations when appropriate: + + * utilize botocore.stub.Stubber + * separate runtime client from client + """ + client_mock = Mock() + client_mock._client_config.user_agent = ( + "Boto3/1.14.24 Python/3.8.5 Linux/5.4.0-42-generic Botocore/1.17.24 Resource" + ) + return client_mock + + +@pytest.fixture(scope="module") +def boto_session(client): + role_mock = Mock() + type(role_mock).arn = PropertyMock(return_value=ROLE) + + resource_mock = Mock() + resource_mock.Role.return_value = role_mock + + session_mock = Mock(region_name=REGION) + session_mock.resource.return_value = resource_mock + session_mock.client.return_value = client + + return session_mock + + +@pytest.fixture(scope="module") +def pipeline_session(boto_session, client): + return PipelineSession( + boto_session=boto_session, + sagemaker_client=client, + default_bucket=BUCKET, + ) + + +@pytest.fixture(scope="module") +def sagemaker_session(boto_session, client): + return Session( + boto_session=boto_session, + sagemaker_client=client, + sagemaker_runtime_client=client, + default_bucket=BUCKET, + ) diff --git a/tests/unit/sagemaker/workflow/test_model_step.py b/tests/unit/sagemaker/workflow/test_model_step.py index 080e70ca62..2216299d3b 100644 --- a/tests/unit/sagemaker/workflow/test_model_step.py +++ b/tests/unit/sagemaker/workflow/test_model_step.py @@ -15,7 +15,7 @@ import json import os -from mock import Mock, PropertyMock, patch +from mock import patch import pytest @@ -43,7 +43,6 @@ ) from sagemaker.workflow.parameters import ParameterString, ParameterInteger from sagemaker.workflow.pipeline import Pipeline, PipelineGraph -from sagemaker.workflow.pipeline_context import PipelineSession from sagemaker.workflow.retry import ( StepRetryPolicy, StepExceptionTypeEnum, @@ -55,11 +54,9 @@ from sagemaker.workflow.lambda_step import LambdaStep, LambdaOutput, LambdaOutputTypeEnum from tests.unit import DATA_DIR from tests.unit.sagemaker.workflow.helpers import CustomStep, ordered +from tests.unit.sagemaker.workflow.conftest import BUCKET, ROLE _IMAGE_URI = "fakeimage" -_REGION = "us-west-2" -_BUCKET = "my-bucket" -_ROLE = "DummyRole" _INSTANCE_TYPE = "ml.m4.xlarge" _SAGEMAKER_PROGRAM = SCRIPT_PARAM_NAME.upper() @@ -69,60 +66,10 @@ _XGBOOST_PATH = os.path.join(DATA_DIR, "xgboost_abalone") _TENSORFLOW_PATH = os.path.join(DATA_DIR, "tfs/tfs-test-entrypoint-and-dependencies") _REPACK_OUTPUT_KEY_PREFIX = "code-output" -_MODEL_CODE_LOCATION = f"s3://{_BUCKET}/{_REPACK_OUTPUT_KEY_PREFIX}" +_MODEL_CODE_LOCATION = f"s3://{BUCKET}/{_REPACK_OUTPUT_KEY_PREFIX}" _MODEL_CODE_LOCATION_TRAILING_SLASH = _MODEL_CODE_LOCATION + "/" -@pytest.fixture -def client(): - """Mock client. - - Considerations when appropriate: - - * utilize botocore.stub.Stubber - * separate runtime client from client - """ - client_mock = Mock() - client_mock._client_config.user_agent = ( - "Boto3/1.14.24 Python/3.8.5 Linux/5.4.0-42-generic Botocore/1.17.24 Resource" - ) - return client_mock - - -@pytest.fixture -def boto_session(client): - role_mock = Mock() - type(role_mock).arn = PropertyMock(return_value=_ROLE) - - resource_mock = Mock() - resource_mock.Role.return_value = role_mock - - session_mock = Mock(region_name=_REGION) - session_mock.resource.return_value = resource_mock - session_mock.client.return_value = client - - return session_mock - - -@pytest.fixture -def pipeline_session(boto_session, client): - return PipelineSession( - boto_session=boto_session, - sagemaker_client=client, - default_bucket=_BUCKET, - ) - - -@pytest.fixture -def sagemaker_session(boto_session, client): - return Session( - boto_session=boto_session, - sagemaker_client=client, - sagemaker_runtime_client=client, - default_bucket=_BUCKET, - ) - - @pytest.fixture def model_data_param(): return ParameterString(name="ModelData", default_value="s3://my-bucket/file") @@ -137,7 +84,7 @@ def model(pipeline_session, model_data_param): sagemaker_session=pipeline_session, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", source_dir=f"{DATA_DIR}", - role=_ROLE, + role=ROLE, ) @@ -322,13 +269,13 @@ def test_create_pipeline_model_with_runtime_repack(pipeline_session, model_data_ sparkml_model = SparkMLModel( name="MySparkMLModel", model_data=model_data_param, - role=_ROLE, + role=ROLE, sagemaker_session=pipeline_session, env={"SAGEMAKER_DEFAULT_INVOCATIONS_ACCEPT": "text/csv"}, ) # The model need to runtime repack ppl_model = PipelineModel( - models=[sparkml_model, model], role=_ROLE, sagemaker_session=pipeline_session + models=[sparkml_model, model], role=ROLE, sagemaker_session=pipeline_session ) step_args = ppl_model.create( instance_type="c4.4xlarge", @@ -417,7 +364,7 @@ def test_register_pipeline_model_with_runtime_repack(pipeline_session, model_dat # The model no need to runtime repack, since source_dir is missing sparkml_model = SparkMLModel( model_data=model_data_param, - role=_ROLE, + role=ROLE, sagemaker_session=pipeline_session, env={"SAGEMAKER_DEFAULT_INVOCATIONS_ACCEPT": "text/csv"}, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", @@ -429,11 +376,11 @@ def test_register_pipeline_model_with_runtime_repack(pipeline_session, model_dat sagemaker_session=pipeline_session, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", source_dir=f"{DATA_DIR}", - role=_ROLE, + role=ROLE, env={"k": "v"}, ) model = PipelineModel( - models=[sparkml_model, model], role=_ROLE, sagemaker_session=pipeline_session + models=[sparkml_model, model], role=ROLE, sagemaker_session=pipeline_session ) step_args = model.register( content_types=["text/csv"], @@ -516,7 +463,7 @@ def test_register_model_without_repack(pipeline_session): model_data=model_data, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", sagemaker_session=pipeline_session, - role=_ROLE, + role=ROLE, ) step_args = model.register( content_types=["text/csv"], @@ -547,7 +494,7 @@ def test_register_model_without_repack(pipeline_session): assert containers[0]["Environment"][_SAGEMAKER_PROGRAM] == _SCRIPT_NAME assert ( containers[0]["Environment"][_SAGEMAKER_SUBMIT_DIRECTORY] - == f"s3://{_BUCKET}/{model_name}/sourcedir.tar.gz" + == f"s3://{BUCKET}/{model_name}/sourcedir.tar.gz" ) adjacency_list = PipelineGraph.from_pipeline(pipeline).adjacency_list assert ordered(adjacency_list) == ordered({"MyModelStep-RegisterModel": []}) @@ -560,11 +507,11 @@ def test_create_model_with_compile_time_repack(mock_repack, pipeline_session): model = Model( name=model_name, image_uri=_IMAGE_URI, - model_data=f"s3://{_BUCKET}/model.tar.gz", + model_data=f"s3://{BUCKET}/model.tar.gz", sagemaker_session=pipeline_session, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", source_dir=f"{DATA_DIR}", - role=_ROLE, + role=ROLE, ) step_args = model.create( instance_type="c4.4xlarge", @@ -582,7 +529,7 @@ def test_create_model_with_compile_time_repack(mock_repack, pipeline_session): arguments = step_dsl_list[0]["Arguments"] assert arguments["PrimaryContainer"]["Image"] == _IMAGE_URI assert ( - arguments["PrimaryContainer"]["ModelDataUrl"] == f"s3://{_BUCKET}/{model_name}/model.tar.gz" + arguments["PrimaryContainer"]["ModelDataUrl"] == f"s3://{BUCKET}/{model_name}/model.tar.gz" ) assert arguments["PrimaryContainer"]["Environment"][_SAGEMAKER_PROGRAM] == _SCRIPT_NAME assert arguments["PrimaryContainer"]["Environment"][_SAGEMAKER_SUBMIT_DIRECTORY] == _DIR_NAME @@ -700,7 +647,7 @@ def test_conditional_model_create_and_regis( model_data="dummy_model_data", image_uri=_IMAGE_URI, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", - role=_ROLE, + role=ROLE, enable_network_isolation=True, code_location=_MODEL_CODE_LOCATION_TRAILING_SLASH, ), @@ -713,7 +660,7 @@ def test_conditional_model_create_and_regis( framework_version="1.11.0", image_uri=_IMAGE_URI, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", - role=_ROLE, + role=ROLE, enable_network_isolation=False, ), 1, @@ -724,7 +671,7 @@ def test_conditional_model_create_and_regis( model_data="dummy_model_data", image_uri=_IMAGE_URI, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", - role=_ROLE, + role=ROLE, framework_version="1.5.0", code_location=_MODEL_CODE_LOCATION_TRAILING_SLASH, ), @@ -736,7 +683,7 @@ def test_conditional_model_create_and_regis( model_data="dummy_model_data", image_uri=_IMAGE_URI, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", - role=_ROLE, + role=ROLE, framework_version="1.2.0", ), 1, @@ -747,7 +694,7 @@ def test_conditional_model_create_and_regis( model_data="dummy_model_data", image_uri=_IMAGE_URI, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", - role=_ROLE, + role=ROLE, ), 2, ), @@ -757,7 +704,7 @@ def test_conditional_model_create_and_regis( model_data="dummy_model_data", image_uri=_IMAGE_URI, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", - role=_ROLE, + role=ROLE, code_location=_MODEL_CODE_LOCATION_TRAILING_SLASH, ), 2, @@ -768,7 +715,7 @@ def test_conditional_model_create_and_regis( model_data="dummy_model_data", image_uri=_IMAGE_URI, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", - role=_ROLE, + role=ROLE, ), 1, ), @@ -789,7 +736,7 @@ def assert_test_result(steps: list): ) else: assert steps[0]["Arguments"]["OutputDataConfig"]["S3OutputPath"] == ( - f"s3://{_BUCKET}/{model.name}" + f"s3://{BUCKET}/{model.name}" ) model, expected_step_num = test_input @@ -828,7 +775,7 @@ def assert_test_result(steps: list): XGBoostModel( model_data="dummy_model_step", framework_version="1.3-1", - role=_ROLE, + role=ROLE, entry_point=os.path.join(_XGBOOST_PATH, "inference.py"), enable_network_isolation=True, ), @@ -845,7 +792,7 @@ def assert_test_result(steps: list): XGBoostModel( model_data="dummy_model_step", framework_version="1.3-1", - role=_ROLE, + role=ROLE, entry_point=os.path.join(_XGBOOST_PATH, "inference.py"), ), { @@ -861,7 +808,7 @@ def assert_test_result(steps: list): XGBoostModel( model_data="dummy_model_step", framework_version="1.3-1", - role=_ROLE, + role=ROLE, entry_point=None, ), { @@ -876,9 +823,8 @@ def assert_test_result(steps: list): ( TensorFlowModel( model_data="dummy_model_step", - role=_ROLE, + role=ROLE, image_uri=_IMAGE_URI, - sagemaker_session=pipeline_session, entry_point=os.path.join(_TENSORFLOW_PATH, "inference.py"), ), { @@ -893,9 +839,8 @@ def assert_test_result(steps: list): ( TensorFlowModel( model_data="dummy_model_step", - role=_ROLE, + role=ROLE, image_uri=_IMAGE_URI, - sagemaker_session=pipeline_session, ), { "expected_step_num": 1, @@ -941,7 +886,7 @@ def test_request_compare_of_register_model_under_different_sessions( _verify_register_model_container_definition(regis_step_arg, expect, dict) # Get create model package request under Session - model.model_data = f"s3://{_BUCKET}" + model.model_data = f"s3://{BUCKET}" model.sagemaker_session = sagemaker_session with patch.object( Session, "_intercept_create_request", return_value=dict(ModelPackageArn="arn:aws") @@ -996,7 +941,7 @@ def test_model_step_with_lambda_property_reference(pipeline_session): model_data=lambda_step.properties.Outputs["model_artifact"], sagemaker_session=pipeline_session, entry_point=f"{DATA_DIR}/{_SCRIPT_NAME}", - role=_ROLE, + role=ROLE, ) step_create_model = ModelStep(name="mymodelstep", step_args=model.create()) @@ -1031,7 +976,7 @@ def test_model_step_with_lambda_property_reference(pipeline_session): ( Processor( image_uri=_IMAGE_URI, - role=_ROLE, + role=ROLE, instance_count=1, instance_type=_INSTANCE_TYPE, ), @@ -1052,7 +997,7 @@ def test_model_step_with_lambda_property_reference(pipeline_session): ( HyperparameterTuner( estimator=Estimator( - role=_ROLE, + role=ROLE, instance_count=1, instance_type=_INSTANCE_TYPE, image_uri=_IMAGE_URI, @@ -1064,7 +1009,7 @@ def test_model_step_with_lambda_property_reference(pipeline_session): ), ( Estimator( - role=_ROLE, + role=ROLE, instance_count=1, instance_type=_INSTANCE_TYPE, image_uri=_IMAGE_URI, @@ -1128,3 +1073,31 @@ def test_pass_in_wrong_type_of_retry_policies(pipeline_session, model): ), ) assert "SageMakerJobStepRetryPolicy is not allowed for a create/registe" in str(error.value) + + +def test_register_model_step_with_model_package_name(pipeline_session): + model = Model( + name="MyModel", + image_uri="my-image", + model_data="s3://", + sagemaker_session=pipeline_session, + ) + step_args = model.register( + content_types=["text/csv"], + response_types=["text/csv"], + inference_instances=["ml.t2.medium", "ml.m5.xlarge"], + transform_instances=["ml.m5.xlarge"], + model_package_name="model-pkg-name-will-be-popped-out", + ) + regis_model_step = ModelStep( + name="MyModelStep", + step_args=step_args, + ) + pipeline = Pipeline( + name="MyPipeline", + steps=[regis_model_step], + sagemaker_session=pipeline_session, + ) + steps = json.loads(pipeline.definition())["Steps"] + assert len(steps) == 1 + assert "ModelPackageName" not in steps[0]["Arguments"] diff --git a/tests/unit/sagemaker/workflow/test_utils.py b/tests/unit/sagemaker/workflow/test_utils.py index dcbf5a6421..c8d86c5866 100644 --- a/tests/unit/sagemaker/workflow/test_utils.py +++ b/tests/unit/sagemaker/workflow/test_utils.py @@ -18,12 +18,6 @@ import tempfile import pytest -import sagemaker - -from mock import ( - Mock, - PropertyMock, -) from sagemaker.estimator import Estimator from sagemaker.workflow._utils import ( @@ -35,51 +29,7 @@ from sagemaker.workflow.properties import Properties from tests.unit.test_utils import FakeS3, list_tar_files from tests.unit import DATA_DIR - -REGION = "us-west-2" -BUCKET = "my-bucket" -IMAGE_URI = "fakeimage" -ROLE = "DummyRole" - - -@pytest.fixture -def boto_session(): - role_mock = Mock() - type(role_mock).arn = PropertyMock(return_value=ROLE) - - resource_mock = Mock() - resource_mock.Role.return_value = role_mock - - session_mock = Mock(region_name=REGION) - session_mock.resource.return_value = resource_mock - - return session_mock - - -@pytest.fixture -def client(): - """Mock client. - - Considerations when appropriate: - - * utilize botocore.stub.Stubber - * separate runtime client from client - """ - client_mock = Mock() - client_mock._client_config.user_agent = ( - "Boto3/1.14.24 Python/3.8.5 Linux/5.4.0-42-generic Botocore/1.17.24 Resource" - ) - return client_mock - - -@pytest.fixture -def sagemaker_session(boto_session, client): - return sagemaker.session.Session( - boto_session=boto_session, - sagemaker_client=client, - sagemaker_runtime_client=client, - default_bucket=BUCKET, - ) +from tests.unit.sagemaker.workflow.conftest import ROLE, IMAGE_URI, BUCKET @pytest.fixture @@ -171,7 +121,7 @@ def test_repack_model_step(estimator): } -def test_repack_model_step_with_invalid_input(): +def test_register_model_step_with_invalid_input(): # without both step_args and any of the old required arguments with pytest.raises(ValueError) as error: _RegisterModelStep( From 959ea1a485db702f361ddebda2e80779bfd20e43 Mon Sep 17 00:00:00 2001 From: ci Date: Fri, 9 Dec 2022 06:20:46 +0000 Subject: [PATCH 27/41] prepare release v2.121.1 --- CHANGELOG.md | 7 +++++++ VERSION | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29dad5f19f..472a25feb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v2.121.1 (2022-12-09) + +### Bug Fixes and Other Changes + + * Pop out ModelPackageName from pipeline definition + * Fix failing jumpstart cache unit tests + ## v2.121.0 (2022-12-08) ### Features diff --git a/VERSION b/VERSION index 28b52ee8d5..f73c7f057e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.121.1.dev0 +2.121.1 From b2e8b66016c09a3898123725bf1c01d1a87b05d0 Mon Sep 17 00:00:00 2001 From: ci Date: Fri, 9 Dec 2022 06:20:47 +0000 Subject: [PATCH 28/41] update development version to v2.121.2.dev0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f73c7f057e..d866b235cc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.121.1 +2.121.2.dev0 From 355975d4d2d45088eeb13681f8d99e48a00909c9 Mon Sep 17 00:00:00 2001 From: amzn-choeric <105388439+amzn-choeric@users.noreply.github.com> Date: Fri, 9 Dec 2022 13:53:28 -0500 Subject: [PATCH 29/41] fix: Skip Bad Transform Test (#3521) --- tests/integ/test_inference_pipeline.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/integ/test_inference_pipeline.py b/tests/integ/test_inference_pipeline.py index 53d966fe9b..a26d8c9101 100644 --- a/tests/integ/test_inference_pipeline.py +++ b/tests/integ/test_inference_pipeline.py @@ -50,6 +50,7 @@ ) +@pytest.mark.skip(reason="Test has likely been failing for a while. Suspected bad XGB model.") def test_inference_pipeline_batch_transform(sagemaker_session, cpu_instance_type): sparkml_model_data = sagemaker_session.upload_data( path=os.path.join(SPARKML_DATA_PATH, "mleap_model.tar.gz"), From fadc817c7557f5fea5e414d51b500a6b7cd02065 Mon Sep 17 00:00:00 2001 From: Mufaddal Rohawala <89424143+mufaddal-rohawala@users.noreply.github.com> Date: Fri, 9 Dec 2022 12:07:32 -0800 Subject: [PATCH 30/41] fix: Revert "fix: type hint of PySparkProcessor __init__" (#3524) From c5fc93feea798df1713db6707737a2f24738c4c7 Mon Sep 17 00:00:00 2001 From: hballuru <113142824+hballuru@users.noreply.github.com> Date: Fri, 9 Dec 2022 16:36:12 -0600 Subject: [PATCH 31/41] change: Update for Tensorflow Serving 2.11 inference DLCs (#3509) --- .../image_uri_config/tensorflow.json | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/sagemaker/image_uri_config/tensorflow.json b/src/sagemaker/image_uri_config/tensorflow.json index a0f2bba014..aaca927ba4 100644 --- a/src/sagemaker/image_uri_config/tensorflow.json +++ b/src/sagemaker/image_uri_config/tensorflow.json @@ -303,7 +303,8 @@ "2.7": "2.7.0", "2.8": "2.8.0", "2.9": "2.9.2", - "2.10": "2.10.0" + "2.10": "2.10.0", + "2.11": "2.11.0" }, "versions": { "1.10.0": { @@ -1611,6 +1612,7 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1618,8 +1620,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", @@ -1642,6 +1646,41 @@ "ap-northeast-2": "763104351884", "ap-northeast-3": "364406365360", "ap-south-1": "763104351884", + "ap-south-2": "772153158452", + "ap-southeast-1": "763104351884", + "ap-southeast-2": "763104351884", + "ap-southeast-3": "907027046896", + "ca-central-1": "763104351884", + "cn-north-1": "727897471807", + "cn-northwest-1": "727897471807", + "eu-central-1": "763104351884", + "eu-central-2": "380420809688", + "eu-north-1": "763104351884", + "eu-south-1": "692866216735", + "eu-south-2": "503227376785", + "eu-west-1": "763104351884", + "eu-west-2": "763104351884", + "eu-west-3": "763104351884", + "me-south-1": "217643126080", + "sa-east-1": "763104351884", + "us-east-1": "763104351884", + "us-east-2": "763104351884", + "us-gov-west-1": "442386744353", + "us-iso-east-1": "886529160074", + "us-west-1": "763104351884", + "us-west-2": "763104351884" + }, + "repository": "tensorflow-inference" + }, + "2.11.0": { + "registries": { + "af-south-1": "626614931356", + "ap-east-1": "871362719292", + "ap-northeast-1": "763104351884", + "ap-northeast-2": "763104351884", + "ap-northeast-3": "364406365360", + "ap-south-1": "763104351884", + "ap-south-2": "772153158452", "ap-southeast-1": "763104351884", "ap-southeast-2": "763104351884", "ap-southeast-3": "907027046896", @@ -1649,8 +1688,10 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", + "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-south-1": "692866216735", + "eu-south-2": "503227376785", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", From ec8da98a9a7cae848e8bf1af06bdaaabd1ebb382 Mon Sep 17 00:00:00 2001 From: ci Date: Mon, 12 Dec 2022 18:18:58 +0000 Subject: [PATCH 32/41] prepare release v2.121.2 --- CHANGELOG.md | 8 ++++++++ VERSION | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 472a25feb8..8b66e85f54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## v2.121.2 (2022-12-12) + +### Bug Fixes and Other Changes + + * Update for Tensorflow Serving 2.11 inference DLCs + * Revert "fix: type hint of PySparkProcessor __init__" + * Skip Bad Transform Test + ## v2.121.1 (2022-12-09) ### Bug Fixes and Other Changes diff --git a/VERSION b/VERSION index d866b235cc..3b02379cd3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.121.2.dev0 +2.121.2 From 03521222d324ed752174038309828ed8183c5aea Mon Sep 17 00:00:00 2001 From: ci Date: Mon, 12 Dec 2022 18:19:00 +0000 Subject: [PATCH 33/41] update development version to v2.121.3.dev0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 3b02379cd3..8fde5e282f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.121.2 +2.121.3.dev0 From d6c021404586d4df601a6115add87fcbf75b6d65 Mon Sep 17 00:00:00 2001 From: Kristopher Siman Date: Mon, 12 Dec 2022 17:21:49 -0500 Subject: [PATCH 34/41] feature: Add OSU region to frameworks for DLC (#3532) --- src/sagemaker/image_uri_config/autogluon.json | 12 ++++ .../image_uri_config/huggingface-neuron.json | 1 + .../image_uri_config/huggingface.json | 31 ++++++++ src/sagemaker/image_uri_config/mxnet.json | 13 ++++ .../image_uri_config/pytorch-neuron.json | 1 + src/sagemaker/image_uri_config/pytorch.json | 31 ++++++++ .../image_uri_config/tensorflow.json | 70 +++++++++++++++++++ 7 files changed, 159 insertions(+) diff --git a/src/sagemaker/image_uri_config/autogluon.json b/src/sagemaker/image_uri_config/autogluon.json index 3a9f02142c..590b6e5f82 100644 --- a/src/sagemaker/image_uri_config/autogluon.json +++ b/src/sagemaker/image_uri_config/autogluon.json @@ -30,6 +30,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -61,6 +62,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -92,6 +94,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -123,6 +126,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -154,6 +158,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -185,6 +190,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -230,6 +236,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -267,6 +274,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -304,6 +312,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -341,6 +350,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -378,6 +388,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -415,6 +426,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/huggingface-neuron.json b/src/sagemaker/image_uri_config/huggingface-neuron.json index 47d6dbd1dc..980dceed17 100644 --- a/src/sagemaker/image_uri_config/huggingface-neuron.json +++ b/src/sagemaker/image_uri_config/huggingface-neuron.json @@ -33,6 +33,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/huggingface.json b/src/sagemaker/image_uri_config/huggingface.json index 5b98fc0d02..a0caa59a55 100644 --- a/src/sagemaker/image_uri_config/huggingface.json +++ b/src/sagemaker/image_uri_config/huggingface.json @@ -42,6 +42,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -75,6 +76,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -114,6 +116,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -147,6 +150,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -188,6 +192,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -222,6 +227,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -256,6 +262,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -290,6 +297,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -332,6 +340,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -366,6 +375,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -400,6 +410,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -434,6 +445,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -474,6 +486,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -508,6 +521,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -548,6 +562,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -582,6 +597,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -622,6 +638,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -656,6 +673,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -712,6 +730,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -749,6 +768,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -786,6 +806,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -831,6 +852,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -868,6 +890,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -905,6 +928,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -942,6 +966,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -985,6 +1010,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1022,6 +1048,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1065,6 +1092,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1102,6 +1130,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1145,6 +1174,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1182,6 +1212,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/mxnet.json b/src/sagemaker/image_uri_config/mxnet.json index 8d8733e480..588a03a76e 100644 --- a/src/sagemaker/image_uri_config/mxnet.json +++ b/src/sagemaker/image_uri_config/mxnet.json @@ -249,6 +249,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -282,6 +283,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -315,6 +317,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -348,6 +351,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -381,6 +385,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -644,6 +649,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -680,6 +686,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -716,6 +723,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -752,6 +760,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -788,6 +797,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -897,6 +907,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -933,6 +944,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -969,6 +981,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/pytorch-neuron.json b/src/sagemaker/image_uri_config/pytorch-neuron.json index b116a8a36b..5b29406955 100644 --- a/src/sagemaker/image_uri_config/pytorch-neuron.json +++ b/src/sagemaker/image_uri_config/pytorch-neuron.json @@ -28,6 +28,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/pytorch.json b/src/sagemaker/image_uri_config/pytorch.json index 18a382e591..85681a3423 100644 --- a/src/sagemaker/image_uri_config/pytorch.json +++ b/src/sagemaker/image_uri_config/pytorch.json @@ -208,6 +208,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -247,6 +248,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -285,6 +287,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -323,6 +326,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -362,6 +366,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -401,6 +406,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -440,6 +446,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -479,6 +486,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -517,6 +525,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -555,6 +564,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -593,6 +603,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -631,6 +642,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -669,6 +681,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -707,6 +720,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -744,6 +758,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -791,6 +806,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -951,6 +967,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -987,6 +1004,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1023,6 +1041,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1058,6 +1077,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1094,6 +1114,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1130,6 +1151,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1166,6 +1188,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1202,6 +1225,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1237,6 +1261,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1272,6 +1297,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1307,6 +1333,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1342,6 +1369,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1377,6 +1405,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1412,6 +1441,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1446,6 +1476,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", diff --git a/src/sagemaker/image_uri_config/tensorflow.json b/src/sagemaker/image_uri_config/tensorflow.json index aaca927ba4..a900aa4fe5 100644 --- a/src/sagemaker/image_uri_config/tensorflow.json +++ b/src/sagemaker/image_uri_config/tensorflow.json @@ -161,6 +161,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -196,6 +197,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -231,6 +233,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -266,6 +269,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -425,6 +429,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -460,6 +465,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -495,6 +501,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -530,6 +537,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -565,6 +573,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -600,6 +609,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -635,6 +645,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -862,6 +873,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -897,6 +909,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -932,6 +945,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -967,6 +981,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1002,6 +1017,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1037,6 +1053,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1072,6 +1089,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1107,6 +1125,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1142,6 +1161,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1177,6 +1197,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1212,6 +1233,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1247,6 +1269,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1282,6 +1305,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1317,6 +1341,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1352,6 +1377,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1387,6 +1413,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1422,6 +1449,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1457,6 +1485,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1492,6 +1521,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1527,6 +1557,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1562,6 +1593,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1597,6 +1629,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1631,6 +1664,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1665,6 +1699,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1699,6 +1734,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1746,6 +1782,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1940,6 +1977,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -1977,6 +2015,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2013,6 +2052,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2050,6 +2090,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2087,6 +2128,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2124,6 +2166,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2161,6 +2204,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2389,6 +2433,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2425,6 +2470,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2461,6 +2507,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2496,6 +2543,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2531,6 +2579,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2567,6 +2616,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2603,6 +2653,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2638,6 +2689,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2673,6 +2725,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2708,6 +2761,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2743,6 +2797,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2778,6 +2833,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2813,6 +2869,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2848,6 +2905,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2883,6 +2941,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2918,6 +2977,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2953,6 +3013,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -2988,6 +3049,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -3023,6 +3085,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -3058,6 +3121,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -3093,6 +3157,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -3128,6 +3193,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -3163,6 +3229,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -3198,6 +3265,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -3233,6 +3301,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", @@ -3267,6 +3336,7 @@ "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", + "us-gov-east-1": "446045086412", "us-gov-west-1": "442386744353", "us-iso-east-1": "886529160074", "us-west-1": "763104351884", From 5af4feb57d950358dcf5dd15aad7f7d59ae11b31 Mon Sep 17 00:00:00 2001 From: Xiaoguang Chen <68292680+xgchena@users.noreply.github.com> Date: Mon, 12 Dec 2022 15:59:33 -0800 Subject: [PATCH 35/41] fix: Remove content type image/jpg from analysis configuration schema (#3530) Currently the analysis configuration schema of SageMaker Clarify API allows the content_type configuration "image/jpeg" and "image/jpg", but the service side validation only accepts the former which is the registered MIME type for JPEG (see rfc3745 and JPEG specification). The commit removes the latter from the schema to avoid confusion and enable early API validation. --- src/sagemaker/clarify.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sagemaker/clarify.py b/src/sagemaker/clarify.py index 4765630ce8..f082679401 100644 --- a/src/sagemaker/clarify.py +++ b/src/sagemaker/clarify.py @@ -282,7 +282,6 @@ "text/csv", "application/jsonlines", "image/jpeg", - "image/jpg", "image/png", "application/x-npy", ), From 438984754a8f44b34d70154197a3bbeb0272f052 Mon Sep 17 00:00:00 2001 From: Clayton Parnell <42805768+claytonparnell@users.noreply.github.com> Date: Mon, 12 Dec 2022 22:37:35 -0500 Subject: [PATCH 36/41] fix: unpin packaging version (#3533) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f366b147b8..4327045760 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ def read_requirements(filename): "protobuf3-to-dict>=0.1.5,<1.0", "smdebug_rulesconfig==1.0.1", "importlib-metadata>=1.4.0,<5.0", - "packaging==20.9", + "packaging>=20.0", "pandas", "pathos", "schema", From ef0c3e0d4bad1328fea97b4a0200b65bdce1d3ea Mon Sep 17 00:00:00 2001 From: Evan Kravitz Date: Tue, 13 Dec 2022 15:50:01 +0000 Subject: [PATCH 37/41] feat: local download dir for Model and Estimator classes --- src/sagemaker/estimator.py | 5 +++ src/sagemaker/fw_utils.py | 11 ++++++- src/sagemaker/model.py | 7 ++++- src/sagemaker/utils.py | 16 +++++++--- tests/unit/sagemaker/model/test_model.py | 19 ++++++++++++ tests/unit/test_estimator.py | 39 ++++++++++++++++++++++++ tests/unit/test_mxnet.py | 1 + tests/unit/test_pytorch.py | 1 + 8 files changed, 93 insertions(+), 6 deletions(-) diff --git a/src/sagemaker/estimator.py b/src/sagemaker/estimator.py index 6f729267de..6b5de0dac9 100644 --- a/src/sagemaker/estimator.py +++ b/src/sagemaker/estimator.py @@ -154,6 +154,7 @@ def __init__( entry_point: Optional[Union[str, PipelineVariable]] = None, dependencies: Optional[List[Union[str]]] = None, instance_groups: Optional[List[InstanceGroup]] = None, + local_download_dir: Optional[str] = None, **kwargs, ): """Initialize an ``EstimatorBase`` instance. @@ -488,6 +489,8 @@ def __init__( `Train Using a Heterogeneous Cluster `_ in the *Amazon SageMaker developer guide*. + local_download_dir (str): Optional. A path specifying the local directory + for artifacts downloaded. (Default: None). """ instance_count = renamed_kwargs( "train_instance_count", "instance_count", instance_count, kwargs @@ -592,6 +595,7 @@ def __init__( self.environment = environment self.max_retry_attempts = max_retry_attempts + self.local_download_dir = local_download_dir if not _region_supports_profiler( self.sagemaker_session.boto_region_name @@ -819,6 +823,7 @@ def _stage_user_code_in_s3(self) -> str: kms_key=kms_key, s3_resource=self.sagemaker_session.s3_resource, settings=self.sagemaker_session.settings, + local_download_dir=self.local_download_dir, ) def _assign_s3_prefix(self, key_prefix=""): diff --git a/src/sagemaker/fw_utils.py b/src/sagemaker/fw_utils.py index 5efe530396..7893ad4055 100644 --- a/src/sagemaker/fw_utils.py +++ b/src/sagemaker/fw_utils.py @@ -378,6 +378,7 @@ def tar_and_upload_dir( kms_key=None, s3_resource=None, settings: Optional[SessionSettings] = None, + local_download_dir: Optional[str] = None, ): """Package source files and upload a compress tar file to S3. @@ -408,6 +409,8 @@ def tar_and_upload_dir( settings (sagemaker.session_settings.SessionSettings): Optional. The settings of the SageMaker ``Session``, can be used to override the default encryption behavior (default: None). + local_download_dir (str): Optional. A path specifying the local directory + for artifacts downloaded. (Default: None). Returns: sagemaker.fw_utils.UserCode: An object with the S3 bucket and key (S3 prefix) and script name. @@ -418,7 +421,13 @@ def tar_and_upload_dir( script_name = script if directory else os.path.basename(script) dependencies = dependencies or [] key = "%s/sourcedir.tar.gz" % s3_key_prefix - tmp = tempfile.mkdtemp() + if local_download_dir is not None and not ( + os.path.exists(local_download_dir) and os.path.isdir(local_download_dir) + ): + raise ValueError( + f"Inputted directory for storing newly generated temporary directory does not exist: '{local_download_dir}'" + ) + tmp = tempfile.mkdtemp(dir=local_download_dir) encrypt_artifact = True if settings is None else settings.encrypt_repacked_artifacts try: diff --git a/src/sagemaker/model.py b/src/sagemaker/model.py index e04b83a14f..0e0d3ce6bf 100644 --- a/src/sagemaker/model.py +++ b/src/sagemaker/model.py @@ -105,6 +105,7 @@ def __init__( container_log_level: Union[int, PipelineVariable] = logging.INFO, dependencies: Optional[List[str]] = None, git_config: Optional[Dict[str, str]] = None, + local_download_dir: Optional[str] = None, ): """Initialize an SageMaker ``Model``. @@ -264,7 +265,8 @@ def __init__( authentication if they are provided. If they are not provided, the SageMaker Python SDK attempts to use either the CodeCommit credential helper or local credential storage for authentication. - + local_download_dir (str): Optional. A path specifying the local directory + for downloading artifacts. (Default: None). """ self.model_data = model_data self.image_uri = image_uri @@ -287,6 +289,7 @@ def __init__( self.dependencies = dependencies or [] self.git_config = git_config self.container_log_level = container_log_level + self.local_download_dir = local_download_dir if code_location: self.bucket, self.key_prefix = s3.parse_s3_url(code_location) else: @@ -551,6 +554,7 @@ def _upload_code(self, key_prefix: str, repack: bool = False) -> None: directory=self.source_dir, dependencies=self.dependencies, settings=self.sagemaker_session.settings, + local_download_dir=self.local_download_dir, ) if repack and self.model_data is not None and self.entry_point is not None: @@ -595,6 +599,7 @@ def _upload_code(self, key_prefix: str, repack: bool = False) -> None: repacked_model_uri=repacked_model_data, sagemaker_session=self.sagemaker_session, kms_key=self.model_kms_key, + local_download_dir=self.local_download_dir, ) self.repacked_model_data = repacked_model_data diff --git a/src/sagemaker/utils.py b/src/sagemaker/utils.py index e668b2a8ed..4ea11f0aab 100644 --- a/src/sagemaker/utils.py +++ b/src/sagemaker/utils.py @@ -357,7 +357,7 @@ def create_tar_file(source_files, target=None): @contextlib.contextmanager -def _tmpdir(suffix="", prefix="tmp"): +def _tmpdir(suffix="", prefix="tmp", dir=None): """Create a temporary directory with a context manager. The file is deleted when the context exits. @@ -368,11 +368,17 @@ def _tmpdir(suffix="", prefix="tmp"): suffix, otherwise there will be no suffix. prefix (str): If prefix is specified, the file name will begin with that prefix; otherwise, a default prefix is used. + dir (str): If a directory is specified, the file will be downloaded in + this directory; otherwise, a default directory is used. Returns: str: path to the directory """ - tmp = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=None) + if dir is not None and not (os.path.exists(dir) and os.path.isdir(dir)): + raise ValueError( + f"Inputted directory for storing newly generated temporary directory does not exist: '{dir}'" + ) + tmp = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=dir) yield tmp shutil.rmtree(tmp) @@ -385,6 +391,7 @@ def repack_model( repacked_model_uri, sagemaker_session, kms_key=None, + local_download_dir=None, ): """Unpack model tarball and creates a new model tarball with the provided code script. @@ -420,13 +427,14 @@ def repack_model( sagemaker_session (sagemaker.session.Session): a sagemaker session to interact with S3. kms_key (str): KMS key ARN for encrypting the repacked model file - + local_download_dir (str): Optional. A path specifying the local directory + for downloading artifacts. (Default: None). Returns: str: path to the new packed model """ dependencies = dependencies or [] - with _tmpdir() as tmp: + with _tmpdir(dir=local_download_dir) as tmp: model_dir = _extract_model(model_uri, sagemaker_session, tmp) _create_or_update_code_dir( diff --git a/tests/unit/sagemaker/model/test_model.py b/tests/unit/sagemaker/model/test_model.py index 0b04d3c8bc..0c247c9979 100644 --- a/tests/unit/sagemaker/model/test_model.py +++ b/tests/unit/sagemaker/model/test_model.py @@ -776,3 +776,22 @@ def test_register_calls_model_package_args(get_model_package_args, sagemaker_ses == get_model_package_args.call_args_list[0][1]["validation_specification"] ), """ValidationSpecification from model.register method is not identical to validation_spec from get_model_package_args""" + + +@patch("sagemaker.utils.repack_model") +def test_model_local_download_dir(repack_model, sagemaker_session): + + source_dir = "s3://blah/blah/blah" + local_download_dir = "local download dir" + t = Model( + entry_point=ENTRY_POINT_INFERENCE, + role=ROLE, + sagemaker_session=sagemaker_session, + source_dir=source_dir, + image_uri=IMAGE_URI, + model_data=MODEL_DATA, + local_download_dir=local_download_dir, + ) + t.deploy(instance_type=INSTANCE_TYPE, initial_instance_count=INSTANCE_COUNT) + + assert repack_model.call_args_list[0][1].get("local_download_dir") == local_download_dir diff --git a/tests/unit/test_estimator.py b/tests/unit/test_estimator.py index 34e6a43fcf..2f1ca404fd 100644 --- a/tests/unit/test_estimator.py +++ b/tests/unit/test_estimator.py @@ -4545,3 +4545,42 @@ def test_script_mode_estimator_escapes_hyperparameters_as_json( - set(sagemaker_session.train.call_args_list[0][1]["hyperparameters"].items()) == set() ) + + +@patch("time.time", return_value=TIME) +@patch("sagemaker.estimator.tar_and_upload_dir") +@patch("sagemaker.model.Model._upload_code") +def test_estimator_local_download_dir( + patched_upload_code, patched_tar_and_upload_dir, sagemaker_session +): + patched_tar_and_upload_dir.return_value = UploadedCode( + s3_prefix="s3://%s/%s" % ("bucket", "key"), script_name="script_name" + ) + sagemaker_session.boto_region_name = REGION + + instance_type = "ml.p2.xlarge" + instance_count = 1 + + training_data_uri = "s3://bucket/mydata" + + jumpstart_source_dir = f"s3://{list(JUMPSTART_BUCKET_NAME_SET)[0]}/source_dirs/source.tar.gz" + + local_download_dir = "some/download/dir" + generic_estimator = Estimator( + entry_point=SCRIPT_PATH, + role=ROLE, + region=REGION, + sagemaker_session=sagemaker_session, + instance_count=instance_count, + instance_type=instance_type, + source_dir=jumpstart_source_dir, + image_uri=IMAGE_URI, + model_uri=MODEL_DATA, + local_download_dir=local_download_dir, + ) + generic_estimator.fit(training_data_uri) + + assert ( + patched_tar_and_upload_dir.call_args_list[0][1].get("local_download_dir") + == local_download_dir + ) diff --git a/tests/unit/test_mxnet.py b/tests/unit/test_mxnet.py index 99b0e839b7..5860b2ca46 100644 --- a/tests/unit/test_mxnet.py +++ b/tests/unit/test_mxnet.py @@ -693,6 +693,7 @@ def test_model_mms_version( repacked_model_uri="s3://mybucket/test-mxnet-model/model.tar.gz", sagemaker_session=sagemaker_session, kms_key=model_kms_key, + local_download_dir=None, ) assert model.model_data == MODEL_DATA diff --git a/tests/unit/test_pytorch.py b/tests/unit/test_pytorch.py index 082f699d63..40031ec618 100644 --- a/tests/unit/test_pytorch.py +++ b/tests/unit/test_pytorch.py @@ -392,6 +392,7 @@ def test_mms_model(repack_model, sagemaker_session): repacked_model_uri=ANY, sagemaker_session=sagemaker_session, source_directory=None, + local_download_dir=None, ) From f3e0feb2798b3b2a51d9e4490b7a559753a74af8 Mon Sep 17 00:00:00 2001 From: Evan Kravitz Date: Tue, 13 Dec 2022 22:26:37 +0000 Subject: [PATCH 38/41] chore: move local_download_dir to SessionSettings --- src/sagemaker/estimator.py | 5 ----- src/sagemaker/fw_utils.py | 15 +++++++++------ src/sagemaker/model.py | 6 ------ src/sagemaker/session_settings.py | 10 +++++++++- src/sagemaker/utils.py | 9 ++++++--- tests/unit/sagemaker/automl/test_auto_ml.py | 2 ++ .../sagemaker/huggingface/huggingface_utils.py | 2 ++ .../sagemaker/huggingface/test_estimator.py | 3 +++ .../sagemaker/huggingface/test_processing.py | 2 ++ .../sagemaker/image_uris/jumpstart/conftest.py | 3 +++ tests/unit/sagemaker/local/test_local_utils.py | 5 ++++- .../sagemaker/model/test_framework_model.py | 3 +++ tests/unit/sagemaker/model/test_model.py | 9 +++++++-- tests/unit/sagemaker/spark/test_processing.py | 2 ++ .../unit/sagemaker/tensorflow/test_estimator.py | 2 ++ .../test_huggingface_pytorch_compiler.py | 2 ++ .../test_huggingface_tensorflow_compiler.py | 2 ++ .../training_compiler/test_pytorch_compiler.py | 2 ++ .../test_tensorflow_compiler.py | 2 ++ .../unit/sagemaker/wrangler/test_processing.py | 2 ++ tests/unit/test_amazon_estimator.py | 2 ++ tests/unit/test_analytics.py | 2 ++ tests/unit/test_chainer.py | 2 ++ tests/unit/test_estimator.py | 17 +++++++++++++---- tests/unit/test_fm.py | 2 ++ tests/unit/test_fw_utils.py | 6 +++++- tests/unit/test_ipinsights.py | 2 ++ tests/unit/test_kmeans.py | 2 ++ tests/unit/test_knn.py | 2 ++ tests/unit/test_lda.py | 2 ++ tests/unit/test_linear_learner.py | 2 ++ tests/unit/test_mxnet.py | 3 ++- tests/unit/test_ntm.py | 2 ++ tests/unit/test_object2vec.py | 2 ++ tests/unit/test_pca.py | 2 ++ tests/unit/test_pipeline_model.py | 2 ++ tests/unit/test_processing.py | 3 +++ tests/unit/test_pytorch.py | 3 ++- tests/unit/test_randomcutforest.py | 2 ++ tests/unit/test_rl.py | 2 ++ tests/unit/test_sklearn.py | 2 ++ tests/unit/test_sparkml_serving.py | 2 ++ tests/unit/test_timeout.py | 2 ++ tests/unit/test_tuner.py | 2 ++ tests/unit/test_utils.py | 6 +++--- tests/unit/test_xgboost.py | 2 ++ 46 files changed, 132 insertions(+), 34 deletions(-) diff --git a/src/sagemaker/estimator.py b/src/sagemaker/estimator.py index 6b5de0dac9..6f729267de 100644 --- a/src/sagemaker/estimator.py +++ b/src/sagemaker/estimator.py @@ -154,7 +154,6 @@ def __init__( entry_point: Optional[Union[str, PipelineVariable]] = None, dependencies: Optional[List[Union[str]]] = None, instance_groups: Optional[List[InstanceGroup]] = None, - local_download_dir: Optional[str] = None, **kwargs, ): """Initialize an ``EstimatorBase`` instance. @@ -489,8 +488,6 @@ def __init__( `Train Using a Heterogeneous Cluster `_ in the *Amazon SageMaker developer guide*. - local_download_dir (str): Optional. A path specifying the local directory - for artifacts downloaded. (Default: None). """ instance_count = renamed_kwargs( "train_instance_count", "instance_count", instance_count, kwargs @@ -595,7 +592,6 @@ def __init__( self.environment = environment self.max_retry_attempts = max_retry_attempts - self.local_download_dir = local_download_dir if not _region_supports_profiler( self.sagemaker_session.boto_region_name @@ -823,7 +819,6 @@ def _stage_user_code_in_s3(self) -> str: kms_key=kms_key, s3_resource=self.sagemaker_session.s3_resource, settings=self.sagemaker_session.settings, - local_download_dir=self.local_download_dir, ) def _assign_s3_prefix(self, key_prefix=""): diff --git a/src/sagemaker/fw_utils.py b/src/sagemaker/fw_utils.py index 7893ad4055..4ff4d6b6f3 100644 --- a/src/sagemaker/fw_utils.py +++ b/src/sagemaker/fw_utils.py @@ -378,7 +378,6 @@ def tar_and_upload_dir( kms_key=None, s3_resource=None, settings: Optional[SessionSettings] = None, - local_download_dir: Optional[str] = None, ): """Package source files and upload a compress tar file to S3. @@ -409,8 +408,6 @@ def tar_and_upload_dir( settings (sagemaker.session_settings.SessionSettings): Optional. The settings of the SageMaker ``Session``, can be used to override the default encryption behavior (default: None). - local_download_dir (str): Optional. A path specifying the local directory - for artifacts downloaded. (Default: None). Returns: sagemaker.fw_utils.UserCode: An object with the S3 bucket and key (S3 prefix) and script name. @@ -421,12 +418,18 @@ def tar_and_upload_dir( script_name = script if directory else os.path.basename(script) dependencies = dependencies or [] key = "%s/sourcedir.tar.gz" % s3_key_prefix - if local_download_dir is not None and not ( - os.path.exists(local_download_dir) and os.path.isdir(local_download_dir) + if ( + settings is not None + and settings.local_download_dir is not None + and not ( + os.path.exists(settings.local_download_dir) + and os.path.isdir(settings.local_download_dir) + ) ): raise ValueError( - f"Inputted directory for storing newly generated temporary directory does not exist: '{local_download_dir}'" + f"Inputted directory for storing newly generated temporary directory does not exist: '{settings.local_download_dir}'" ) + local_download_dir = None if settings == None else settings.local_download_dir tmp = tempfile.mkdtemp(dir=local_download_dir) encrypt_artifact = True if settings is None else settings.encrypt_repacked_artifacts diff --git a/src/sagemaker/model.py b/src/sagemaker/model.py index 0e0d3ce6bf..44e6b27960 100644 --- a/src/sagemaker/model.py +++ b/src/sagemaker/model.py @@ -105,7 +105,6 @@ def __init__( container_log_level: Union[int, PipelineVariable] = logging.INFO, dependencies: Optional[List[str]] = None, git_config: Optional[Dict[str, str]] = None, - local_download_dir: Optional[str] = None, ): """Initialize an SageMaker ``Model``. @@ -265,8 +264,6 @@ def __init__( authentication if they are provided. If they are not provided, the SageMaker Python SDK attempts to use either the CodeCommit credential helper or local credential storage for authentication. - local_download_dir (str): Optional. A path specifying the local directory - for downloading artifacts. (Default: None). """ self.model_data = model_data self.image_uri = image_uri @@ -289,7 +286,6 @@ def __init__( self.dependencies = dependencies or [] self.git_config = git_config self.container_log_level = container_log_level - self.local_download_dir = local_download_dir if code_location: self.bucket, self.key_prefix = s3.parse_s3_url(code_location) else: @@ -554,7 +550,6 @@ def _upload_code(self, key_prefix: str, repack: bool = False) -> None: directory=self.source_dir, dependencies=self.dependencies, settings=self.sagemaker_session.settings, - local_download_dir=self.local_download_dir, ) if repack and self.model_data is not None and self.entry_point is not None: @@ -599,7 +594,6 @@ def _upload_code(self, key_prefix: str, repack: bool = False) -> None: repacked_model_uri=repacked_model_data, sagemaker_session=self.sagemaker_session, kms_key=self.model_kms_key, - local_download_dir=self.local_download_dir, ) self.repacked_model_data = repacked_model_data diff --git a/src/sagemaker/session_settings.py b/src/sagemaker/session_settings.py index 53ff9a9f0d..6c7e48dce2 100644 --- a/src/sagemaker/session_settings.py +++ b/src/sagemaker/session_settings.py @@ -18,17 +18,25 @@ class SessionSettings(object): """Optional container class for settings to apply to a SageMaker session.""" - def __init__(self, encrypt_repacked_artifacts=True) -> None: + def __init__(self, encrypt_repacked_artifacts=True, local_download_dir=None) -> None: """Initialize the ``SessionSettings`` of a SageMaker ``Session``. Args: encrypt_repacked_artifacts (bool): Flag to indicate whether to encrypt the artifacts at rest in S3 using the default AWS managed KMS key for S3 when a custom KMS key is not provided (Default: True). + local_download_dir (str): Optional. A path specifying the local directory + for downloading artifacts. (Default: None). """ self._encrypt_repacked_artifacts = encrypt_repacked_artifacts + self._local_download_dir = local_download_dir @property def encrypt_repacked_artifacts(self) -> bool: """Return True if repacked artifacts at rest in S3 should be encrypted by default.""" return self._encrypt_repacked_artifacts + + @property + def local_download_dir(self) -> str: + """Return path specifying the local directory for downloading artifacts.""" + return self._local_download_dir diff --git a/src/sagemaker/utils.py b/src/sagemaker/utils.py index 4ea11f0aab..f5d1f82249 100644 --- a/src/sagemaker/utils.py +++ b/src/sagemaker/utils.py @@ -391,7 +391,6 @@ def repack_model( repacked_model_uri, sagemaker_session, kms_key=None, - local_download_dir=None, ): """Unpack model tarball and creates a new model tarball with the provided code script. @@ -427,13 +426,17 @@ def repack_model( sagemaker_session (sagemaker.session.Session): a sagemaker session to interact with S3. kms_key (str): KMS key ARN for encrypting the repacked model file - local_download_dir (str): Optional. A path specifying the local directory - for downloading artifacts. (Default: None). Returns: str: path to the new packed model """ dependencies = dependencies or [] + local_download_dir = ( + None + if sagemaker_session.settings == None + or sagemaker_session.settings.local_download_dir == None + else sagemaker_session.settings.local_download_dir + ) with _tmpdir(dir=local_download_dir) as tmp: model_dir = _extract_model(model_uri, sagemaker_session, tmp) diff --git a/tests/unit/sagemaker/automl/test_auto_ml.py b/tests/unit/sagemaker/automl/test_auto_ml.py index 2c997397c5..e68a019ce4 100644 --- a/tests/unit/sagemaker/automl/test_auto_ml.py +++ b/tests/unit/sagemaker/automl/test_auto_ml.py @@ -18,6 +18,7 @@ from mock import Mock, patch from sagemaker import AutoML, AutoMLJob, AutoMLInput, CandidateEstimator, PipelineModel from sagemaker.predictor import Predictor +from sagemaker.session_settings import SessionSettings from sagemaker.workflow.functions import Join MODEL_DATA = "s3://bucket/model.tar.gz" @@ -254,6 +255,7 @@ def sagemaker_session(): boto_region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) sms.upload_data = Mock(name="upload_data", return_value=DEFAULT_S3_INPUT_DATA) diff --git a/tests/unit/sagemaker/huggingface/huggingface_utils.py b/tests/unit/sagemaker/huggingface/huggingface_utils.py index 3ce8b134be..2f092f7b0a 100644 --- a/tests/unit/sagemaker/huggingface/huggingface_utils.py +++ b/tests/unit/sagemaker/huggingface/huggingface_utils.py @@ -13,6 +13,8 @@ from __future__ import absolute_import from sagemaker import image_uris +from sagemaker.session_settings import SessionSettings + REGION = "us-east-1" GPU_INSTANCE_TYPE = "ml.p2.xlarge" diff --git a/tests/unit/sagemaker/huggingface/test_estimator.py b/tests/unit/sagemaker/huggingface/test_estimator.py index c391d45382..c3c28dc0c1 100644 --- a/tests/unit/sagemaker/huggingface/test_estimator.py +++ b/tests/unit/sagemaker/huggingface/test_estimator.py @@ -20,6 +20,8 @@ from mock import MagicMock, Mock, patch from sagemaker.huggingface import HuggingFace, HuggingFaceModel +from sagemaker.session_settings import SessionSettings + from .huggingface_utils import get_full_gpu_image_uri, GPU_INSTANCE_TYPE, REGION @@ -62,6 +64,7 @@ def fixture_sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} diff --git a/tests/unit/sagemaker/huggingface/test_processing.py b/tests/unit/sagemaker/huggingface/test_processing.py index 96a94f42e7..e7887cd794 100644 --- a/tests/unit/sagemaker/huggingface/test_processing.py +++ b/tests/unit/sagemaker/huggingface/test_processing.py @@ -17,6 +17,7 @@ from sagemaker.huggingface.processing import HuggingFaceProcessor from sagemaker.fw_utils import UploadedCode +from sagemaker.session_settings import SessionSettings from .huggingface_utils import get_full_gpu_image_uri, GPU_INSTANCE_TYPE, REGION @@ -42,6 +43,7 @@ def sagemaker_session(): boto_region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) session_mock.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/sagemaker/image_uris/jumpstart/conftest.py b/tests/unit/sagemaker/image_uris/jumpstart/conftest.py index 66fedcab8c..a67dca6ab4 100644 --- a/tests/unit/sagemaker/image_uris/jumpstart/conftest.py +++ b/tests/unit/sagemaker/image_uris/jumpstart/conftest.py @@ -15,6 +15,8 @@ from mock.mock import Mock import pytest +from sagemaker.session_settings import SessionSettings + REGION_NAME = "us-west-2" BUCKET_NAME = "some-bucket-name" @@ -26,6 +28,7 @@ def session(): boto_session=boto_mock, boto_region_name=REGION_NAME, config=None, + settings=SessionSettings(), ) sms.default_bucket = Mock(return_value=BUCKET_NAME) return sms diff --git a/tests/unit/sagemaker/local/test_local_utils.py b/tests/unit/sagemaker/local/test_local_utils.py index 0129e574ea..668efd7a41 100644 --- a/tests/unit/sagemaker/local/test_local_utils.py +++ b/tests/unit/sagemaker/local/test_local_utils.py @@ -17,6 +17,7 @@ from mock import patch, Mock import sagemaker.local.utils +from sagemaker.session_settings import SessionSettings @patch("sagemaker.local.utils.os.path") @@ -42,7 +43,9 @@ def test_move_to_destination_local(recursive_copy): @patch("shutil.rmtree", Mock()) @patch("sagemaker.local.utils.recursive_copy") def test_move_to_destination_s3(recursive_copy): - sms = Mock() + sms = Mock( + settings=SessionSettings(), + ) # without trailing slash in prefix sagemaker.local.utils.move_to_destination("/tmp/data", "s3://bucket/path", "job", sms) diff --git a/tests/unit/sagemaker/model/test_framework_model.py b/tests/unit/sagemaker/model/test_framework_model.py index caa6eb0779..73ff09ef07 100644 --- a/tests/unit/sagemaker/model/test_framework_model.py +++ b/tests/unit/sagemaker/model/test_framework_model.py @@ -21,6 +21,8 @@ import pytest from mock import MagicMock, Mock, patch +from sagemaker.session_settings import SessionSettings + MODEL_DATA = "s3://bucket/model.tar.gz" MODEL_IMAGE = "mi" ENTRY_POINT = "blah.py" @@ -89,6 +91,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) return sms diff --git a/tests/unit/sagemaker/model/test_model.py b/tests/unit/sagemaker/model/test_model.py index 0c247c9979..2274a5feb6 100644 --- a/tests/unit/sagemaker/model/test_model.py +++ b/tests/unit/sagemaker/model/test_model.py @@ -783,6 +783,9 @@ def test_model_local_download_dir(repack_model, sagemaker_session): source_dir = "s3://blah/blah/blah" local_download_dir = "local download dir" + + sagemaker_session.settings.local_download_dir = local_download_dir + t = Model( entry_point=ENTRY_POINT_INFERENCE, role=ROLE, @@ -790,8 +793,10 @@ def test_model_local_download_dir(repack_model, sagemaker_session): source_dir=source_dir, image_uri=IMAGE_URI, model_data=MODEL_DATA, - local_download_dir=local_download_dir, ) t.deploy(instance_type=INSTANCE_TYPE, initial_instance_count=INSTANCE_COUNT) - assert repack_model.call_args_list[0][1].get("local_download_dir") == local_download_dir + assert ( + repack_model.call_args_list[0][1]["sagemaker_session"].settings.local_download_dir + == local_download_dir + ) diff --git a/tests/unit/sagemaker/spark/test_processing.py b/tests/unit/sagemaker/spark/test_processing.py index 4f784e1c66..ba08f82fad 100644 --- a/tests/unit/sagemaker/spark/test_processing.py +++ b/tests/unit/sagemaker/spark/test_processing.py @@ -18,6 +18,7 @@ import pytest from sagemaker.processing import ProcessingInput, ProcessingOutput +from sagemaker.session_settings import SessionSettings from sagemaker.spark.processing import ( PySparkProcessor, SparkJarProcessor, @@ -57,6 +58,7 @@ def sagemaker_session(): boto_region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) session_mock.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/sagemaker/tensorflow/test_estimator.py b/tests/unit/sagemaker/tensorflow/test_estimator.py index 2e7576421f..1dbb435256 100644 --- a/tests/unit/sagemaker/tensorflow/test_estimator.py +++ b/tests/unit/sagemaker/tensorflow/test_estimator.py @@ -21,6 +21,7 @@ import pytest from sagemaker.estimator import _TrainingJob +from sagemaker.session_settings import SessionSettings from sagemaker.tensorflow import TensorFlow from sagemaker.instance_group import InstanceGroup from sagemaker.workflow.parameters import ParameterString, ParameterBoolean @@ -70,6 +71,7 @@ def sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) session.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) session.expand_role = Mock(name="expand_role", return_value=ROLE) diff --git a/tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py b/tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py index af46cf4360..fab86c43de 100644 --- a/tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py @@ -24,6 +24,7 @@ from sagemaker.huggingface import HuggingFace, TrainingCompilerConfig from sagemaker.huggingface.model import HuggingFaceModel from sagemaker.instance_group import InstanceGroup +from sagemaker.session_settings import SessionSettings from tests.unit.sagemaker.training_compiler import EC2_GPU_INSTANCE_CLASSES @@ -71,6 +72,7 @@ def fixture_sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} diff --git a/tests/unit/sagemaker/training_compiler/test_huggingface_tensorflow_compiler.py b/tests/unit/sagemaker/training_compiler/test_huggingface_tensorflow_compiler.py index 5aef9316da..b1d5e0bf0c 100644 --- a/tests/unit/sagemaker/training_compiler/test_huggingface_tensorflow_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_huggingface_tensorflow_compiler.py @@ -22,6 +22,7 @@ from sagemaker import image_uris from sagemaker.huggingface import HuggingFace, TrainingCompilerConfig from sagemaker.huggingface.model import HuggingFaceModel +from sagemaker.session_settings import SessionSettings from tests.unit.sagemaker.training_compiler import EC2_GPU_INSTANCE_CLASSES @@ -69,6 +70,7 @@ def fixture_sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} diff --git a/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py b/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py index 0fe2402695..d0cc230780 100644 --- a/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py @@ -24,6 +24,7 @@ from sagemaker.pytorch import PyTorch, TrainingCompilerConfig from sagemaker.pytorch.model import PyTorchModel from sagemaker.instance_group import InstanceGroup +from sagemaker.session_settings import SessionSettings from tests.unit.sagemaker.training_compiler import EC2_GPU_INSTANCE_CLASSES @@ -71,6 +72,7 @@ def fixture_sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} diff --git a/tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py b/tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py index 7517f3a641..e6037a7e88 100644 --- a/tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py @@ -21,6 +21,7 @@ from mock import MagicMock, Mock, patch from sagemaker import image_uris +from sagemaker.session_settings import SessionSettings from sagemaker.tensorflow import TensorFlow, TrainingCompilerConfig from tests.unit.sagemaker.training_compiler import EC2_GPU_INSTANCE_CLASSES @@ -75,6 +76,7 @@ def fixture_sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} diff --git a/tests/unit/sagemaker/wrangler/test_processing.py b/tests/unit/sagemaker/wrangler/test_processing.py index 87a98744b6..f83ae74dfa 100644 --- a/tests/unit/sagemaker/wrangler/test_processing.py +++ b/tests/unit/sagemaker/wrangler/test_processing.py @@ -14,6 +14,7 @@ import pytest from mock import Mock, MagicMock +from sagemaker.session_settings import SessionSettings from sagemaker.wrangler.processing import DataWranglerProcessor from sagemaker.processing import ProcessingInput @@ -36,6 +37,7 @@ def sagemaker_session(): boto_region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) session_mock.expand_role.return_value = ROLE return session_mock diff --git a/tests/unit/test_amazon_estimator.py b/tests/unit/test_amazon_estimator.py index 82b154317d..2a3e8d34f8 100644 --- a/tests/unit/test_amazon_estimator.py +++ b/tests/unit/test_amazon_estimator.py @@ -23,6 +23,7 @@ _build_shards, FileSystemRecordSet, ) +from sagemaker.session_settings import SessionSettings COMMON_ARGS = {"role": "myrole", "instance_count": 1, "instance_type": "ml.c4.xlarge"} @@ -40,6 +41,7 @@ def sagemaker_session(): region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_analytics.py b/tests/unit/test_analytics.py index e30abb7da9..8cb90dbf46 100644 --- a/tests/unit/test_analytics.py +++ b/tests/unit/test_analytics.py @@ -24,6 +24,7 @@ HyperparameterTuningJobAnalytics, TrainingJobAnalytics, ) +from sagemaker.session_settings import SessionSettings BUCKET_NAME = "mybucket" REGION = "us-west-2" @@ -47,6 +48,7 @@ def create_sagemaker_session( boto_region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) sms.sagemaker_client.describe_hyper_parameter_tuning_job = Mock( diff --git a/tests/unit/test_chainer.py b/tests/unit/test_chainer.py index 7cc973440f..a147034418 100644 --- a/tests/unit/test_chainer.py +++ b/tests/unit/test_chainer.py @@ -24,6 +24,7 @@ from sagemaker.chainer import defaults from sagemaker.chainer import Chainer from sagemaker.chainer import ChainerPredictor, ChainerModel +from sagemaker.session_settings import SessionSettings DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "data") SCRIPT_PATH = os.path.join(DATA_DIR, "dummy_script.py") @@ -62,6 +63,7 @@ def sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} diff --git a/tests/unit/test_estimator.py b/tests/unit/test_estimator.py index 2f1ca404fd..55f937cfc1 100644 --- a/tests/unit/test_estimator.py +++ b/tests/unit/test_estimator.py @@ -49,6 +49,7 @@ from sagemaker.mxnet.estimator import MXNet from sagemaker.predictor import Predictor from sagemaker.pytorch.estimator import PyTorch +from sagemaker.session_settings import SessionSettings from sagemaker.sklearn.estimator import SKLearn from sagemaker.tensorflow.estimator import TensorFlow from sagemaker.predictor_async import AsyncPredictor @@ -221,6 +222,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) sms.sagemaker_client.describe_training_job = Mock( @@ -243,7 +245,7 @@ def pipeline_session(): type(role_mock).arn = PropertyMock(return_value=ROLE) resource_mock = Mock() resource_mock.Role.return_value = role_mock - session_mock = Mock(region_name=REGION) + session_mock = Mock(region_name=REGION, settings=SessionSettings()) session_mock.resource.return_value = resource_mock session_mock.client.return_value = client_mock return PipelineSession( @@ -734,6 +736,7 @@ def test_framework_with_no_default_profiler_in_unsupported_region(region): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) f = DummyFramework( entry_point=SCRIPT_PATH, @@ -761,6 +764,7 @@ def test_framework_with_debugger_config_set_up_in_unsupported_region(region): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) f = DummyFramework( entry_point=SCRIPT_PATH, @@ -787,6 +791,7 @@ def test_framework_enable_profiling_in_unsupported_region(region): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) f = DummyFramework( entry_point=SCRIPT_PATH, @@ -813,6 +818,7 @@ def test_framework_update_profiling_in_unsupported_region(region): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) f = DummyFramework( entry_point=SCRIPT_PATH, @@ -839,6 +845,7 @@ def test_framework_disable_profiling_in_unsupported_region(region): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) f = DummyFramework( entry_point=SCRIPT_PATH, @@ -4558,6 +4565,10 @@ def test_estimator_local_download_dir( ) sagemaker_session.boto_region_name = REGION + local_download_dir = "some/download/dir" + + sagemaker_session.settings.local_download_dir = local_download_dir + instance_type = "ml.p2.xlarge" instance_count = 1 @@ -4565,7 +4576,6 @@ def test_estimator_local_download_dir( jumpstart_source_dir = f"s3://{list(JUMPSTART_BUCKET_NAME_SET)[0]}/source_dirs/source.tar.gz" - local_download_dir = "some/download/dir" generic_estimator = Estimator( entry_point=SCRIPT_PATH, role=ROLE, @@ -4576,11 +4586,10 @@ def test_estimator_local_download_dir( source_dir=jumpstart_source_dir, image_uri=IMAGE_URI, model_uri=MODEL_DATA, - local_download_dir=local_download_dir, ) generic_estimator.fit(training_data_uri) assert ( - patched_tar_and_upload_dir.call_args_list[0][1].get("local_download_dir") + patched_tar_and_upload_dir.call_args_list[0][1]["settings"].local_download_dir == local_download_dir ) diff --git a/tests/unit/test_fm.py b/tests/unit/test_fm.py index 985262ca64..ceefeb9b3e 100644 --- a/tests/unit/test_fm.py +++ b/tests/unit/test_fm.py @@ -21,6 +21,7 @@ FactorizationMachinesPredictor, ) from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -58,6 +59,7 @@ def sagemaker_session(): local_mode=False, s3_client=False, s3_resource=False, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_fw_utils.py b/tests/unit/test_fw_utils.py index 667d115d58..ea5f9bf76e 100644 --- a/tests/unit/test_fw_utils.py +++ b/tests/unit/test_fw_utils.py @@ -43,7 +43,11 @@ def cd(path): def sagemaker_session(): boto_mock = Mock(name="boto_session", region_name="us-west-2") session_mock = Mock( - name="sagemaker_session", boto_session=boto_mock, s3_client=None, s3_resource=None + name="sagemaker_session", + boto_session=boto_mock, + s3_client=None, + s3_resource=None, + settings=SessionSettings(), ) session_mock.default_bucket = Mock(name="default_bucket", return_value="my-bucket") session_mock.expand_role = Mock(name="expand_role", return_value="my-role") diff --git a/tests/unit/test_ipinsights.py b/tests/unit/test_ipinsights.py index 3190ea2e18..478d33fc06 100644 --- a/tests/unit/test_ipinsights.py +++ b/tests/unit/test_ipinsights.py @@ -18,6 +18,7 @@ from sagemaker import image_uris from sagemaker.amazon.ipinsights import IPInsights, IPInsightsPredictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings # Mocked training config ROLE = "myrole" @@ -55,6 +56,7 @@ def sagemaker_session(): region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_kmeans.py b/tests/unit/test_kmeans.py index be1862175c..790ee73576 100644 --- a/tests/unit/test_kmeans.py +++ b/tests/unit/test_kmeans.py @@ -18,6 +18,7 @@ from sagemaker import image_uris from sagemaker.amazon.kmeans import KMeans, KMeansPredictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -52,6 +53,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_knn.py b/tests/unit/test_knn.py index 9afe468cea..02dc073d9d 100644 --- a/tests/unit/test_knn.py +++ b/tests/unit/test_knn.py @@ -18,6 +18,7 @@ from sagemaker import image_uris from sagemaker.amazon.knn import KNN, KNNPredictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -58,6 +59,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_lda.py b/tests/unit/test_lda.py index 0da89384ed..f2574b30b5 100644 --- a/tests/unit/test_lda.py +++ b/tests/unit/test_lda.py @@ -18,6 +18,7 @@ from sagemaker import image_uris from sagemaker.amazon.lda import LDA, LDAPredictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -47,6 +48,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_linear_learner.py b/tests/unit/test_linear_learner.py index bd41b9e49b..bb2a140200 100644 --- a/tests/unit/test_linear_learner.py +++ b/tests/unit/test_linear_learner.py @@ -18,6 +18,7 @@ from sagemaker import image_uris from sagemaker.amazon.linear_learner import LinearLearner, LinearLearnerPredictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -53,6 +54,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_mxnet.py b/tests/unit/test_mxnet.py index 5860b2ca46..ac55b3e6bc 100644 --- a/tests/unit/test_mxnet.py +++ b/tests/unit/test_mxnet.py @@ -28,6 +28,7 @@ from sagemaker.mxnet import defaults from sagemaker.mxnet import MXNet from sagemaker.mxnet import MXNetPredictor, MXNetModel +from sagemaker.session_settings import SessionSettings DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "data") SCRIPT_NAME = "dummy_script.py" @@ -82,6 +83,7 @@ def sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} @@ -693,7 +695,6 @@ def test_model_mms_version( repacked_model_uri="s3://mybucket/test-mxnet-model/model.tar.gz", sagemaker_session=sagemaker_session, kms_key=model_kms_key, - local_download_dir=None, ) assert model.model_data == MODEL_DATA diff --git a/tests/unit/test_ntm.py b/tests/unit/test_ntm.py index f18a15457e..cbe9f18e36 100644 --- a/tests/unit/test_ntm.py +++ b/tests/unit/test_ntm.py @@ -18,6 +18,7 @@ from sagemaker import image_uris from sagemaker.amazon.ntm import NTM, NTMPredictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -52,6 +53,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_object2vec.py b/tests/unit/test_object2vec.py index 5963feb5bb..e6aaf770fa 100644 --- a/tests/unit/test_object2vec.py +++ b/tests/unit/test_object2vec.py @@ -19,6 +19,7 @@ from sagemaker.amazon.object2vec import Object2Vec from sagemaker.predictor import Predictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -60,6 +61,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_pca.py b/tests/unit/test_pca.py index 9ea9dcbcd6..222021caa3 100644 --- a/tests/unit/test_pca.py +++ b/tests/unit/test_pca.py @@ -18,6 +18,7 @@ from sagemaker import image_uris from sagemaker.amazon.pca import PCA, PCAPredictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -52,6 +53,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_pipeline_model.py b/tests/unit/test_pipeline_model.py index 38c9b373e3..913ffbc556 100644 --- a/tests/unit/test_pipeline_model.py +++ b/tests/unit/test_pipeline_model.py @@ -18,6 +18,7 @@ from sagemaker.model import FrameworkModel from sagemaker.pipeline import PipelineModel from sagemaker.predictor import Predictor +from sagemaker.session_settings import SessionSettings from sagemaker.sparkml import SparkMLModel ENTRY_POINT = "blah.py" @@ -65,6 +66,7 @@ def sagemaker_session(): local_mode=False, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) return sms diff --git a/tests/unit/test_processing.py b/tests/unit/test_processing.py index 81579d397a..34c530747d 100644 --- a/tests/unit/test_processing.py +++ b/tests/unit/test_processing.py @@ -29,6 +29,7 @@ ScriptProcessor, ProcessingJob, ) +from sagemaker.session_settings import SessionSettings from sagemaker.spark.processing import PySparkProcessor from sagemaker.sklearn.processing import SKLearnProcessor from sagemaker.pytorch.processing import PyTorchProcessor @@ -68,6 +69,7 @@ def sagemaker_session(): boto_region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) session_mock.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) @@ -89,6 +91,7 @@ def pipeline_session(): boto_region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) session_mock.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_pytorch.py b/tests/unit/test_pytorch.py index 40031ec618..3e50129cc7 100644 --- a/tests/unit/test_pytorch.py +++ b/tests/unit/test_pytorch.py @@ -23,6 +23,7 @@ from sagemaker.pytorch import defaults from sagemaker.pytorch import PyTorch, PyTorchPredictor, PyTorchModel from sagemaker.instance_group import InstanceGroup +from sagemaker.session_settings import SessionSettings DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "data") SCRIPT_PATH = os.path.join(DATA_DIR, "dummy_script.py") @@ -70,6 +71,7 @@ def fixture_sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} @@ -392,7 +394,6 @@ def test_mms_model(repack_model, sagemaker_session): repacked_model_uri=ANY, sagemaker_session=sagemaker_session, source_directory=None, - local_download_dir=None, ) diff --git a/tests/unit/test_randomcutforest.py b/tests/unit/test_randomcutforest.py index a2a07e5296..3e3bca00dc 100644 --- a/tests/unit/test_randomcutforest.py +++ b/tests/unit/test_randomcutforest.py @@ -18,6 +18,7 @@ from sagemaker import image_uris from sagemaker.amazon.randomcutforest import RandomCutForest, RandomCutForestPredictor from sagemaker.amazon.amazon_estimator import RecordSet +from sagemaker.session_settings import SessionSettings ROLE = "myrole" INSTANCE_COUNT = 1 @@ -52,6 +53,7 @@ def sagemaker_session(): region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_rl.py b/tests/unit/test_rl.py index 4efc2e5bf8..62bce66c7e 100644 --- a/tests/unit/test_rl.py +++ b/tests/unit/test_rl.py @@ -21,6 +21,7 @@ from sagemaker.mxnet import MXNetModel, MXNetPredictor from sagemaker.rl import RLEstimator, RLFramework, RLToolkit, TOOLKIT_FRAMEWORK_VERSION_MAP +from sagemaker.session_settings import SessionSettings from sagemaker.tensorflow import TensorFlowModel, TensorFlowPredictor @@ -63,6 +64,7 @@ def fixture_sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} diff --git a/tests/unit/test_sklearn.py b/tests/unit/test_sklearn.py index 13cc755336..7cc4fd2ad0 100644 --- a/tests/unit/test_sklearn.py +++ b/tests/unit/test_sklearn.py @@ -21,6 +21,7 @@ from mock import patch from sagemaker.fw_utils import UploadedCode +from sagemaker.session_settings import SessionSettings from sagemaker.sklearn import SKLearn, SKLearnModel, SKLearnPredictor DATA_DIR = os.path.join(os.path.dirname(__file__), "..", "data") @@ -65,6 +66,7 @@ def sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} diff --git a/tests/unit/test_sparkml_serving.py b/tests/unit/test_sparkml_serving.py index ae975b1ac2..3fb21d62d2 100644 --- a/tests/unit/test_sparkml_serving.py +++ b/tests/unit/test_sparkml_serving.py @@ -16,6 +16,7 @@ from mock import Mock from sagemaker import image_uris +from sagemaker.session_settings import SessionSettings from sagemaker.sparkml import SparkMLModel, SparkMLPredictor MODEL_DATA = "s3://bucket/model.tar.gz" @@ -40,6 +41,7 @@ def sagemaker_session(): region_name=REGION, config=None, local_mode=False, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.sagemaker_client.describe_endpoint = Mock(return_value=ENDPOINT_DESC) diff --git a/tests/unit/test_timeout.py b/tests/unit/test_timeout.py index 6d40a2e6dd..bded6ce2cc 100644 --- a/tests/unit/test_timeout.py +++ b/tests/unit/test_timeout.py @@ -23,6 +23,7 @@ import stopit from botocore.exceptions import ClientError +from sagemaker.session_settings import SessionSettings from tests.integ.timeout import ( timeout, @@ -56,6 +57,7 @@ def session(): boto_region_name=REGION, config=None, local_mode=True, + settings=SessionSettings(), ) sms.default_bucket = Mock(name=DEFAULT_BUCKET_NAME, return_value=BUCKET_NAME) return sms diff --git a/tests/unit/test_tuner.py b/tests/unit/test_tuner.py index 9bbc882dfa..5d2a5c05f1 100644 --- a/tests/unit/test_tuner.py +++ b/tests/unit/test_tuner.py @@ -30,6 +30,7 @@ from sagemaker.jumpstart.enums import JumpStartTag from sagemaker.mxnet import MXNet from sagemaker.parameter import ParameterRange +from sagemaker.session_settings import SessionSettings from sagemaker.tuner import ( HYPERBAND_MAX_RESOURCE, HYPERBAND_MIN_RESOURCE, @@ -55,6 +56,7 @@ def sagemaker_session(): boto_session=boto_mock, s3_client=None, s3_resource=None, + settings=SessionSettings(), ) sms.boto_region_name = REGION sms.default_bucket = Mock(name="default_bucket", return_value=BUCKET_NAME) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 0eb81be584..0a300e545b 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -556,7 +556,7 @@ def test_repack_model_from_file_to_file(tmp): model_tar_path = os.path.join(tmp, "model.tar.gz") sagemaker.utils.create_tar_file([os.path.join(tmp, "model")], model_tar_path) - sagemaker_session = MagicMock() + sagemaker_session = MagicMock(settings=SessionSettings()) file_mode_path = "file://%s" % model_tar_path destination_path = "file://%s" % os.path.join(tmp, "repacked-model.tar.gz") @@ -606,7 +606,7 @@ def test_repack_model_from_file_to_folder(tmp): [], file_mode_path, "file://%s/repacked-model.tar.gz" % tmp, - MagicMock(), + MagicMock(settings=SessionSettings()), ) assert list_tar_files("file://%s/repacked-model.tar.gz" % tmp, tmp) == { @@ -677,7 +677,7 @@ def test_repack_model_with_same_inference_file_name(tmp, fake_s3): class FakeS3(object): def __init__(self, tmp): self.tmp = tmp - self.sagemaker_session = MagicMock() + self.sagemaker_session = MagicMock(settings=SessionSettings()) self.location_map = {} self.current_bucket = None self.object_mock = MagicMock() diff --git a/tests/unit/test_xgboost.py b/tests/unit/test_xgboost.py index 82f27c19ae..671d355508 100644 --- a/tests/unit/test_xgboost.py +++ b/tests/unit/test_xgboost.py @@ -23,6 +23,7 @@ from sagemaker.fw_utils import UploadedCode +from sagemaker.session_settings import SessionSettings from sagemaker.xgboost import XGBoost, XGBoostModel, XGBoostPredictor @@ -68,6 +69,7 @@ def sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}} From d314b6755bdbe63e73702b9115ad65c5cf0ecbd4 Mon Sep 17 00:00:00 2001 From: Evan Kravitz Date: Wed, 14 Dec 2022 23:42:09 +0000 Subject: [PATCH 39/41] fix: tox errors --- src/sagemaker/fw_utils.py | 5 +++-- src/sagemaker/model.py | 1 + src/sagemaker/utils.py | 20 ++++++++++--------- .../huggingface/huggingface_utils.py | 1 - 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/sagemaker/fw_utils.py b/src/sagemaker/fw_utils.py index 4ff4d6b6f3..4a7a8da8d5 100644 --- a/src/sagemaker/fw_utils.py +++ b/src/sagemaker/fw_utils.py @@ -427,9 +427,10 @@ def tar_and_upload_dir( ) ): raise ValueError( - f"Inputted directory for storing newly generated temporary directory does not exist: '{settings.local_download_dir}'" + "Inputted directory for storing newly generated temporary directory does " + f"not exist: '{settings.local_download_dir}'" ) - local_download_dir = None if settings == None else settings.local_download_dir + local_download_dir = None if settings is None else settings.local_download_dir tmp = tempfile.mkdtemp(dir=local_download_dir) encrypt_artifact = True if settings is None else settings.encrypt_repacked_artifacts diff --git a/src/sagemaker/model.py b/src/sagemaker/model.py index 44e6b27960..e04b83a14f 100644 --- a/src/sagemaker/model.py +++ b/src/sagemaker/model.py @@ -264,6 +264,7 @@ def __init__( authentication if they are provided. If they are not provided, the SageMaker Python SDK attempts to use either the CodeCommit credential helper or local credential storage for authentication. + """ self.model_data = model_data self.image_uri = image_uri diff --git a/src/sagemaker/utils.py b/src/sagemaker/utils.py index f5d1f82249..32679ecc28 100644 --- a/src/sagemaker/utils.py +++ b/src/sagemaker/utils.py @@ -357,7 +357,7 @@ def create_tar_file(source_files, target=None): @contextlib.contextmanager -def _tmpdir(suffix="", prefix="tmp", dir=None): +def _tmpdir(suffix="", prefix="tmp", directory=None): """Create a temporary directory with a context manager. The file is deleted when the context exits. @@ -368,17 +368,18 @@ def _tmpdir(suffix="", prefix="tmp", dir=None): suffix, otherwise there will be no suffix. prefix (str): If prefix is specified, the file name will begin with that prefix; otherwise, a default prefix is used. - dir (str): If a directory is specified, the file will be downloaded in - this directory; otherwise, a default directory is used. + directory (str): If a directory is specified, the file will be downloaded + in this directory; otherwise, a default directory is used. Returns: str: path to the directory """ - if dir is not None and not (os.path.exists(dir) and os.path.isdir(dir)): + if directory is not None and not (os.path.exists(directory) and os.path.isdir(directory)): raise ValueError( - f"Inputted directory for storing newly generated temporary directory does not exist: '{dir}'" + "Inputted directory for storing newly generated temporary " + f"directory does not exist: '{directory}'" ) - tmp = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=dir) + tmp = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=directory) yield tmp shutil.rmtree(tmp) @@ -426,6 +427,7 @@ def repack_model( sagemaker_session (sagemaker.session.Session): a sagemaker session to interact with S3. kms_key (str): KMS key ARN for encrypting the repacked model file + Returns: str: path to the new packed model """ @@ -433,11 +435,11 @@ def repack_model( local_download_dir = ( None - if sagemaker_session.settings == None - or sagemaker_session.settings.local_download_dir == None + if sagemaker_session.settings is None + or sagemaker_session.settings.local_download_dir is None else sagemaker_session.settings.local_download_dir ) - with _tmpdir(dir=local_download_dir) as tmp: + with _tmpdir(directory=local_download_dir) as tmp: model_dir = _extract_model(model_uri, sagemaker_session, tmp) _create_or_update_code_dir( diff --git a/tests/unit/sagemaker/huggingface/huggingface_utils.py b/tests/unit/sagemaker/huggingface/huggingface_utils.py index 2f092f7b0a..edb5ef5478 100644 --- a/tests/unit/sagemaker/huggingface/huggingface_utils.py +++ b/tests/unit/sagemaker/huggingface/huggingface_utils.py @@ -13,7 +13,6 @@ from __future__ import absolute_import from sagemaker import image_uris -from sagemaker.session_settings import SessionSettings REGION = "us-east-1" From 51899a991d96991c6bff33769ab751fdee50d410 Mon Sep 17 00:00:00 2001 From: Evan Kravitz Date: Fri, 30 Dec 2022 19:51:42 +0000 Subject: [PATCH 40/41] chore: clean git diff --- coverage.xml | 0 src/sagemaker/image_uri_config/autogluon.json | 3 - test_notebook.ipynb | 859 ------------------ test_output.txt | 570 ------------ test_script.py | 57 -- .../huggingface/huggingface_utils.py | 1 - 6 files changed, 1490 deletions(-) delete mode 100644 coverage.xml delete mode 100644 test_notebook.ipynb delete mode 100644 test_output.txt delete mode 100644 test_script.py diff --git a/coverage.xml b/coverage.xml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/sagemaker/image_uri_config/autogluon.json b/src/sagemaker/image_uri_config/autogluon.json index 27d7cdbbc3..2fab95eefc 100644 --- a/src/sagemaker/image_uri_config/autogluon.json +++ b/src/sagemaker/image_uri_config/autogluon.json @@ -489,15 +489,12 @@ "cn-north-1": "727897471807", "cn-northwest-1": "727897471807", "eu-central-1": "763104351884", - "eu-central-2": "380420809688", "eu-north-1": "763104351884", "eu-west-1": "763104351884", "eu-west-2": "763104351884", "eu-west-3": "763104351884", "eu-south-1": "692866216735", - "eu-south-2": "503227376785", "me-south-1": "217643126080", - "me-central-1": "914824155844", "sa-east-1": "763104351884", "us-east-1": "763104351884", "us-east-2": "763104351884", diff --git a/test_notebook.ipynb b/test_notebook.ipynb deleted file mode 100644 index 7a406b04f7..0000000000 --- a/test_notebook.ipynb +++ /dev/null @@ -1,859 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "c22ca72c", - "metadata": {}, - "source": [ - "# Introduction to JumpStart - Image Classification" - ] - }, - { - "cell_type": "markdown", - "id": "8369a368", - "metadata": {}, - "source": [ - "---\n", - "Welcome to Amazon [SageMaker JumpStart](https://docs.aws.amazon.com/sagemaker/latest/dg/studio-jumpstart.html)! You can use JumpStart to solve many Machine Learning tasks through one-click in SageMaker Studio, or through [SageMaker JumpStart API](https://sagemaker.readthedocs.io/en/stable/overview.html#use-prebuilt-models-with-sagemaker-jumpstart). \n", - "\n", - "In this demo notebook, we demonstrate how to use the JumpStart API for Image Classification. Image Classification refers to classifying an image to one of the class labels of the training dataset. We demonstrate two use cases of Image Classification models:\n", - "\n", - "* How to use a model pre-trained on ImageNet dataset to classify an image. [ImageNetLabels](https://storage.googleapis.com/download.tensorflow.org/data/ImageNetLabels.txt).\n", - "* How to fine-tune a pre-trained model to a custom dataset, and then run inference on the fine-tuned model.\n", - "\n", - "Note: This notebook was tested on ml.t3.medium instance in Amazon SageMaker Studio with Python 3 (Data Science) kernel and in Amazon SageMaker Notebook instance with conda_python3 kernel.\n", - "\n", - "---" - ] - }, - { - "cell_type": "markdown", - "id": "cdead904", - "metadata": {}, - "source": [ - "1. [Set Up](#1.-Set-Up)\n", - "2. [Select a pre-trained model](#2.-Select-a-pre-trained-model)\n", - "3. [Run inference on the pre-trained model](#3.-Run-inference-on-the-pre-trained-model)\n", - " * [Retrieve JumpStart Artifacts & Deploy an Endpoint](#3.1.-Retrieve-JumpStart-Artifacts-&-Deploy-an-Endpoint)\n", - " * [Download example images for inference](#3.2.-Download-example-images-for-inference)\n", - " * [Query endpoint and parse response](#3.3.-Query-endpoint-and-parse-response)\n", - " * [Clean up the endpoint](#3.4.-Clean-up-the-endpoint)\n", - "4. [Fine-tune the pre-trained model on a custom dataset](#4.-Fine-tune-the-pre-trained-model-on-a-custome-dataset)\n", - " * [Retrieve JumpStart Training artifacts](#4.1.-Retrieve-JumpStart-Training-artifacts)\n", - " * [Set Training parameters](#4.2.-Set-Training-parameters)\n", - " * [Train with Automatic Model Tuning (HPO)](#AMT)\n", - " * [Start Training](#4.4.-Start-Training)\n", - " * [Deploy & run Inference on the fine-tuned model](#4.5.-Deploy-&-run-Inference-on-the-fine-tuned-model)\n", - " * [Incrementally train the fine-tuned model](#4.6.-Incrementally-train-the-fine-tuned-model)" - ] - }, - { - "cell_type": "markdown", - "id": "1a9fed35", - "metadata": {}, - "source": [ - "## 1. Set Up\n", - "***\n", - "Before executing the notebook, there are some initial steps required for setup. This notebook requires latest version of sagemaker and ipywidgets.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "47e5ecdd", - "metadata": {}, - "outputs": [], - "source": [ - "!pip install sagemaker ipywidgets --upgrade --quiet" - ] - }, - { - "cell_type": "markdown", - "id": "a3025526", - "metadata": {}, - "source": [ - "---\n", - "\n", - "To train and host on Amazon Sagemaker, we need to setup and authenticate the use of AWS services. Here, we use the execution role associated with the current notebook instance as the AWS account role with SageMaker access. It has necessary permissions, including access to your data in S3. \n", - "\n", - "---" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "821e99bf", - "metadata": {}, - "outputs": [], - "source": [ - "import sagemaker, boto3, json\n", - "from sagemaker import get_execution_role\n", - "\n", - "aws_role = get_execution_role()\n", - "aws_region = boto3.Session().region_name\n", - "sess = sagemaker.Session()" - ] - }, - { - "cell_type": "markdown", - "id": "cab4efc2", - "metadata": {}, - "source": [ - "## 2. Select a pre-trained model\n", - "***\n", - "You can continue with the default model, or can choose a different model from the dropdown generated upon running the next cell. A complete list of JumpStart models can also be accessed at [JumpStart Models](https://sagemaker.readthedocs.io/en/stable/doc_utils/jumpstart.html#).\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "beddd407", - "metadata": {}, - "outputs": [], - "source": [ - "model_id, model_version, = (\n", - " \"pytorch-ic-mobilenet-v2\",\n", - " \"*\",\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "74fb179e", - "metadata": {}, - "source": [ - "***\n", - "[Optional] Select a different JumpStart model. Here, we download jumpstart model_manifest file from the jumpstart s3 bucket, filter-out all the Image Classification models and select a model for inference.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0f9b3dee", - "metadata": {}, - "outputs": [], - "source": [ - "import IPython\n", - "from ipywidgets import Dropdown\n", - "\n", - "# download JumpStart model_manifest file.\n", - "boto3.client(\"s3\").download_file(\n", - " f\"jumpstart-cache-prod-{aws_region}\", \"models_manifest.json\", \"models_manifest.json\"\n", - ")\n", - "with open(\"models_manifest.json\", \"rb\") as json_file:\n", - " model_list = json.load(json_file)\n", - "\n", - "# filter-out all the Image Classification models from the manifest list.\n", - "ic_models_all_versions, ic_models = [\n", - " model[\"model_id\"] for model in model_list if \"-ic-\" in model[\"model_id\"]\n", - "], []\n", - "[ic_models.append(model) for model in ic_models_all_versions if model not in ic_models]\n", - "\n", - "# display the model-ids in a dropdown, for user to select a model.\n", - "dropdown = Dropdown(\n", - " options=ic_models,\n", - " value=model_id,\n", - " description=\"JumpStart Image Classification Models:\",\n", - " style={\"description_width\": \"initial\"},\n", - " layout={\"width\": \"max-content\"},\n", - ")\n", - "display(IPython.display.Markdown(\"## Select a JumpStart pre-trained model from the dropdown below\"))\n", - "display(dropdown)" - ] - }, - { - "cell_type": "markdown", - "id": "70350786", - "metadata": {}, - "source": [ - "## 3. Run inference on the pre-trained model\n", - "***\n", - "Using JumpStart, we can perform inference on the pre-trained model, even without fine-tuning it first on a custom dataset. For this example, that means on an input image, predicting the class label from one of the 1000 classes of the ImageNet dataset. \n", - "[ImageNetLabels](https://storage.googleapis.com/download.tensorflow.org/data/ImageNetLabels.txt).\n", - "***" - ] - }, - { - "cell_type": "markdown", - "id": "377bb1b4", - "metadata": {}, - "source": [ - "### 3.1. Retrieve JumpStart Artifacts & Deploy an Endpoint\n", - "***\n", - "We retrieve the deploy_image_uri, deploy_source_uri, and base_model_uri for the pre-trained model. To host the pre-trained base-model, we create an instance of [`sagemaker.model.Model`](https://sagemaker.readthedocs.io/en/stable/api/inference/model.html) and deploy it.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "37f9df4f", - "metadata": {}, - "outputs": [], - "source": [ - "from sagemaker import image_uris, model_uris, script_uris\n", - "from sagemaker.model import Model\n", - "from sagemaker.predictor import Predictor\n", - "from sagemaker.utils import name_from_base\n", - "\n", - "# model_version=\"*\" fetches the latest version of the model.\n", - "infer_model_id, infer_model_version = dropdown.value, \"*\"\n", - "\n", - "endpoint_name = name_from_base(f\"jumpstart-example-{infer_model_id}\")\n", - "\n", - "inference_instance_type = \"ml.m5.xlarge\"\n", - "\n", - "# Retrieve the inference docker container uri.\n", - "deploy_image_uri = image_uris.retrieve(\n", - " region=None,\n", - " framework=None,\n", - " image_scope=\"inference\",\n", - " model_id=infer_model_id,\n", - " model_version=infer_model_version,\n", - " instance_type=inference_instance_type,\n", - ")\n", - "# Retrieve the inference script uri.\n", - "deploy_source_uri = script_uris.retrieve(\n", - " model_id=infer_model_id, model_version=infer_model_version, script_scope=\"inference\"\n", - ")\n", - "# Retrieve the base model uri.\n", - "base_model_uri = model_uris.retrieve(\n", - " model_id=infer_model_id, model_version=infer_model_version, model_scope=\"inference\"\n", - ")\n", - "# Create the SageMaker model instance. Note that we need to pass Predictor class when we deploy model through Model class,\n", - "# for being able to run inference through the sagemaker API.\n", - "model = Model(\n", - " image_uri=deploy_image_uri,\n", - " source_dir=deploy_source_uri,\n", - " model_data=base_model_uri,\n", - " entry_point=\"inference.py\",\n", - " role=aws_role,\n", - " predictor_cls=Predictor,\n", - " name=endpoint_name,\n", - ")\n", - "# deploy the Model.\n", - "base_model_predictor = model.deploy(\n", - " initial_instance_count=1,\n", - " instance_type=inference_instance_type,\n", - " endpoint_name=endpoint_name,\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "7ac82d63", - "metadata": {}, - "source": [ - "### 3.2. Download example images for inference\n", - "***\n", - "We download example images from the JumpStart S3 bucket.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4794a78a", - "metadata": {}, - "outputs": [], - "source": [ - "s3_bucket = f\"jumpstart-cache-prod-{aws_region}\"\n", - "key_prefix = \"inference-notebook-assets\"\n", - "\n", - "\n", - "def download_from_s3(images):\n", - " for filename, image_key in images.items():\n", - " boto3.client(\"s3\").download_file(s3_bucket, f\"{key_prefix}/{image_key}\", filename)\n", - "\n", - "\n", - "images = {\"img1.jpg\": \"cat.jpg\", \"img2.jpg\": \"dog.jpg\"}\n", - "download_from_s3(images)" - ] - }, - { - "cell_type": "markdown", - "id": "43b850bb", - "metadata": {}, - "source": [ - "### 3.3. Query endpoint and parse response\n", - "***\n", - "Input to the endpoint is a single image in binary format. Response from the endpoint is a dictionary containing the top-1 predicted class label, and a list of class probabilities.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ea209c5c", - "metadata": {}, - "outputs": [], - "source": [ - "from IPython.core.display import HTML\n", - "\n", - "\n", - "def predict_top_k_labels(probabilities, labels, k):\n", - " topk_prediction_ids = sorted(\n", - " range(len(probabilities)), key=lambda index: probabilities[index], reverse=True\n", - " )[:k]\n", - " topk_class_labels = \", \".join([labels[id] for id in topk_prediction_ids])\n", - " return topk_class_labels\n", - "\n", - "\n", - "for image_filename in images.keys():\n", - " with open(image_filename, \"rb\") as file:\n", - " img = file.read()\n", - " query_response = base_model_predictor.predict(\n", - " img, {\"ContentType\": \"application/x-image\", \"Accept\": \"application/json;verbose\"}\n", - " )\n", - " model_predictions = json.loads(query_response)\n", - " labels, probabilities = model_predictions[\"labels\"], model_predictions[\"probabilities\"]\n", - " top5_class_labels = predict_top_k_labels(probabilities, labels, 5)\n", - " display(\n", - " HTML(\n", - " f'{image_filename}'\n", - " f\"
Top-5 predictions: {top5_class_labels}
\"\n", - " )\n", - " )" - ] - }, - { - "cell_type": "markdown", - "id": "fccf0507", - "metadata": {}, - "source": [ - "### 3.4. Clean up the endpoint" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cacd546c", - "metadata": {}, - "outputs": [], - "source": [ - "# Delete the SageMaker endpoint and the attached resources\n", - "base_model_predictor.delete_model()\n", - "base_model_predictor.delete_endpoint()" - ] - }, - { - "cell_type": "markdown", - "id": "ba87d772", - "metadata": {}, - "source": [ - "## 4. Fine-tune the pre-trained model on a custom dataset\n", - "***\n", - "Previously, we saw how to run inference on a pre-trained model. Next, we discuss how a model can be fine-tuned to a custom dataset with any number of classes. \n", - "\n", - "The model available for fine-tuning attaches a classification layer to the corresponding feature extractor model available on TensorFlow/PyTorch hub, and initializes the layer parameters to random values. The output dimension of the classification layer\n", - "is determined based on the number of classes in the input data. The fine-tuning step fine-tunes the model parameters. The objective is to minimize classification error on the input data. The model returned by fine-tuning can be further deployed for inference. Below are the instructions for how the training data should be formatted for input to the model. \n", - "\n", - "- **Input:** A directory with as many sub-directories as the number of classes. \n", - " - Each sub-directory should have images belonging to that class in .jpg format. \n", - "- **Output:** A trained model that can be deployed for inference. \n", - " - A label mapping file is saved along with the trained model file on the s3 bucket. \n", - " \n", - "The input directory should look like below if \n", - "the training data contains images from two classes: roses and dandelion. The s3 path should look like\n", - "`s3://bucket_name/input_directory/`. Note the trailing `/` is required. The names of the folders and 'roses', 'dandelion', and the .jpg filenames\n", - "can be anything. The label mapping file that is saved along with the trained model on the s3 bucket maps the \n", - "folder names 'roses' and 'dandelion' to the indices in the list of class probabilities the model outputs.\n", - "The mapping follows alphabetical ordering of the folder names. In the example below, index 0 in the model output list\n", - "would correspond to 'dandelion' and index 1 would correspond to 'roses'.\n", - "\n", - " input_directory\n", - " |--roses\n", - " |--abc.jpg\n", - " |--def.jpg\n", - " |--dandelion\n", - " |--ghi.jpg\n", - " |--jkl.jpg\n", - "\n", - "We provide tf_flowers dataset as a default dataset for fine-tuning the model. \n", - "tf_flower comprises images of five types of flowers. \n", - "The dataset has been downloaded from [TensorFlow](https://www.tensorflow.org/datasets/catalog/tf_flowers). \n", - "[Apache 2.0 License](https://jumpstart-cache-prod-us-west-2.s3-us-west-2.amazonaws.com/licenses/Apache-License/LICENSE-2.0.txt).\n", - "Citation:\n", - "\n", - "@ONLINE {tfflowers,\n", - "author = \"The TensorFlow Team\",\n", - "title = \"Flowers\",\n", - "month = \"jan\",\n", - "year = \"2019\",\n", - "url = \"http://download.tensorflow.org/example_images/flower_photos.tgz\" }\n", - " source: [TensorFlow Hub](model_url). \n", - "***" - ] - }, - { - "cell_type": "markdown", - "id": "8c4685e5", - "metadata": {}, - "source": [ - "### 4.1. Retrieve JumpStart Training artifacts\n", - "***\n", - "Here, for the selected model, we retrieve the training docker container, the training algorithm source, the pre-trained base model, and a python dictionary of the training hyper-parameters that the algorithm accepts with their default values. Note that the model_version=\"*\" fetches the lates model. Also, we do need to specify the training_instance_type to fetch train_image_uri.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "055fad2c", - "metadata": {}, - "outputs": [], - "source": [ - "from sagemaker import image_uris, model_uris, script_uris, hyperparameters\n", - "\n", - "model_id, model_version = dropdown.value, \"*\"\n", - "training_instance_type = \"ml.p3.2xlarge\"\n", - "\n", - "# Retrieve the docker image\n", - "train_image_uri = image_uris.retrieve(\n", - " region=None,\n", - " framework=None,\n", - " model_id=model_id,\n", - " model_version=model_version,\n", - " image_scope=\"training\",\n", - " instance_type=training_instance_type,\n", - ")\n", - "# Retrieve the training script\n", - "train_source_uri = script_uris.retrieve(\n", - " model_id=model_id, model_version=model_version, script_scope=\"training\"\n", - ")\n", - "# Retrieve the pre-trained model tarball to further fine-tune\n", - "train_model_uri = model_uris.retrieve(\n", - " model_id=model_id, model_version=model_version, model_scope=\"training\"\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "980a7bb7", - "metadata": {}, - "source": [ - "### 4.2. Set Training parameters\n", - "***\n", - "Now that we are done with all the setup that is needed, we are ready to fine-tune our Image Classification model. To begin, let us create a [``sageMaker.estimator.Estimator``](https://sagemaker.readthedocs.io/en/stable/api/training/estimators.html) object. This estimator will launch the training job. \n", - "\n", - "There are two kinds of parameters that need to be set for training. \n", - "\n", - "The first one are the parameters for the training job. These include: (i) Training data path. This is S3 folder in which the input data is stored, (ii) Output path: This the s3 folder in which the training output is stored. (iii) Training instance type: This indicates the type of machine on which to run the training. Typically, we use GPU instances for these training. We defined the training instance type above to fetch the correct train_image_uri. \n", - "\n", - "The second set of parameters are algorithm specific training hyper-parameters.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a1b139cf", - "metadata": {}, - "outputs": [], - "source": [ - "# Sample training data is available in this bucket\n", - "training_data_bucket = f\"jumpstart-cache-prod-{aws_region}\"\n", - "training_data_prefix = \"training-datasets/tf_flowers/\"\n", - "\n", - "training_dataset_s3_path = f\"s3://{training_data_bucket}/{training_data_prefix}\"\n", - "\n", - "output_bucket = sess.default_bucket()\n", - "output_prefix = \"jumpstart-example-ic-training\"\n", - "\n", - "s3_output_location = f\"s3://{output_bucket}/{output_prefix}/output\"" - ] - }, - { - "cell_type": "markdown", - "id": "3bc33787", - "metadata": {}, - "source": [ - "***\n", - "For algorithm specific hyper-parameters, we start by fetching python dictionary of the training hyper-parameters that the algorithm accepts with their default values. This can then be overridden to custom values.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "319375f2", - "metadata": {}, - "outputs": [], - "source": [ - "from sagemaker import hyperparameters\n", - "\n", - "# Retrieve the default hyper-parameters for fine-tuning the model\n", - "hyperparameters = hyperparameters.retrieve_default(model_id=model_id, model_version=model_version)\n", - "\n", - "# [Optional] Override default hyperparameters with custom values\n", - "hyperparameters[\"epochs\"] = \"5\"\n", - "print(hyperparameters)" - ] - }, - { - "cell_type": "markdown", - "id": "ccb45366", - "metadata": {}, - "source": [ - "### 4.3. Train with Automatic Model Tuning ([HPO](https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning.html)) \n", - "***\n", - "Amazon SageMaker automatic model tuning, also known as hyperparameter tuning, finds the best version of a model by running many training jobs on your dataset using the algorithm and ranges of hyperparameters that you specify. It then chooses the hyperparameter values that result in a model that performs the best, as measured by a metric that you choose. We will use a [HyperparameterTuner](https://sagemaker.readthedocs.io/en/stable/api/training/tuner.html) object to interact with Amazon SageMaker hyperparameter tuning APIs.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "17eec8fe", - "metadata": { - "collapsed": false, - "jupyter": { - "outputs_hidden": false - }, - "pycharm": { - "name": "#%%\n" - } - }, - "outputs": [], - "source": [ - "from sagemaker.tuner import ContinuousParameter\n", - "\n", - "# Use AMT for tuning and selecting the best model\n", - "use_amt = True\n", - "\n", - "# Define objective metric per framework, based on which the best model will be selected.\n", - "metric_definitions_per_model = {\n", - " \"tensorflow\": {\n", - " \"metrics\": [{\"Name\": \"val_accuracy\", \"Regex\": \"val_accuracy: ([0-9\\\\.]+)\"}],\n", - " \"type\": \"Maximize\",\n", - " },\n", - " \"pytorch\": {\n", - " \"metrics\": [{\"Name\": \"val_accuracy\", \"Regex\": \"val Acc: ([0-9\\\\.]+)\"}],\n", - " \"type\": \"Maximize\",\n", - " },\n", - "}\n", - "\n", - "# You can select from the hyperparameters supported by the model, and configure ranges of values to be searched for training the optimal model.(https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-define-ranges.html)\n", - "hyperparameter_ranges = {\n", - " \"adam-learning-rate\": ContinuousParameter(0.0001, 0.1, scaling_type=\"Logarithmic\")\n", - "}\n", - "\n", - "# Increase the total number of training jobs run by AMT, for increased accuracy (and training time).\n", - "max_jobs = 6\n", - "# Change parallel training jobs run by AMT to reduce total training time, constrained by your account limits.\n", - "# if max_jobs=max_parallel_jobs then Bayesian search turns to Random.\n", - "max_parallel_jobs = 2" - ] - }, - { - "cell_type": "markdown", - "id": "29efea24", - "metadata": {}, - "source": [ - "### 4.4. Start Training\n", - "***\n", - "We start by creating the estimator object with all the required assets and then launch the training job.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1b28c00e", - "metadata": {}, - "outputs": [], - "source": [ - "from sagemaker.estimator import Estimator\n", - "from sagemaker.utils import name_from_base\n", - "from sagemaker.tuner import HyperparameterTuner\n", - "\n", - "training_job_name = name_from_base(f\"jumpstart-example-{model_id}-transfer-learning\")\n", - "\n", - "# Create SageMaker Estimator instance\n", - "ic_estimator = Estimator(\n", - " role=aws_role,\n", - " image_uri=train_image_uri,\n", - " source_dir=train_source_uri,\n", - " model_uri=train_model_uri,\n", - " entry_point=\"transfer_learning.py\",\n", - " instance_count=1,\n", - " instance_type=training_instance_type,\n", - " max_run=360000,\n", - " hyperparameters=hyperparameters,\n", - " output_path=s3_output_location,\n", - " base_job_name=training_job_name,\n", - ")\n", - "\n", - "if use_amt:\n", - " metric_definitions = next(\n", - " value for key, value in metric_definitions_per_model.items() if model_id.startswith(key)\n", - " )\n", - "\n", - " hp_tuner = HyperparameterTuner(\n", - " ic_estimator,\n", - " metric_definitions[\"metrics\"][0][\"Name\"],\n", - " hyperparameter_ranges,\n", - " metric_definitions[\"metrics\"],\n", - " max_jobs=max_jobs,\n", - " max_parallel_jobs=max_parallel_jobs,\n", - " objective_type=metric_definitions[\"type\"],\n", - " base_tuning_job_name=training_job_name,\n", - " )\n", - "\n", - " # Launch a SageMaker Tuning job to search for the best hyperparameters\n", - " hp_tuner.fit({\"training\": training_dataset_s3_path})\n", - "else:\n", - " # Launch a SageMaker Training job by passing s3 path of the training data\n", - " ic_estimator.fit({\"training\": training_dataset_s3_path}, logs=True)" - ] - }, - { - "cell_type": "markdown", - "id": "f204360a", - "metadata": {}, - "source": [ - "## 4.5. Deploy & run Inference on the fine-tuned model\n", - "***\n", - "A trained model does nothing on its own. We now want to use the model to perform inference. For this example, that means predicting the class label of an image. We follow the same steps as in [3. Run inference on the pre-trained model](#3.-Run-inference-on-the-pre-trained-model). We start by retrieving the jumpstart artifacts for deploying an endpoint. However, instead of base_predictor, we deploy the `ic_estimator` that we fine-tuned.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bc80f9df", - "metadata": {}, - "outputs": [], - "source": [ - "inference_instance_type = \"ml.m5.xlarge\"\n", - "\n", - "# Retrieve the inference docker container uri\n", - "deploy_image_uri = image_uris.retrieve(\n", - " region=None,\n", - " framework=None,\n", - " image_scope=\"inference\",\n", - " model_id=model_id,\n", - " model_version=model_version,\n", - " instance_type=inference_instance_type,\n", - ")\n", - "# Retrieve the inference script uri\n", - "deploy_source_uri = script_uris.retrieve(\n", - " model_id=model_id, model_version=model_version, script_scope=\"inference\"\n", - ")\n", - "\n", - "endpoint_name = name_from_base(f\"jumpstart-example-FT-{model_id}-\")\n", - "\n", - "# Use the estimator from the previous step to deploy to a SageMaker endpoint\n", - "finetuned_predictor = (hp_tuner if use_amt else ic_estimator).deploy(\n", - " initial_instance_count=1,\n", - " instance_type=inference_instance_type,\n", - " entry_point=\"inference.py\",\n", - " image_uri=deploy_image_uri,\n", - " source_dir=deploy_source_uri,\n", - " endpoint_name=endpoint_name,\n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "d21775b6", - "metadata": {}, - "source": [ - "---\n", - "Next, we download example images of a rose and a sunflower from the S3 bucket for inference.\n", - "\n", - "---" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "540bb182", - "metadata": {}, - "outputs": [], - "source": [ - "s3_bucket = f\"jumpstart-cache-prod-{aws_region}\"\n", - "key_prefix = \"training-datasets/tf_flowers\"\n", - "\n", - "\n", - "def download_from_s3(images):\n", - " for filename, image_key in images.items():\n", - " boto3.client(\"s3\").download_file(s3_bucket, f\"{key_prefix}/{image_key}\", filename)\n", - "\n", - "\n", - "flower_images = {\n", - " \"img1.jpg\": \"roses/10503217854_e66a804309.jpg\",\n", - " \"img2.jpg\": \"sunflowers/1008566138_6927679c8a.jpg\",\n", - "}\n", - "download_from_s3(flower_images)" - ] - }, - { - "cell_type": "markdown", - "id": "0b3b8690", - "metadata": {}, - "source": [ - "---\n", - "Next, we query the fine-tuned model, parse the response and display the predictions.\n", - "\n", - "---" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a6ae862b", - "metadata": {}, - "outputs": [], - "source": [ - "from IPython.core.display import HTML\n", - "\n", - "for image_filename in flower_images.keys():\n", - " with open(image_filename, \"rb\") as file:\n", - " img = file.read()\n", - " query_response = finetuned_predictor.predict(\n", - " img, {\"ContentType\": \"application/x-image\", \"Accept\": \"application/json;verbose\"}\n", - " )\n", - " model_predictions = json.loads(query_response)\n", - " predicted_label = model_predictions[\"predicted_label\"]\n", - " display(\n", - " HTML(\n", - " f'{image_filename}'\n", - " f\"
Predicted Label: {predicted_label}
\"\n", - " )\n", - " )" - ] - }, - { - "cell_type": "markdown", - "id": "04b75fa6", - "metadata": {}, - "source": [ - "---\n", - "Next, we clean up the deployed endpoint.\n", - "\n", - "---" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0b374704", - "metadata": {}, - "outputs": [], - "source": [ - "# Delete the SageMaker endpoint and the attached resources\n", - "finetuned_predictor.delete_model()\n", - "finetuned_predictor.delete_endpoint()" - ] - }, - { - "cell_type": "markdown", - "id": "a9a55cbc", - "metadata": {}, - "source": [ - "## 4.6. Incrementally train the fine-tuned model\n", - "\n", - "***\n", - "Incremental training allows you to train a new model using an expanded dataset that contains an underlying pattern that was not accounted for in the previous training and which resulted in poor model performance. You can use the artifacts from an existing model and use an expanded dataset to train a new model. Incremental training saves both time and resources as you don’t need to retrain a model from scratch.\n", - "\n", - "One may use any dataset (old or new) as long as the dataset format remain the same (set of classes). Incremental training step is similar to the finetuning step discussed above with the following difference: In fine-tuning above, we start with a pre-trained model whereas in incremental training, we start with an existing fine-tuned model.\n", - "***" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "486ad1fb", - "metadata": {}, - "outputs": [], - "source": [ - "# Identify the previously trained model path based on the output location where artifacts are stored previously and the training job name.\n", - "\n", - "if use_amt: # If using amt, select the model for the best training job.\n", - " sage_client = boto3.Session().client(\"sagemaker\")\n", - " tuning_job_result = sage_client.describe_hyper_parameter_tuning_job(\n", - " HyperParameterTuningJobName=hp_tuner._current_job_name\n", - " )\n", - " last_training_job_name = tuning_job_result[\"BestTrainingJob\"][\"TrainingJobName\"]\n", - "else:\n", - " last_training_job_name = ic_estimator._current_job_name\n", - "\n", - "last_trained_model_path = f\"{s3_output_location}/{last_training_job_name}/output/model.tar.gz\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "62440511", - "metadata": {}, - "outputs": [], - "source": [ - "incremental_train_output_prefix = \"jumpstart-example-ic-incremental-training\"\n", - "\n", - "incremental_s3_output_location = f\"s3://{output_bucket}/{incremental_train_output_prefix}/output\"\n", - "\n", - "incremental_training_job_name = name_from_base(f\"jumpstart-example-{model_id}-incremental-training\")\n", - "\n", - "incremental_train_estimator = Estimator(\n", - " role=aws_role,\n", - " image_uri=train_image_uri,\n", - " source_dir=train_source_uri,\n", - " model_uri=last_trained_model_path,\n", - " entry_point=\"transfer_learning.py\",\n", - " instance_count=1,\n", - " instance_type=training_instance_type,\n", - " max_run=360000,\n", - " hyperparameters=hyperparameters,\n", - " output_path=incremental_s3_output_location,\n", - " base_job_name=incremental_training_job_name,\n", - ")\n", - "\n", - "incremental_train_estimator.fit({\"training\": training_dataset_s3_path}, logs=True)" - ] - }, - { - "cell_type": "markdown", - "id": "6a1c7ab6", - "metadata": {}, - "source": [ - "Once trained, we can use the same steps as in [Deploy & run Inference on the fine-tuned model](#4.5.-Deploy-&-run-Inference-on-the-fine-tuned-model) to deploy the model." - ] - } - ], - "metadata": { - "instance_type": "ml.t3.medium", - "kernelspec": { - "display_name": "conda_python3", - "language": "python", - "name": "conda_python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.13" - }, - "pycharm": { - "stem_cell": { - "cell_type": "raw", - "metadata": { - "collapsed": false - }, - "source": [] - } - } - }, - "nbformat": 4, - "nbformat_minor": 5 - } - \ No newline at end of file diff --git a/test_output.txt b/test_output.txt deleted file mode 100644 index 725132cea8..0000000000 --- a/test_output.txt +++ /dev/null @@ -1,570 +0,0 @@ -GLOB sdist-make: /local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/setup.py -py37 create: /local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37 -py37 installdeps: .[test] -py37 inst: /local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/.tmp/package/1/sagemaker-2.121.3.dev0.zip -py37 installed: alembic==1.8.1,anyio==3.6.2,apache-airflow==2.4.1,apache-airflow-providers-amazon==4.0.0,apache-airflow-providers-common-sql==1.3.1,apache-airflow-providers-ftp==3.2.0,apache-airflow-providers-http==4.1.0,apache-airflow-providers-imap==3.1.0,apache-airflow-providers-sqlite==3.3.1,apispec==3.3.2,argcomplete==2.0.0,asn1crypto==1.5.1,attrs==22.1.0,awslogs==0.14.0,Babel==2.11.0,bcrypt==4.0.1,beautifulsoup4==4.11.1,black==22.3.0,blinker==1.5,boto3==1.26.29,botocore==1.29.29,cached-property==1.5.2,cachelib==0.9.0,cattrs==22.2.0,certifi==2022.12.7,cffi==1.15.1,charset-normalizer==2.0.12,click==8.1.3,clickclick==20.10.2,colorama==0.4.6,colorlog==4.8.0,commonmark==0.9.1,ConfigUpdater==3.1.1,connexion==2.14.1,contextlib2==21.6.0,coverage==6.1.2,cron-descriptor==1.2.32,croniter==1.3.8,cryptography==38.0.4,decorator==5.1.1,Deprecated==1.2.13,dill==0.3.6,distlib==0.3.6,distro==1.8.0,dnspython==2.2.1,docker==6.0.1,docker-compose==1.29.2,dockerpty==0.4.1,docopt==0.6.2,docutils==0.19,email-validator==1.3.0,exceptiongroup==1.0.4,execnet==1.9.0,fabric==2.6.0,filelock==3.8.2,flake8==4.0.1,Flask==2.2.2,Flask-AppBuilder==4.1.3,Flask-Babel==2.0.0,Flask-Caching==2.0.1,Flask-JWT-Extended==4.4.4,Flask-Login==0.6.2,Flask-Session==0.4.0,Flask-SQLAlchemy==2.5.1,Flask-WTF==0.15.1,google-pasta==0.2.0,graphviz==0.20.1,greenlet==2.0.1,gunicorn==20.1.0,h11==0.14.0,httpcore==0.16.2,httpx==0.23.1,idna==3.4,importlib-metadata==4.2.0,importlib-resources==5.10.1,inflection==0.5.1,iniconfig==1.1.1,invoke==1.7.3,itsdangerous==2.1.2,Jinja2==3.0.3,jmespath==0.10.0,jsonpath-ng==1.5.3,jsonschema==3.2.0,lazy-object-proxy==1.8.0,linkify-it-py==2.0.0,lockfile==0.12.2,lxml==4.9.2,Mako==1.2.4,Markdown==3.3.5,markdown-it-py==2.1.0,MarkupSafe==2.1.1,marshmallow==3.19.0,marshmallow-enum==1.5.1,marshmallow-oneofschema==3.0.1,marshmallow-sqlalchemy==0.26.1,mccabe==0.6.1,mdit-py-plugins==0.3.3,mdurl==0.1.2,mock==4.0.3,multiprocess==0.70.14,mypy-boto3-rds==1.26.29,mypy-boto3-redshift-data==1.26.0.post1,mypy-extensions==0.4.3,numpy==1.21.6,packaging==22.0,pandas==1.3.5,paramiko==2.12.0,pathlib2==2.3.7.post1,pathos==0.3.0,pathspec==0.9.0,pendulum==2.1.2,platformdirs==2.6.0,pluggy==1.0.0,ply==3.11,pox==0.3.2,ppft==1.7.6.6,prison==0.2.1,protobuf==3.20.3,protobuf3-to-dict==0.1.5,psutil==5.9.4,py==1.11.0,pycodestyle==2.8.0,pycparser==2.21,pyflakes==2.4.0,Pygments==2.13.0,PyJWT==2.6.0,PyNaCl==1.5.0,pyrsistent==0.19.2,pytest==6.2.5,pytest-cov==3.0.0,pytest-forked==1.4.0,pytest-rerunfailures==10.2,pytest-timeout==2.1.0,pytest-xdist==2.4.0,python-daemon==2.3.2,python-dateutil==2.8.2,python-dotenv==0.21.0,python-nvd3==0.15.0,python-slugify==7.0.0,pytz==2022.6,pytzdata==2020.1,PyYAML==5.4.1,redshift-connector==2.0.909,requests==2.27.1,requests-toolbelt==0.10.1,rfc3986==1.5.0,rich==12.6.0,s3transfer==0.6.0,sagemaker @ file:///local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/.tmp/package/1/sagemaker-2.121.3.dev0.zip,sagemaker-experiments==0.1.35,schema==0.7.5,scipy==1.7.3,scramp==1.4.4,setproctitle==1.3.2,six==1.16.0,smdebug-rulesconfig==1.0.1,sniffio==1.3.0,soupsieve==2.3.2.post1,SQLAlchemy==1.4.45,SQLAlchemy-JSONField==1.0.0,sqlalchemy-redshift==0.8.12,SQLAlchemy-Utils==0.38.3,sqlparse==0.4.3,stopit==1.1.2,swagger-ui-bundle==0.0.9,tabulate==0.9.0,tenacity==8.1.0,termcolor==2.1.1,text-unidecode==1.3,texttable==1.6.7,toml==0.10.2,tomli==2.0.1,tox==3.24.5,typed-ast==1.5.4,typing_extensions==4.4.0,uc-micro-py==1.0.1,unicodecsv==0.14.1,urllib3==1.26.8,virtualenv==20.16.2,watchtower==2.0.1,websocket-client==0.59.0,Werkzeug==2.2.2,wrapt==1.14.1,WTForms==2.3.3,zipp==3.11.0 -py37 run-test-pre: PYTHONHASHSEED='42' -py37 run-test: commands[0] | python -c 'import os; os.system('"'"'install-custom-pkgs --install-boto-wheels'"'"')' -sh: install-custom-pkgs: command not found -py37 run-test: commands[1] | pip install apache-airflow==2.4.1 --constraint https://raw.githubusercontent.com/apache/airflow/constraints-2.4.1/constraints-3.10.txt -Looking in indexes: https://aws:****@amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/ -Requirement already satisfied: apache-airflow==2.4.1 in ./.tox/py37/lib/python3.7/site-packages (2.4.1) -Collecting apache-airflow-providers-imap - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/apache-airflow-providers-imap/3.0.0/apache_airflow_providers_imap-3.0.0-py3-none-any.whl (16 kB) -Collecting jinja2>=2.10.1 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/jinja2/3.1.2/Jinja2-3.1.2-py3-none-any.whl (133 kB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 628.6 kB/s eta 0:00:00 -Requirement already satisfied: itsdangerous>=2.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.1.2) -Collecting dill>=0.2.2 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/dill/0.3.1.1/dill-0.3.1.1.tar.gz (151 kB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 152.0/152.0 kB 709.8 kB/s eta 0:00:00 - Preparing metadata (setup.py): started - Preparing metadata (setup.py): finished with status 'done' -Requirement already satisfied: python-nvd3>=0.15.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (0.15.0) -Requirement already satisfied: deprecated>=1.2.13 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (1.2.13) -Requirement already satisfied: flask-login>=0.6.2 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (0.6.2) -Collecting lazy-object-proxy - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/lazy-object-proxy/1.7.1/lazy_object_proxy-1.7.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (57 kB) -Requirement already satisfied: markdown-it-py>=2.1.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.1.0) -Requirement already satisfied: connexion[flask,swagger-ui]>=2.10.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.14.1) -Collecting apache-airflow-providers-http - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/apache-airflow-providers-http/4.0.0/apache_airflow_providers_http-4.0.0-py3-none-any.whl (21 kB) -Requirement already satisfied: blinker in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (1.5) -Collecting httpx - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/httpx/0.23.0/httpx-0.23.0-py3-none-any.whl (84 kB) -Requirement already satisfied: pendulum>=2.0 in ./.tox/py37/lib64/python3.7/site-packages (from apache-airflow==2.4.1) (2.1.2) -Requirement already satisfied: configupdater>=3.1.1 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (3.1.1) -Requirement already satisfied: marshmallow-oneofschema>=2.0.1 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (3.0.1) -Collecting mdit-py-plugins>=0.3.0 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/mdit-py-plugins/0.3.1/mdit_py_plugins-0.3.1-py3-none-any.whl (46 kB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.5/46.5 kB 7.1 MB/s eta 0:00:00 -Requirement already satisfied: gunicorn>=20.1.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (20.1.0) -Requirement already satisfied: unicodecsv>=0.14.1 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (0.14.1) -Collecting apache-airflow-providers-sqlite - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/apache-airflow-providers-sqlite/3.2.1/apache_airflow_providers_sqlite-3.2.1-py3-none-any.whl (14 kB) -Requirement already satisfied: alembic<2.0,>=1.5.1 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (1.8.1) -Collecting python-daemon>=2.2.4 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/python-daemon/2.3.1/python_daemon-2.3.1-py2.py3-none-any.whl (34 kB) -Requirement already satisfied: flask-appbuilder==4.1.3 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (4.1.3) -Requirement already satisfied: linkify-it-py>=2.0.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.0.0) -Requirement already satisfied: attrs>=22.1.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (22.1.0) -Requirement already satisfied: tenacity>=6.2.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (8.1.0) -Requirement already satisfied: colorlog<5.0,>=4.0.2 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (4.8.0) -Requirement already satisfied: flask<2.3,>=2.2 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.2.2) -Collecting cron-descriptor>=1.2.24 - Using cached cron_descriptor-1.2.31-py3-none-any.whl -Collecting rich>=12.4.4 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/rich/12.5.1/rich-12.5.1-py3-none-any.whl (235 kB) -Collecting python-slugify>=5.0 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/python-slugify/6.1.2/python_slugify-6.1.2-py2.py3-none-any.whl (9.4 kB) -Requirement already satisfied: lockfile>=0.12.2 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (0.12.2) -Collecting pyjwt>=2.0.0 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/pyjwt/2.5.0/PyJWT-2.5.0-py3-none-any.whl (20 kB) -Collecting termcolor>=1.1.0 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/termcolor/2.0.1/termcolor-2.0.1-py3-none-any.whl (5.4 kB) -Requirement already satisfied: werkzeug>=2.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.2.2) -Collecting apache-airflow-providers-ftp - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/apache-airflow-providers-ftp/3.1.0/apache_airflow_providers_ftp-3.1.0-py3-none-any.whl (16 kB) -Collecting cattrs>=22.1.0 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/cattrs/22.1.0/cattrs-22.1.0-py3-none-any.whl (33 kB) -Collecting sqlalchemy>=1.4 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/sqlalchemy/1.4.27/SQLAlchemy-1.4.27-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 1.3 MB/s eta 0:00:00 -Requirement already satisfied: importlib-resources>=5.2 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (5.10.1) -Requirement already satisfied: pygments>=2.0.1 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.13.0) -Requirement already satisfied: flask-session>=0.4.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (0.4.0) -Requirement already satisfied: flask-caching>=1.5.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.0.1) -Requirement already satisfied: setproctitle>=1.1.8 in ./.tox/py37/lib64/python3.7/site-packages (from apache-airflow==2.4.1) (1.3.2) -Requirement already satisfied: graphviz>=0.12 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (0.20.1) -Requirement already satisfied: argcomplete>=1.10 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.0.0) -Collecting jsonschema>=3.2.0 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/jsonschema/4.16.0/jsonschema-4.16.0-py3-none-any.whl (83 kB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.1/83.1 kB 15.1 MB/s eta 0:00:00 -Collecting importlib-metadata>=1.7 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/importlib-metadata/4.12.0/importlib_metadata-4.12.0-py3-none-any.whl (21 kB) -Collecting cryptography>=0.9.3 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/cryptography/36.0.2/cryptography-36.0.2-cp36-abi3-manylinux_2_24_x86_64.whl (3.6 MB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 3.2 MB/s eta 0:00:00 -Requirement already satisfied: sqlalchemy-jsonfield>=1.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (1.0.0) -Requirement already satisfied: cached-property>=1.5.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (1.5.2) -Requirement already satisfied: flask-wtf>=0.15 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (0.15.1) -Requirement already satisfied: pathspec~=0.9.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (0.9.0) -Collecting typing-extensions>=4.0.0 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/typing-extensions/4.3.0/typing_extensions-4.3.0-py3-none-any.whl (25 kB) -Collecting psutil>=4.2.0 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/psutil/5.9.2/psutil-5.9.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (281 kB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 281.3/281.3 kB 24.8 MB/s eta 0:00:00 -Collecting packaging>=14.0 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/packaging/21.3/packaging-21.3-py3-none-any.whl (40 kB) -Collecting tabulate>=0.7.5 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/tabulate/0.8.10/tabulate-0.8.10-py3-none-any.whl (29 kB) -Collecting apache-airflow-providers-common-sql - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/apache-airflow-providers-common-sql/1.2.0/apache_airflow_providers_common_sql-1.2.0-py3-none-any.whl (28 kB) -Requirement already satisfied: pluggy>=1.0 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (1.0.0) -Collecting croniter>=0.3.17 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/croniter/1.3.7/croniter-1.3.7-py2.py3-none-any.whl (17 kB) -Collecting markdown>=3.0 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/markdown/3.4.1/Markdown-3.4.1-py3-none-any.whl (93 kB) -Requirement already satisfied: python-dateutil>=2.3 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow==2.4.1) (2.8.2) -Requirement already satisfied: markupsafe>=1.1.1 in ./.tox/py37/lib64/python3.7/site-packages (from apache-airflow==2.4.1) (2.1.1) -Requirement already satisfied: sqlalchemy-utils<1,>=0.32.21 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (0.38.3) -Requirement already satisfied: prison<1.0.0,>=0.2.1 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (0.2.1) -Collecting marshmallow<4,>=3 - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/marshmallow/3.18.0/marshmallow-3.18.0-py3-none-any.whl (48 kB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.8/48.8 kB 8.8 MB/s eta 0:00:00 -Collecting colorama<1,>=0.3.9 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/colorama/0.4.5/colorama-0.4.5-py2.py3-none-any.whl (16 kB) -Requirement already satisfied: apispec[yaml]<4,>=3.3 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (3.3.2) -Requirement already satisfied: marshmallow-sqlalchemy<0.27.0,>=0.22.0 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (0.26.1) -Requirement already satisfied: click<9,>=8 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (8.1.3) -Requirement already satisfied: Flask-JWT-Extended<5.0.0,>=4.0.0 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (4.4.4) -Requirement already satisfied: Flask-Babel<3,>=1 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (2.0.0) -Requirement already satisfied: Flask-SQLAlchemy<3,>=2.4 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (2.5.1) -Requirement already satisfied: marshmallow-enum<2,>=1.5.1 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (1.5.1) -Requirement already satisfied: email-validator<2,>=1.0.5 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (1.3.0) -Requirement already satisfied: WTForms<3.0.0 in ./.tox/py37/lib/python3.7/site-packages (from flask-appbuilder==4.1.3->apache-airflow==2.4.1) (2.3.3) -Collecting Mako - Downloading https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/mako/1.2.3/Mako-1.2.3-py3-none-any.whl (78 kB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.7/78.7 kB 13.6 MB/s eta 0:00:00 -Collecting exceptiongroup - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/exceptiongroup/1.0.0rc9/exceptiongroup-1.0.0rc9-py3-none-any.whl (12 kB) -Requirement already satisfied: inflection<0.6,>=0.3.1 in ./.tox/py37/lib/python3.7/site-packages (from connexion[flask,swagger-ui]>=2.10.0->apache-airflow==2.4.1) (0.5.1) -Collecting PyYAML<7,>=5.1 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/pyyaml/6.0/PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (596 kB) -Collecting requests<3,>=2.9.1 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/requests/2.28.1/requests-2.28.1-py3-none-any.whl (62 kB) -Requirement already satisfied: clickclick<21,>=1.2 in ./.tox/py37/lib/python3.7/site-packages (from connexion[flask,swagger-ui]>=2.10.0->apache-airflow==2.4.1) (20.10.2) -Requirement already satisfied: swagger-ui-bundle<0.1,>=0.0.2 in ./.tox/py37/lib/python3.7/site-packages (from connexion[flask,swagger-ui]>=2.10.0->apache-airflow==2.4.1) (0.0.9) -Requirement already satisfied: cffi>=1.12 in ./.tox/py37/lib64/python3.7/site-packages (from cryptography>=0.9.3->apache-airflow==2.4.1) (1.15.1) -Requirement already satisfied: wrapt<2,>=1.10 in ./.tox/py37/lib64/python3.7/site-packages (from deprecated>=1.2.13->apache-airflow==2.4.1) (1.14.1) -Requirement already satisfied: cachelib>=0.9.0 in ./.tox/py37/lib/python3.7/site-packages (from flask-caching>=1.5.0->apache-airflow==2.4.1) (0.9.0) -Requirement already satisfied: setuptools>=3.0 in ./.tox/py37/lib/python3.7/site-packages (from gunicorn>=20.1.0->apache-airflow==2.4.1) (65.5.1) -Collecting zipp>=0.5 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/zipp/3.8.1/zipp-3.8.1-py3-none-any.whl (5.6 kB) -Collecting pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/pyrsistent/0.18.1/pyrsistent-0.18.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (117 kB) -Collecting pkgutil-resolve-name>=1.3.10 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/pkgutil-resolve-name/1.3.10/pkgutil_resolve_name-1.3.10-py3-none-any.whl (4.7 kB) -Requirement already satisfied: uc-micro-py in ./.tox/py37/lib/python3.7/site-packages (from linkify-it-py>=2.0.0->apache-airflow==2.4.1) (1.0.1) -Requirement already satisfied: mdurl~=0.1 in ./.tox/py37/lib/python3.7/site-packages (from markdown-it-py>=2.1.0->apache-airflow==2.4.1) (0.1.2) -Collecting pyparsing!=3.0.5,>=2.0.2 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/pyparsing/3.0.9/pyparsing-3.0.9-py3-none-any.whl (98 kB) -Requirement already satisfied: pytzdata>=2020.1 in ./.tox/py37/lib/python3.7/site-packages (from pendulum>=2.0->apache-airflow==2.4.1) (2020.1) -Requirement already satisfied: docutils in ./.tox/py37/lib/python3.7/site-packages (from python-daemon>=2.2.4->apache-airflow==2.4.1) (0.19) -Requirement already satisfied: six>=1.5 in ./.tox/py37/lib/python3.7/site-packages (from python-dateutil>=2.3->apache-airflow==2.4.1) (1.16.0) -Requirement already satisfied: text-unidecode>=1.3 in ./.tox/py37/lib/python3.7/site-packages (from python-slugify>=5.0->apache-airflow==2.4.1) (1.3) -Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in ./.tox/py37/lib/python3.7/site-packages (from rich>=12.4.4->apache-airflow==2.4.1) (0.9.1) -Collecting greenlet!=0.4.17 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/greenlet/1.1.3/greenlet-1.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (150 kB) -Requirement already satisfied: sqlparse>=0.4.2 in ./.tox/py37/lib/python3.7/site-packages (from apache-airflow-providers-common-sql->apache-airflow==2.4.1) (0.4.3) -Collecting requests-toolbelt - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/requests-toolbelt/0.9.1/requests_toolbelt-0.9.1-py2.py3-none-any.whl (54 kB) -Collecting certifi - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/certifi/2022.9.24/certifi-2022.9.24-py3-none-any.whl (161 kB) -Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in ./.tox/py37/lib/python3.7/site-packages (from httpx->apache-airflow==2.4.1) (1.5.0) -Requirement already satisfied: sniffio in ./.tox/py37/lib/python3.7/site-packages (from httpx->apache-airflow==2.4.1) (1.3.0) -Collecting httpcore<0.16.0,>=0.15.0 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/httpcore/0.15.0/httpcore-0.15.0-py3-none-any.whl (68 kB) -Requirement already satisfied: pycparser in ./.tox/py37/lib/python3.7/site-packages (from cffi>=1.12->cryptography>=0.9.3->apache-airflow==2.4.1) (2.21) -Requirement already satisfied: dnspython>=1.15.0 in ./.tox/py37/lib/python3.7/site-packages (from email-validator<2,>=1.0.5->flask-appbuilder==4.1.3->apache-airflow==2.4.1) (2.2.1) -Requirement already satisfied: idna>=2.0.0 in ./.tox/py37/lib/python3.7/site-packages (from email-validator<2,>=1.0.5->flask-appbuilder==4.1.3->apache-airflow==2.4.1) (3.4) -Collecting pytz - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/pytz/2022.2.1/pytz-2022.2.1-py2.py3-none-any.whl (500 kB) -Collecting Babel>=2.3 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/babel/2.10.3/Babel-2.10.3-py3-none-any.whl (9.5 MB) -Collecting anyio==3.* - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/anyio/3.6.1/anyio-3.6.1-py3-none-any.whl (80 kB) -Collecting h11<0.13,>=0.11 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/h11/0.12.0/h11-0.12.0-py3-none-any.whl (54 kB) -Collecting urllib3<1.27,>=1.21.1 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/urllib3/1.26.12/urllib3-1.26.12-py2.py3-none-any.whl (140 kB) -Collecting charset-normalizer<3,>=2 - Using cached https://amazon-149122183214.d.codeartifact.us-west-2.amazonaws.com/pypi/sagemaker-studio-shared/simple/charset-normalizer/2.1.1/charset_normalizer-2.1.1-py3-none-any.whl (39 kB) -Building wheels for collected packages: dill - Building wheel for dill (setup.py): started - Building wheel for dill (setup.py): finished with status 'done' - Created wheel for dill: filename=dill-0.3.1.1-py3-none-any.whl size=78545 sha256=e4f30321ce7b6b5666824cb84c48dcb8ab016bac305918c0c8acf13665390e27 - Stored in directory: /local/home/evakravi/.cache/pip/wheels/76/94/4d/51536c198534e76da2d01d34417a5ed135b4d353bdfacdb1ce -Successfully built dill -Installing collected packages: pytz, cron-descriptor, zipp, urllib3, typing-extensions, termcolor, tabulate, PyYAML, python-slugify, python-daemon, pyrsistent, pyparsing, pyjwt, psutil, pkgutil-resolve-name, lazy-object-proxy, jinja2, h11, greenlet, exceptiongroup, dill, colorama, charset-normalizer, certifi, Babel, apache-airflow-providers-imap, apache-airflow-providers-ftp, apache-airflow-providers-common-sql, rich, requests, packaging, importlib-metadata, cryptography, croniter, cattrs, apache-airflow-providers-sqlite, anyio, sqlalchemy, requests-toolbelt, mdit-py-plugins, marshmallow, markdown, Mako, jsonschema, httpcore, httpx, apache-airflow-providers-http - Attempting uninstall: pytz - Found existing installation: pytz 2022.6 - Uninstalling pytz-2022.6: - Successfully uninstalled pytz-2022.6 - Attempting uninstall: cron-descriptor - Found existing installation: cron-descriptor 1.2.32 - Uninstalling cron-descriptor-1.2.32: - Successfully uninstalled cron-descriptor-1.2.32 - Attempting uninstall: zipp - Found existing installation: zipp 3.11.0 - Uninstalling zipp-3.11.0: - Successfully uninstalled zipp-3.11.0 - Attempting uninstall: urllib3 - Found existing installation: urllib3 1.26.8 - Uninstalling urllib3-1.26.8: - Successfully uninstalled urllib3-1.26.8 - Attempting uninstall: typing-extensions - Found existing installation: typing_extensions 4.4.0 - Uninstalling typing_extensions-4.4.0: - Successfully uninstalled typing_extensions-4.4.0 - Attempting uninstall: termcolor - Found existing installation: termcolor 2.1.1 - Uninstalling termcolor-2.1.1: - Successfully uninstalled termcolor-2.1.1 - Attempting uninstall: tabulate - Found existing installation: tabulate 0.9.0 - Uninstalling tabulate-0.9.0: - Successfully uninstalled tabulate-0.9.0 - Attempting uninstall: PyYAML - Found existing installation: PyYAML 5.4.1 - Uninstalling PyYAML-5.4.1: - Successfully uninstalled PyYAML-5.4.1 - Attempting uninstall: python-slugify - Found existing installation: python-slugify 7.0.0 - Uninstalling python-slugify-7.0.0: - Successfully uninstalled python-slugify-7.0.0 - Attempting uninstall: python-daemon - Found existing installation: python-daemon 2.3.2 - Uninstalling python-daemon-2.3.2: - Successfully uninstalled python-daemon-2.3.2 - Attempting uninstall: pyrsistent - Found existing installation: pyrsistent 0.19.2 - Uninstalling pyrsistent-0.19.2: - Successfully uninstalled pyrsistent-0.19.2 - Attempting uninstall: pyjwt - Found existing installation: PyJWT 2.6.0 - Uninstalling PyJWT-2.6.0: - Successfully uninstalled PyJWT-2.6.0 - Attempting uninstall: psutil - Found existing installation: psutil 5.9.4 - Uninstalling psutil-5.9.4: - Successfully uninstalled psutil-5.9.4 - Attempting uninstall: lazy-object-proxy - Found existing installation: lazy-object-proxy 1.8.0 - Uninstalling lazy-object-proxy-1.8.0: - Successfully uninstalled lazy-object-proxy-1.8.0 - Attempting uninstall: jinja2 - Found existing installation: Jinja2 3.0.3 - Uninstalling Jinja2-3.0.3: - Successfully uninstalled Jinja2-3.0.3 - Attempting uninstall: h11 - Found existing installation: h11 0.14.0 - Uninstalling h11-0.14.0: - Successfully uninstalled h11-0.14.0 - Attempting uninstall: greenlet - Found existing installation: greenlet 2.0.1 - Uninstalling greenlet-2.0.1: - Successfully uninstalled greenlet-2.0.1 - Attempting uninstall: exceptiongroup - Found existing installation: exceptiongroup 1.0.4 - Uninstalling exceptiongroup-1.0.4: - Successfully uninstalled exceptiongroup-1.0.4 - Attempting uninstall: dill - Found existing installation: dill 0.3.6 - Uninstalling dill-0.3.6: - Successfully uninstalled dill-0.3.6 - Attempting uninstall: colorama - Found existing installation: colorama 0.4.6 - Uninstalling colorama-0.4.6: - Successfully uninstalled colorama-0.4.6 - Attempting uninstall: charset-normalizer - Found existing installation: charset-normalizer 2.0.12 - Uninstalling charset-normalizer-2.0.12: - Successfully uninstalled charset-normalizer-2.0.12 - Attempting uninstall: certifi - Found existing installation: certifi 2022.12.7 - Uninstalling certifi-2022.12.7: - Successfully uninstalled certifi-2022.12.7 - Attempting uninstall: Babel - Found existing installation: Babel 2.11.0 - Uninstalling Babel-2.11.0: - Successfully uninstalled Babel-2.11.0 - Attempting uninstall: apache-airflow-providers-imap - Found existing installation: apache-airflow-providers-imap 3.1.0 - Uninstalling apache-airflow-providers-imap-3.1.0: - Successfully uninstalled apache-airflow-providers-imap-3.1.0 - Attempting uninstall: apache-airflow-providers-ftp - Found existing installation: apache-airflow-providers-ftp 3.2.0 - Uninstalling apache-airflow-providers-ftp-3.2.0: - Successfully uninstalled apache-airflow-providers-ftp-3.2.0 - Attempting uninstall: apache-airflow-providers-common-sql - Found existing installation: apache-airflow-providers-common-sql 1.3.1 - Uninstalling apache-airflow-providers-common-sql-1.3.1: - Successfully uninstalled apache-airflow-providers-common-sql-1.3.1 - Attempting uninstall: rich - Found existing installation: rich 12.6.0 - Uninstalling rich-12.6.0: - Successfully uninstalled rich-12.6.0 - Attempting uninstall: requests - Found existing installation: requests 2.27.1 - Uninstalling requests-2.27.1: - Successfully uninstalled requests-2.27.1 - Attempting uninstall: packaging - Found existing installation: packaging 22.0 - Uninstalling packaging-22.0: - Successfully uninstalled packaging-22.0 - Attempting uninstall: importlib-metadata - Found existing installation: importlib-metadata 4.2.0 - Uninstalling importlib-metadata-4.2.0: - Successfully uninstalled importlib-metadata-4.2.0 - Attempting uninstall: cryptography - Found existing installation: cryptography 38.0.4 - Uninstalling cryptography-38.0.4: - Successfully uninstalled cryptography-38.0.4 - Attempting uninstall: croniter - Found existing installation: croniter 1.3.8 - Uninstalling croniter-1.3.8: - Successfully uninstalled croniter-1.3.8 - Attempting uninstall: cattrs - Found existing installation: cattrs 22.2.0 - Uninstalling cattrs-22.2.0: - Successfully uninstalled cattrs-22.2.0 - Attempting uninstall: apache-airflow-providers-sqlite - Found existing installation: apache-airflow-providers-sqlite 3.3.1 - Uninstalling apache-airflow-providers-sqlite-3.3.1: - Successfully uninstalled apache-airflow-providers-sqlite-3.3.1 - Attempting uninstall: anyio - Found existing installation: anyio 3.6.2 - Uninstalling anyio-3.6.2: - Successfully uninstalled anyio-3.6.2 - Attempting uninstall: sqlalchemy - Found existing installation: SQLAlchemy 1.4.45 - Uninstalling SQLAlchemy-1.4.45: - Successfully uninstalled SQLAlchemy-1.4.45 - Attempting uninstall: requests-toolbelt - Found existing installation: requests-toolbelt 0.10.1 - Uninstalling requests-toolbelt-0.10.1: - Successfully uninstalled requests-toolbelt-0.10.1 - Attempting uninstall: mdit-py-plugins - Found existing installation: mdit-py-plugins 0.3.3 - Uninstalling mdit-py-plugins-0.3.3: - Successfully uninstalled mdit-py-plugins-0.3.3 - Attempting uninstall: marshmallow - Found existing installation: marshmallow 3.19.0 - Uninstalling marshmallow-3.19.0: - Successfully uninstalled marshmallow-3.19.0 - Attempting uninstall: markdown - Found existing installation: Markdown 3.3.5 - Uninstalling Markdown-3.3.5: - Successfully uninstalled Markdown-3.3.5 - Attempting uninstall: Mako - Found existing installation: Mako 1.2.4 - Uninstalling Mako-1.2.4: - Successfully uninstalled Mako-1.2.4 - Attempting uninstall: jsonschema - Found existing installation: jsonschema 3.2.0 - Uninstalling jsonschema-3.2.0: - Successfully uninstalled jsonschema-3.2.0 - Attempting uninstall: httpcore - Found existing installation: httpcore 0.16.2 - Uninstalling httpcore-0.16.2: - Successfully uninstalled httpcore-0.16.2 - Attempting uninstall: httpx - Found existing installation: httpx 0.23.1 - Uninstalling httpx-0.23.1: - Successfully uninstalled httpx-0.23.1 - Attempting uninstall: apache-airflow-providers-http - Found existing installation: apache-airflow-providers-http 4.1.0 - Uninstalling apache-airflow-providers-http-4.1.0: - Successfully uninstalled apache-airflow-providers-http-4.1.0 -ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. -pathos 0.3.0 requires dill>=0.3.6, but you have dill 0.3.1.1 which is incompatible. -multiprocess 0.70.14 requires dill>=0.3.6, but you have dill 0.3.1.1 which is incompatible. -flake8 4.0.1 requires importlib-metadata<4.3; python_version < "3.8", but you have importlib-metadata 4.12.0 which is incompatible. -docker-compose 1.29.2 requires jsonschema<4,>=2.5.1, but you have jsonschema 4.16.0 which is incompatible. -docker-compose 1.29.2 requires PyYAML<6,>=3.10, but you have pyyaml 6.0 which is incompatible. -Successfully installed Babel-2.10.3 Mako-1.2.3 PyYAML-6.0 anyio-3.6.1 apache-airflow-providers-common-sql-1.2.0 apache-airflow-providers-ftp-3.1.0 apache-airflow-providers-http-4.0.0 apache-airflow-providers-imap-3.0.0 apache-airflow-providers-sqlite-3.2.1 cattrs-22.1.0 certifi-2022.9.24 charset-normalizer-2.1.1 colorama-0.4.5 cron-descriptor-1.2.31 croniter-1.3.7 cryptography-36.0.2 dill-0.3.1.1 exceptiongroup-1.0.0rc9 greenlet-1.1.3 h11-0.12.0 httpcore-0.15.0 httpx-0.23.0 importlib-metadata-4.12.0 jinja2-3.1.2 jsonschema-4.16.0 lazy-object-proxy-1.7.1 markdown-3.4.1 marshmallow-3.18.0 mdit-py-plugins-0.3.1 packaging-21.3 pkgutil-resolve-name-1.3.10 psutil-5.9.2 pyjwt-2.5.0 pyparsing-3.0.9 pyrsistent-0.18.1 python-daemon-2.3.1 python-slugify-6.1.2 pytz-2022.2.1 requests-2.28.1 requests-toolbelt-0.9.1 rich-12.5.1 sqlalchemy-1.4.27 tabulate-0.8.10 termcolor-2.0.1 typing-extensions-4.3.0 urllib3-1.26.12 zipp-3.8.1 -py37 run-test: commands[2] | pytest --cov=sagemaker --cov-append tests/unit --cov-report xml -============================= test session starts ============================== -platform linux -- Python 3.7.15, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -cachedir: .tox/py37/.pytest_cache -rootdir: /local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk, configfile: tox.ini -plugins: rerunfailures-10.2, cov-3.0.0, xdist-2.4.0, timeout-2.1.0, anyio-3.6.1, forked-1.4.0 -collected 10903 items - -tests/unit/test_algorithm.py ........................ [ 0%] -tests/unit/test_amazon_estimator.py ................... [ 0%] -tests/unit/test_analytics.py ......... [ 0%] -tests/unit/test_artifact_analytics.py . [ 0%] -tests/unit/test_chainer.py .............. [ 0%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 0%] -tests/unit/test_chainer.py .............. [ 0%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 0%] -tests/unit/test_chainer.py .............. [ 0%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 0%] -tests/unit/test_chainer.py .............. [ 1%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 1%] -tests/unit/test_chainer.py .............. [ 1%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 1%] -tests/unit/test_chainer.py .............. [ 1%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 1%] -tests/unit/test_chainer.py ............ [ 1%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 1%] -tests/unit/test_chainer.py ............ [ 1%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 1%] -tests/unit/test_chainer.py ............ [ 1%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 1%] -tests/unit/test_chainer.py ............ [ 1%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 1%] -tests/unit/test_chainer.py ............ [ 1%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 1%] -tests/unit/test_chainer.py ............ [ 2%] -tests/unit/sagemaker/image_uris/test_dlc_frameworks.py . [ 2%] -tests/unit/test_chainer.py ... [ 2%] -tests/unit/test_clarify.py ............................................. [ 2%] -. [ 2%] -tests/unit/test_common.py ...................... [ 2%] -tests/unit/test_create_deploy_entities.py ...... [ 2%] -tests/unit/test_default_bucket.py ....... [ 2%] -tests/unit/test_deprecations.py ................ [ 2%] -tests/unit/test_endpoint_from_job.py .. [ 2%] -tests/unit/test_endpoint_from_model_data.py ...... [ 3%] -tests/unit/test_estimator.py ........................................... [ 3%] -........................................................................ [ 4%] -........................................................................ [ 4%] -........ [ 4%] -tests/unit/test_exception_on_bad_status.py ....... [ 4%] -tests/unit/test_experiments_analytics.py ........ [ 4%] -tests/unit/test_fm.py .................................................. [ 5%] -... [ 5%] -tests/unit/test_fw_utils.py ............................................ [ 5%] -...................... [ 6%] -tests/unit/test_git_utils.py ..................... [ 6%] -tests/unit/test_hyperparameter.py ....... [ 6%] -tests/unit/test_image.py .......................... [ 6%] -tests/unit/test_init.py . [ 6%] -tests/unit/test_inputs.py ........ [ 6%] -tests/unit/test_ipinsights.py ..................................... [ 6%] -tests/unit/test_job.py ............................................... [ 7%] -tests/unit/test_kmeans.py ............................... [ 7%] -tests/unit/test_knn.py .......................... [ 7%] -tests/unit/test_lambda_helper.py .................ERROR: got KeyboardInterrupt signal - - -=============================== warnings summary =============================== -tests/unit/test_estimator.py::test_prepare_for_training_with_pipeline_name_in_s3_path_no_source_dir - /local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/sagemaker/workflow/pipeline_context.py:261: UserWarning: Running within a PipelineSession, there will be No Wait, No Logs, and No Job being started. - UserWarning, - -tests/unit/test_estimator.py::test_image_name_map - /local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/sagemaker/deprecations.py:53: DeprecationWarning: image_name has been renamed in sagemaker>=2. - See: https://sagemaker.readthedocs.io/en/stable/v2.html for details. - _warn(f"{phrase} has been renamed") - -tests/unit/test_estimator.py::test_all_framework_estimators_add_jumpstart_tags -tests/unit/test_estimator.py::test_all_framework_estimators_add_jumpstart_base_name - /local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/sagemaker/deprecations.py:44: DeprecationWarning: update_endpoint is a no-op in sagemaker>=2. - See: https://sagemaker.readthedocs.io/en/stable/v2.html for details. - _warn(f"{phrase} is a no-op", sdk_version) - -tests/unit/test_git_utils.py::test_git_clone_repo_with_token_2fa - /local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/sagemaker/git_utils.py:216: UserWarning: Using token for authentication, other credentials will be ignored. - warnings.warn("Using token for authentication, " "other credentials will be ignored.") - --- Docs: https://docs.pytest.org/en/stable/warnings.html -================= 879 passed, 5 warnings in 198.37s (0:03:18) ================== -Traceback (most recent call last): - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/main.py", line 269, in wrap_session - session.exitstatus = doit(config, session) or 0 - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/main.py", line 323, in _main - config.hook.pytest_runtestloop(session=session) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_hooks.py", line 265, in __call__ - return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_manager.py", line 80, in _hookexec - return self._inner_hookexec(hook_name, methods, kwargs, firstresult) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_callers.py", line 55, in _multicall - gen.send(outcome) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pytest_cov/plugin.py", line 294, in pytest_runtestloop - self.cov_controller.finish() - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pytest_cov/engine.py", line 44, in ensure_topdir_wrapper - return meth(self, *args, **kwargs) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pytest_cov/engine.py", line 196, in summary - total = self.cov.xml_report(ignore_errors=True, outfile=output) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/control.py", line 1017, in xml_report - return render_report(self.config.xml_output, XmlReporter(self), morfs, self._message) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/report.py", line 35, in render_report - return reporter.report(morfs, outfile=outfile) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/xmlreport.py", line 75, in report - for fr, analysis in get_analysis_to_report(self.coverage, morfs): - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/report.py", line 72, in get_analysis_to_report - analysis = coverage._analyze(fr) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/control.py", line 822, in _analyze - return Analysis(data, self.config.precision, it, self._file_mapper) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/results.py", line 20, in __init__ - self.statements = self.file_reporter.lines() - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/python.py", line 189, in lines - return self.parser.statements - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/python.py", line 184, in parser - self._parser.parse_source() - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/parser.py", line 234, in parse_source - self._raw_parse() - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/parser.py", line 124, in _raw_parse - tokgen = generate_tokens(self.text) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib64/python3.7/site-packages/coverage/phystokens.py", line 176, in generate_tokens - self.last_tokens = list(tokenize.generate_tokens(readline)) - File "/usr/lib64/python3.7/tokenize.py", line 647, in _tokenize - elif initial.isidentifier(): # ordinary name -KeyboardInterrupt - -During handling of the above exception, another exception occurred: - -Traceback (most recent call last): - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/bin/pytest", line 8, in - sys.exit(console_main()) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 185, in console_main - code = main() - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 163, in main - config=config - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_hooks.py", line 265, in __call__ - return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_manager.py", line 80, in _hookexec - return self._inner_hookexec(hook_name, methods, kwargs, firstresult) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_callers.py", line 39, in _multicall - res = hook_impl.function(*args) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_result.py", line 60, in get_result - raise ex[1].with_traceback(ex[2]) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_callers.py", line 39, in _multicall - res = hook_impl.function(*args) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/main.py", line 316, in pytest_cmdline_main - return wrap_session(config, _main) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/main.py", line 269, in wrap_session - session.exitstatus = doit(config, session) or 0 - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_hooks.py", line 265, in __call__ - return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_manager.py", line 80, in _hookexec - return self._inner_hookexec(hook_name, methods, kwargs, firstresult) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_callers.py", line 60, in _multicall - return outcome.get_result() - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_result.py", line 60, in get_result - raise ex[1].with_traceback(ex[2]) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/pluggy/_callers.py", line 39, in _multicall - res = hook_impl.function(*args) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/terminal.py", line 837, in pytest_keyboard_interrupt - self._keyboardinterrupt_memo = excinfo.getrepr(funcargs=True) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/_code/code.py", line 648, in getrepr - return fmt.repr_excinfo(self) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/_code/code.py", line 905, in repr_excinfo - reprtraceback = self.repr_traceback(excinfo_) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/_code/code.py", line 846, in repr_traceback - reprentry = self.repr_traceback_entry(entry, einfo) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/_code/code.py", line 790, in repr_traceback_entry - source = self._getentrysource(entry) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/_code/code.py", line 698, in _getentrysource - source = entry.getsource(self.astcache) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/_code/code.py", line 242, in getsource - source = self.frame.code.fullsource - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/_code/code.py", line 100, in fullsource - full, _ = findsource(self.raw) - File "/local/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/.tox/py37/lib/python3.7/site-packages/_pytest/_code/source.py", line 121, in findsource - sourcelines, lineno = inspect.findsource(obj) - File "/usr/lib64/python3.7/inspect.py", line 782, in findsource - lines = linecache.getlines(file, module.__dict__) - File "/usr/lib64/python3.7/linecache.py", line 47, in getlines - return updatecache(filename, module_globals) - File "/usr/lib64/python3.7/linecache.py", line 137, in updatecache - lines = fp.readlines() - File "/usr/lib64/python3.7/codecs.py", line 319, in decode - def decode(self, input, final=False): -KeyboardInterrupt -___________________________________ summary ____________________________________ -ERROR: py37: keyboardinterrupt diff --git a/test_script.py b/test_script.py deleted file mode 100644 index 812736bad2..0000000000 --- a/test_script.py +++ /dev/null @@ -1,57 +0,0 @@ -import sagemaker, boto3, json -from sagemaker import get_execution_role -from sagemaker import image_uris, model_uris, script_uris -from sagemaker.model import Model -from sagemaker.predictor import Predictor -from sagemaker.session import Session -from sagemaker.session_settings import SessionSettings -from sagemaker.utils import name_from_base - - -aws_role = get_execution_role() -aws_region = boto3.Session().region_name -sess = sagemaker.Session() - -model_id, model_version, = ( - "pytorch-ic-mobilenet-v2", - "*", -) - -inference_instance_type = "ml.m5.xlarge" - -# Retrieve the inference docker container uri. -deploy_image_uri = image_uris.retrieve( - region=None, - framework=None, - image_scope="inference", - model_id=model_id, - model_version=model_version, - instance_type=inference_instance_type, -) -# Retrieve the inference script uri. -deploy_source_uri = script_uris.retrieve( - model_id=model_id, model_version=model_version, script_scope="inference" -) -# Retrieve the base model uri. -base_model_uri = model_uris.retrieve( - model_id=model_id, model_version=model_version, model_scope="inference" -) - -sm_session = Session() -sm_session.settings._local_download_dir = "/home/evakravi/workspace/github/sdk_change_download_directory/sagemaker-python-sdk/temp" -# Create the SageMaker model instance. Note that we need to pass Predictor class when we deploy model through Model class, -# for being able to run inference through the sagemaker API. -model = Model( - image_uri=deploy_image_uri, - source_dir=deploy_source_uri, - model_data=base_model_uri, - entry_point="inference.py", - role=aws_role, - sagemaker_session=sm_session, - -) -# deploy the Model. -base_model_predictor = model.deploy( - initial_instance_count=1, - instance_type=inference_instance_type, -) diff --git a/tests/unit/sagemaker/huggingface/huggingface_utils.py b/tests/unit/sagemaker/huggingface/huggingface_utils.py index edb5ef5478..3ce8b134be 100644 --- a/tests/unit/sagemaker/huggingface/huggingface_utils.py +++ b/tests/unit/sagemaker/huggingface/huggingface_utils.py @@ -14,7 +14,6 @@ from sagemaker import image_uris - REGION = "us-east-1" GPU_INSTANCE_TYPE = "ml.p2.xlarge" From 094e4765f19f1167e7cf14df002c93a0b5c21f90 Mon Sep 17 00:00:00 2001 From: Evan Kravitz Date: Thu, 5 Jan 2023 16:44:28 +0000 Subject: [PATCH 41/41] fix: pytorch compiler unit tests --- tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py b/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py index 068bb4e4b9..0b3f0e8de6 100644 --- a/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py +++ b/tests/unit/sagemaker/training_compiler/test_pytorch_compiler.py @@ -24,6 +24,7 @@ from sagemaker.pytorch import PyTorch, TrainingCompilerConfig from sagemaker.pytorch.model import PyTorchModel from sagemaker.instance_group import InstanceGroup +from sagemaker.session_settings import SessionSettings from tests.unit.sagemaker.training_compiler import EC2_GPU_INSTANCE_CLASSES @@ -71,6 +72,7 @@ def fixture_sagemaker_session(): local_mode=False, s3_resource=None, s3_client=None, + settings=SessionSettings(), ) describe = {"ModelArtifacts": {"S3ModelArtifacts": "s3://m/m.tar.gz"}}