Skip to content

Commit 9038820

Browse files
authored
Merge branch 'dev' into feat/jumpstart-docs-model-table
2 parents 44ad05e + a765512 commit 9038820

24 files changed

+841
-553
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Changelog
22

3+
## v2.75.0 (2022-02-05)
4+
5+
### Features
6+
7+
* JumpStart Integration
8+
* Adds support for async inference
9+
* Update instance types for integ test
10+
11+
### Bug Fixes and Other Changes
12+
13+
* Revert "feature: CompilationStep support for Sagemaker Pipelines
14+
* gpu use p3/p2 per avail for region
15+
* jumpstart typo
16+
* pin pytest-xdist to avoid release failures
17+
* set sagemaker_connection and image_uri in register method
18+
* update to incorporate black v22, pin tox versions
19+
* Add deprecation warning in Clarify DataConfig
20+
21+
### Documentation Changes
22+
23+
* Jumpstart doc strings and added new sections
24+
* Add Jumpstart support documentation
25+
326
## v2.74.0 (2022-01-26)
427

528
### Features

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ SageMaker Python SDK is tested on:
9090
- Python 3.6
9191
- Python 3.7
9292
- Python 3.8
93+
- Python 3.9
9394

9495
AWS Permissions
9596
~~~~~~~~~~~~~~~

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.74.1.dev0
1+
2.75.1.dev0

doc/workflows/pipelines/sagemaker.workflow.pipelines.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ Steps
140140

141141
.. autoclass:: sagemaker.workflow.lambda_step.LambdaStep
142142

143-
.. autoclass:: sagemaker.workflow.steps.CompilationStep
144-
145143
.. autoclass:: sagemaker.workflow.quality_check_step.QualityCheckConfig
146144

147145
.. autoclass:: sagemaker.workflow.quality_check_step.QualityCheckStep
148146

149147
.. autoclass:: sagemaker.workflow.clarify_check_step.ClarifyCheckConfig
150148

151149
.. autoclass:: sagemaker.workflow.clarify_check_step.ClarifyCheckStep
150+
151+
.. autoclass:: sagemaker.workflow.fail_step.FailStep

setup.py

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def read_version():
3333

3434
# Declare minimal set for installation
3535
required_packages = [
36-
"attrs",
36+
"attrs==20.3.0",
3737
"boto3>=1.20.21",
3838
"google-pasta",
3939
"numpy>=1.9.0",
@@ -49,36 +49,38 @@ def read_version():
4949
# Specific use case dependencies
5050
extras = {
5151
"local": [
52-
"urllib3>=1.21.1,!=1.25,!=1.25.1",
53-
"docker-compose>=1.25.2",
54-
"docker==5.0.0",
55-
"PyYAML>=5.3, <6", # PyYAML version has to match docker-compose requirements
52+
"urllib3==1.26.8",
53+
"docker-compose==1.29.2",
54+
"docker~=5.0.0",
55+
"PyYAML==5.4.1", # PyYAML version has to match docker-compose requirements
5656
],
57-
"scipy": ["scipy>=0.19.0"],
57+
"scipy": ["scipy==1.5.4"],
5858
}
5959
# Meta dependency groups
6060
extras["all"] = [item for group in extras.values() for item in group]
6161
# Tests specific dependencies (do not need to be included in 'all')
6262
extras["test"] = (
6363
[
6464
extras["all"],
65-
"tox",
66-
"flake8",
67-
"pytest<6.1.0",
68-
"pytest-cov",
69-
"pytest-rerunfailures",
70-
"pytest-timeout",
65+
"tox==3.24.5",
66+
"flake8==4.0.1",
67+
"pytest==6.0.2",
68+
"pytest-cov==3.0.0",
69+
"pytest-rerunfailures==10.2",
70+
"pytest-timeout==2.1.0",
7171
"pytest-xdist==2.4.0",
72-
"coverage<6.2",
73-
"mock",
74-
"contextlib2",
75-
"awslogs",
76-
"black",
72+
"coverage>=5.2, <6.2",
73+
"mock==4.0.3",
74+
"contextlib2==21.6.0",
75+
"awslogs==0.14.0",
76+
"black==22.1.0",
7777
"stopit==1.1.2",
78-
"apache-airflow==1.10.11",
79-
"fabric>=2.0",
80-
"requests>=2.20.0, <3",
81-
"sagemaker-experiments",
78+
"apache-airflow==2.2.3",
79+
"apache-airflow-providers-amazon==3.0.0",
80+
"attrs==20.3.0",
81+
"fabric==2.6.0",
82+
"requests==2.27.1",
83+
"sagemaker-experiments==0.1.35",
8284
],
8385
)
8486

src/sagemaker/inputs.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -136,67 +136,6 @@ class CreateModelInput(object):
136136
accelerator_type: str = attr.ib(default=None)
137137

138138

139-
@attr.s
140-
class CompilationInput(object):
141-
"""Create a class containing all the parameters.
142-
143-
It can be used when calling ``sagemaker.model.Model.compile_model()``
144-
145-
Parameters:
146-
target_instance_type(str): Identifies the device that you want to
147-
run your model after compilation, for example: ml_c5. For allowed
148-
strings see
149-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html.
150-
input_shape(str): Specifies the name and shape of the expected
151-
inputs for your trained model in json dictionary form, for
152-
example: {'data': [1,3,1024,1024]}, or {'var1': [1,1,28,28],
153-
'var2': [1,1,28,28]}
154-
output_path(str): Specifies where to store the compiled model
155-
framework (str, optional): The framework that is used to train the original
156-
model. Allowed values: 'mxnet', 'tensorflow', 'keras', 'pytorch',
157-
'onnx', 'xgboost' (default: None)
158-
framework_version (str, optional): The version of the framework (default: None)
159-
compile_max_run (int, optional): Timeout in seconds for compilation (default:
160-
15 * 60). After this amount of time Amazon SageMaker Neo
161-
terminates the compilation job regardless of its current status.
162-
tags (list[dict], optional): List of tags for labeling a compilation job.
163-
For more, see
164-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html.
165-
job_name (str, optional): The name of the compilation job (default: None)
166-
target_platform_os (str, optional): Target Platform OS, for example: 'LINUX'.
167-
(default: None)
168-
For allowed strings see
169-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html.
170-
It can be used instead of target_instance_family.
171-
target_platform_arch (str, optional): Target Platform Architecture, for example: 'X86_64'.
172-
(default: None)
173-
For allowed strings see
174-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html.
175-
It can be used instead of target_instance_family.
176-
target_platform_accelerator (str, optional): Target Platform Accelerator,
177-
for example: 'NVIDIA'. (default: None)
178-
For allowed strings see
179-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html.
180-
It can be used instead of target_instance_family.
181-
compiler_options (dict, optional): Additional parameters for compiler. (default: None)
182-
Compiler Options are TargetPlatform / target_instance_family specific. See
183-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html for details.
184-
"""
185-
186-
target_instance_type: str = attr.ib(default=None)
187-
input_shape: dict = attr.ib(factory=dict)
188-
output_path: str = attr.ib(default=None)
189-
framework: str = attr.ib(default=None)
190-
framework_version: str = attr.ib(default=None)
191-
compile_max_run: int = attr.ib(default=15 * 60)
192-
tags: list = attr.ib(factory=list)
193-
job_name: str = attr.ib(default=None)
194-
target_platform_os: str = attr.ib(default=None)
195-
target_platform_arch: str = attr.ib(default=None)
196-
target_platform_accelerator: str = attr.ib(default=None)
197-
compiler_options: dict = attr.ib(default=None)
198-
199-
200139
@attr.s
201140
class TransformInput(object):
202141
"""Create a class containing all the parameters.

src/sagemaker/model.py

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@
2323
import sagemaker
2424
from sagemaker import (
2525
fw_utils,
26-
image_uris,
2726
local,
2827
s3,
2928
session,
3029
utils,
3130
git_utils,
3231
)
33-
from sagemaker.inputs import CompilationInput
3432
from sagemaker.deprecations import removed_kwargs
3533
from sagemaker.predictor import PredictorBase
3634
from sagemaker.serverless import ServerlessInferenceConfig
@@ -658,86 +656,6 @@ def _compilation_job_config(
658656
"job_name": job_name,
659657
}
660658

661-
def _get_compilation_args(self, estimator, inputs):
662-
"""Constructs a dict of arguments for an Amazon SageMaker compilation job from estimator.
663-
664-
Args:
665-
estimator (sagemaker.estimator.EstimatorBase): Estimator object
666-
created by the user.
667-
inputs (CompilationInput): class containing all the parameters that
668-
can be used when calling ``sagemaker.model.Model.compile_model()``
669-
"""
670-
671-
if not isinstance(inputs, CompilationInput):
672-
raise TypeError("Your inputs must be provided as CompilationInput objects.")
673-
target_instance_family = inputs.target_instance_type
674-
input_shape = inputs.input_shape
675-
output_path = inputs.output_path
676-
role = estimator.role
677-
compile_max_run = inputs.compile_max_run
678-
job_name = estimator._compilation_job_name()
679-
framework = inputs.framework or self._framework()
680-
if framework is None:
681-
raise ValueError(
682-
"You must specify framework, allowed values {}".format(NEO_ALLOWED_FRAMEWORKS)
683-
)
684-
if framework not in NEO_ALLOWED_FRAMEWORKS:
685-
raise ValueError(
686-
"You must provide valid framework, allowed values {}".format(NEO_ALLOWED_FRAMEWORKS)
687-
)
688-
if self.model_data is None:
689-
raise ValueError("You must provide an S3 path to the compressed model artifacts.")
690-
tags = inputs.tags
691-
target_platform_os = inputs.target_platform_os
692-
target_platform_arch = inputs.target_platform_arch
693-
target_platform_accelerator = inputs.target_platform_accelerator
694-
compiler_options = inputs.compiler_options
695-
framework_version = inputs.framework_version or self._get_framework_version()
696-
697-
return self._compilation_job_config(
698-
target_instance_family,
699-
input_shape,
700-
output_path,
701-
role,
702-
compile_max_run,
703-
job_name,
704-
framework,
705-
tags,
706-
target_platform_os,
707-
target_platform_arch,
708-
target_platform_accelerator,
709-
compiler_options,
710-
framework_version,
711-
)
712-
713-
def _compilation_image_uri(self, region, target_instance_type, framework, framework_version):
714-
"""Retrieve the Neo or Inferentia image URI.
715-
716-
Args:
717-
region (str): The AWS region.
718-
target_instance_type (str): Identifies the device on which you want to run
719-
your model after compilation, for example: ml_c5. For valid values, see
720-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_OutputConfig.html.
721-
framework (str): The framework name.
722-
framework_version (str): The framework version.
723-
"""
724-
framework_prefix = ""
725-
framework_suffix = ""
726-
727-
if framework == "xgboost":
728-
framework_suffix = "-neo"
729-
elif target_instance_type.startswith("ml_inf"):
730-
framework_prefix = "inferentia-"
731-
else:
732-
framework_prefix = "neo-"
733-
734-
return image_uris.retrieve(
735-
"{}{}{}".format(framework_prefix, framework, framework_suffix),
736-
region,
737-
instance_type=target_instance_type,
738-
version=framework_version,
739-
)
740-
741659
def package_for_edge(
742660
self,
743661
output_path,
@@ -902,12 +820,7 @@ def compile(
902820
if target_instance_family == "ml_eia2":
903821
pass
904822
elif target_instance_family.startswith("ml_"):
905-
self.image_uri = self._compilation_image_uri(
906-
self.sagemaker_session.boto_region_name,
907-
target_instance_family,
908-
framework,
909-
framework_version,
910-
)
823+
self.image_uri = job_status.get("InferenceImage", None)
911824
self._is_compiled_model = True
912825
else:
913826
LOGGER.warning(

src/sagemaker/session.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,57 +1845,6 @@ def compile_model(
18451845
LOGGER.info("Creating compilation-job with name: %s", job_name)
18461846
self.sagemaker_client.create_compilation_job(**compilation_job_request)
18471847

1848-
def _get_compilation_request(
1849-
self,
1850-
job_name,
1851-
input_model_config,
1852-
output_model_config,
1853-
role,
1854-
stop_condition,
1855-
tags=None,
1856-
vpc_config=None,
1857-
):
1858-
"""Construct CreateCompilationJob request
1859-
1860-
Args:
1861-
input_model_config (dict): the trained model and the Amazon S3 location where it is
1862-
stored.
1863-
output_model_config (dict): Identifies the Amazon S3 location where you want Amazon
1864-
SageMaker Neo to save the results of compilation job
1865-
role (str): An AWS IAM role (either name or full ARN). The Amazon SageMaker Neo
1866-
compilation jobs use this role to access model artifacts. You must grant
1867-
sufficient permissions to this role.
1868-
job_name (str): Name of the compilation job being created.
1869-
stop_condition (dict): Defines when compilation job shall finish. Contains entries
1870-
that can be understood by the service like ``MaxRuntimeInSeconds``.
1871-
tags (list[dict]): List of tags for labeling a compile model job. For more, see
1872-
https://docs.aws.amazon.com/sagemaker/latest/dg/API_Tag.html.
1873-
vpc_config (dict): Contains values for VpcConfig:
1874-
* subnets (list[str]): List of subnet ids.
1875-
The key in vpc_config is 'Subnets'.
1876-
* security_group_ids (list[str]): List of security group ids.
1877-
The key in vpc_config is 'SecurityGroupIds'.
1878-
Returns:
1879-
dict: A dictionary for CreateCompilationJob request
1880-
"""
1881-
1882-
compilation_request = {
1883-
"InputConfig": input_model_config,
1884-
"OutputConfig": output_model_config,
1885-
"RoleArn": role,
1886-
"StoppingCondition": stop_condition,
1887-
"CompilationJobName": job_name,
1888-
}
1889-
1890-
tags = _append_project_tags(tags)
1891-
if tags is not None:
1892-
compilation_request["Tags"] = tags
1893-
1894-
if vpc_config is not None:
1895-
compilation_request["VpcConfig"] = vpc_config
1896-
1897-
return compilation_request
1898-
18991848
def package_model_for_edge(
19001849
self,
19011850
output_model_config,

0 commit comments

Comments
 (0)