sagemaker-core 2.1.1__py3-none-any.whl → 2.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. sagemaker/__init__.py +2 -0
  2. sagemaker/core/common_utils.py +119 -1
  3. sagemaker/core/experiments/experiment.py +3 -0
  4. sagemaker/core/fw_utils.py +56 -12
  5. sagemaker/core/git_utils.py +66 -0
  6. sagemaker/core/helper/session_helper.py +22 -10
  7. sagemaker/core/image_retriever/image_retriever_utils.py +1 -3
  8. sagemaker/core/image_uri_config/huggingface-llm-neuronx.json +111 -1
  9. sagemaker/core/image_uri_config/huggingface-llm.json +110 -1
  10. sagemaker/core/image_uri_config/huggingface-neuronx.json +182 -6
  11. sagemaker/core/image_uri_config/huggingface-vllm-neuronx.json +38 -0
  12. sagemaker/core/image_uri_config/huggingface.json +151 -2
  13. sagemaker/core/image_uri_config/sagemaker-tritonserver.json +40 -0
  14. sagemaker/core/image_uri_config/sklearn.json +48 -0
  15. sagemaker/core/image_uri_config/xgboost.json +84 -0
  16. sagemaker/core/image_uris.py +9 -3
  17. sagemaker/core/iterators.py +11 -0
  18. sagemaker/core/jumpstart/models.py +2 -0
  19. sagemaker/core/jumpstart/region_config.json +8 -0
  20. sagemaker/core/local/data.py +10 -0
  21. sagemaker/core/local/utils.py +6 -5
  22. sagemaker/core/model_monitor/clarify_model_monitoring.py +2 -0
  23. sagemaker/core/model_registry.py +1 -1
  24. sagemaker/core/modules/configs.py +14 -1
  25. sagemaker/core/modules/train/container_drivers/common/utils.py +2 -10
  26. sagemaker/core/modules/train/sm_recipes/utils.py +1 -1
  27. sagemaker/core/processing.py +2 -0
  28. sagemaker/core/remote_function/client.py +31 -6
  29. sagemaker/core/remote_function/core/pipeline_variables.py +0 -6
  30. sagemaker/core/remote_function/core/serialization.py +16 -28
  31. sagemaker/core/remote_function/core/stored_function.py +8 -11
  32. sagemaker/core/remote_function/errors.py +1 -3
  33. sagemaker/core/remote_function/invoke_function.py +1 -6
  34. sagemaker/core/remote_function/job.py +2 -21
  35. sagemaker/core/telemetry/constants.py +6 -8
  36. sagemaker/core/telemetry/telemetry_logging.py +6 -5
  37. sagemaker/core/training/configs.py +16 -4
  38. sagemaker/core/workflow/utilities.py +10 -3
  39. {sagemaker_core-2.1.1.dist-info → sagemaker_core-2.3.1.dist-info}/METADATA +1 -1
  40. {sagemaker_core-2.1.1.dist-info → sagemaker_core-2.3.1.dist-info}/RECORD +43 -47
  41. sagemaker/core/huggingface/__init__.py +0 -29
  42. sagemaker/core/huggingface/llm_utils.py +0 -150
  43. sagemaker/core/huggingface/processing.py +0 -139
  44. sagemaker/core/huggingface/training_compiler/__init__.py +0 -0
  45. sagemaker/core/huggingface/training_compiler/config.py +0 -167
  46. sagemaker/core/image_uri_config/__init__.py +0 -13
  47. {sagemaker_core-2.1.1.dist-info → sagemaker_core-2.3.1.dist-info}/WHEEL +0 -0
  48. {sagemaker_core-2.1.1.dist-info → sagemaker_core-2.3.1.dist-info}/licenses/LICENSE +0 -0
  49. {sagemaker_core-2.1.1.dist-info → sagemaker_core-2.3.1.dist-info}/top_level.txt +0 -0
@@ -1,167 +0,0 @@
1
- # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
- """Configuration for the SageMaker Training Compiler."""
14
- from __future__ import absolute_import
15
- import logging
16
- from typing import Union
17
- from packaging.specifiers import SpecifierSet
18
- from packaging.version import Version
19
-
20
- from sagemaker.core.training_compiler.config import TrainingCompilerConfig as BaseConfig
21
- from sagemaker.core.helper.pipeline_variable import PipelineVariable
22
-
23
- logger = logging.getLogger(__name__)
24
-
25
-
26
- class TrainingCompilerConfig(BaseConfig):
27
- """The SageMaker Training Compiler configuration class."""
28
-
29
- SUPPORTED_INSTANCE_CLASS_PREFIXES = ["p3", "p3dn", "g4dn", "p4d", "g5"]
30
- SUPPORTED_INSTANCE_TYPES_WITH_EFA = [
31
- "ml.g4dn.8xlarge",
32
- "ml.g4dn.12xlarge",
33
- "ml.g5.48xlarge",
34
- "ml.p3dn.24xlarge",
35
- "ml.p4d.24xlarge",
36
- ]
37
-
38
- def __init__(
39
- self,
40
- enabled: Union[bool, PipelineVariable] = True,
41
- debug: Union[bool, PipelineVariable] = False,
42
- ):
43
- """This class initializes a ``TrainingCompilerConfig`` instance.
44
-
45
- `Amazon SageMaker Training Compiler
46
- <https://docs.aws.amazon.com/sagemaker/latest/dg/training-compiler.html>`_
47
- is a feature of SageMaker Training
48
- and speeds up training jobs by optimizing model execution graphs.
49
-
50
- You can compile Hugging Face models
51
- by passing the object of this configuration class to the ``compiler_config``
52
- parameter of the :class:`~sagemaker.huggingface.HuggingFace`
53
- estimator.
54
-
55
- Args:
56
- enabled (bool or PipelineVariable): Optional. Switch to enable SageMaker
57
- Training Compiler. The default is ``True``.
58
- debug (bool or PipelineVariable): Optional. Whether to dump detailed logs
59
- for debugging. This comes with a potential performance slowdown.
60
- The default is ``False``.
61
-
62
- **Example**: The following code shows the basic usage of the
63
- :class:`sagemaker.huggingface.TrainingCompilerConfig()` class
64
- to run a HuggingFace training job with the compiler.
65
-
66
- .. code-block:: python
67
-
68
- from sagemaker.core.huggingface import HuggingFace, TrainingCompilerConfig
69
-
70
- huggingface_estimator=HuggingFace(
71
- ...
72
- compiler_config=TrainingCompilerConfig()
73
- )
74
-
75
- .. seealso::
76
-
77
- For more information about how to enable SageMaker Training Compiler
78
- for various training settings such as using TensorFlow-based models,
79
- PyTorch-based models, and distributed training,
80
- see `Enable SageMaker Training Compiler
81
- <https://docs.aws.amazon.com/sagemaker/latest/dg/training-compiler-enable.html>`_
82
- in the `Amazon SageMaker Training Compiler developer guide
83
- <https://docs.aws.amazon.com/sagemaker/latest/dg/training-compiler.html>`_.
84
-
85
- """
86
-
87
- super(TrainingCompilerConfig, self).__init__(enabled=enabled, debug=debug)
88
-
89
- @classmethod
90
- def validate(cls, estimator):
91
- """Checks if SageMaker Training Compiler is configured correctly.
92
-
93
- Args:
94
- estimator (:class:`sagemaker.huggingface.HuggingFace`): An estimator object.
95
- If SageMaker Training Compiler is enabled, it will validate whether
96
- the estimator is configured to be compatible with Training Compiler.
97
-
98
- Raises:
99
- ValueError: Raised if the requested configuration is not compatible
100
- with SageMaker Training Compiler.
101
- """
102
-
103
- super(TrainingCompilerConfig, cls).validate(estimator)
104
-
105
- if estimator.pytorch_version:
106
- if (Version(estimator.pytorch_version) in SpecifierSet("< 1.9")) or (
107
- Version(estimator.pytorch_version) in SpecifierSet("> 1.11")
108
- ):
109
- error_helper_string = (
110
- "SageMaker Training Compiler is only supported "
111
- "with HuggingFace PyTorch 1.9-1.11. "
112
- "Received pytorch_version={} which is unsupported."
113
- )
114
- raise ValueError(error_helper_string.format(estimator.pytorch_version))
115
-
116
- if estimator.image_uri:
117
- error_helper_string = (
118
- "Overriding the image URI is currently not supported "
119
- "for SageMaker Training Compiler."
120
- "Specify the following parameters to run the Hugging Face training job "
121
- "with SageMaker Training Compiler enabled: "
122
- "transformer_version, tensorflow_version or pytorch_version, and compiler_config."
123
- )
124
- raise ValueError(error_helper_string)
125
-
126
- if estimator.distribution:
127
- pt_xla_present = "pytorchxla" in estimator.distribution
128
- pt_xla_enabled = estimator.distribution.get("pytorchxla", {}).get("enabled", False)
129
- if pt_xla_enabled:
130
- if estimator.tensorflow_version:
131
- error_helper_string = (
132
- "Distribution mechanism 'pytorchxla' is currently only supported for "
133
- "PyTorch >= 1.11 when SageMaker Training Compiler is enabled. Received "
134
- "tensorflow_version={} which is unsupported."
135
- )
136
- raise ValueError(error_helper_string.format(estimator.tensorflow_version))
137
- if estimator.pytorch_version:
138
- if Version(estimator.pytorch_version) in SpecifierSet("< 1.11"):
139
- error_helper_string = (
140
- "Distribution mechanism 'pytorchxla' is currently only supported for "
141
- "PyTorch >= 1.11 when SageMaker Training Compiler is enabled."
142
- " Received pytorch_version={} which is unsupported."
143
- )
144
- raise ValueError(error_helper_string.format(estimator.pytorch_version))
145
- if estimator.instance_type not in cls.SUPPORTED_INSTANCE_TYPES_WITH_EFA:
146
- logger.warning(
147
- "Consider using instances with EFA support when "
148
- "training with PyTorch >= 1.11 and SageMaker Training Compiler "
149
- "enabled. SageMaker Training Compiler leverages EFA to provide better "
150
- "performance for distributed training."
151
- )
152
- if not pt_xla_present:
153
- if estimator.pytorch_version:
154
- if Version(estimator.pytorch_version) in SpecifierSet(">= 1.11"):
155
- error_helper_string = (
156
- "'pytorchxla' is the only distribution mechanism currently supported "
157
- "for PyTorch >= 1.11 when SageMaker Training Compiler is enabled."
158
- " Received distribution={} which is unsupported."
159
- )
160
- raise ValueError(error_helper_string.format(estimator.distribution))
161
- elif estimator.instance_count and estimator.instance_count > 1:
162
- if estimator.pytorch_version:
163
- if Version(estimator.pytorch_version) in SpecifierSet(">= 1.11"):
164
- logger.warning(
165
- "Consider setting 'distribution' to 'pytorchxla' for distributed "
166
- "training with PyTorch >= 1.11 and SageMaker Training Compiler enabled."
167
- )
@@ -1,13 +0,0 @@
1
- # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License"). You
4
- # may not use this file except in compliance with the License. A copy of
5
- # the License is located at
6
- #
7
- # http://aws.amazon.com/apache2.0/
8
- #
9
- # or in the "license" file accompanying this file. This file is
10
- # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
- # ANY KIND, either express or implied. See the License for the specific
12
- # language governing permissions and limitations under the License.
13
- """Image URI configuration data."""