Skip to content

Commit af7639a

Browse files
committed
Merge remote-tracking branch 'origin' into feat/jumpstart-instance-types
2 parents 54e6754 + 9d9a74c commit af7639a

File tree

6 files changed

+62
-10
lines changed

6 files changed

+62
-10
lines changed

CHANGELOG.md

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

3+
## v2.140.0 (2023-03-17)
4+
5+
### Features
6+
7+
* SDK changes for TRCOMP support
8+
9+
### Bug Fixes and Other Changes
10+
11+
* [Feature - Hugging Face] Update Transformers 4.26 - PyTorch 1.13.1 Image uri
12+
313
## v2.139.0 (2023-03-15)
414

515
### Features

VERSION

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

src/sagemaker/huggingface/training_compiler/config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ def validate(cls, estimator):
102102

103103
super(TrainingCompilerConfig, cls).validate(estimator)
104104

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+
105116
if estimator.image_uri:
106117
error_helper_string = (
107118
"Overriding the image URI is currently not supported "

src/sagemaker/tensorflow/training_compiler/config.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class TrainingCompilerConfig(BaseConfig):
2626

2727
SUPPORTED_INSTANCE_CLASS_PREFIXES = ["p3", "p3dn", "g4dn", "p4d", "g5"]
2828
MIN_SUPPORTED_VERSION = "2.9"
29+
MAX_SUPPORTED_VERSION = "2.11"
2930

3031
def __init__(self, enabled=True, debug=False):
3132
"""This class initializes a ``TrainingCompilerConfig`` instance.
@@ -91,15 +92,17 @@ def validate(cls, estimator):
9192
super(TrainingCompilerConfig, cls).validate(estimator)
9293

9394
if estimator.framework_version:
94-
if Version(estimator.framework_version) in SpecifierSet(
95-
f"< {cls.MIN_SUPPORTED_VERSION}"
95+
if Version(estimator.framework_version) not in SpecifierSet(
96+
f">= {cls.MIN_SUPPORTED_VERSION}", f"<= {cls.MAX_SUPPORTED_VERSION}"
9697
):
9798
error_helper_string = (
9899
"SageMaker Training Compiler only supports TensorFlow version "
99-
">= {} but received {}"
100+
"between {} to {} but received {}"
100101
)
101102
error_helper_string = error_helper_string.format(
102-
cls.MIN_SUPPORTED_VERSION, estimator.framework_version
103+
cls.MIN_SUPPORTED_VERSION,
104+
cls.MAX_SUPPORTED_VERSION,
105+
estimator.framework_version,
103106
)
104107
raise ValueError(error_helper_string)
105108

tests/unit/sagemaker/training_compiler/test_huggingface_pytorch_compiler.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def test_unsupported_gpu_instance(
218218
).fit()
219219

220220

221-
def test_unsupported_framework_version(
221+
def test_unsupported_framework_version_min(
222222
huggingface_training_compiler_version,
223223
):
224224
with pytest.raises(ValueError):
@@ -229,9 +229,24 @@ def test_unsupported_framework_version(
229229
instance_count=INSTANCE_COUNT,
230230
instance_type=INSTANCE_TYPE,
231231
transformers_version=huggingface_training_compiler_version,
232-
pytorch_version=".".join(
233-
["99"] * len(huggingface_training_compiler_version.split("."))
234-
),
232+
pytorch_version="1.8",
233+
enable_sagemaker_metrics=False,
234+
compiler_config=TrainingCompilerConfig(),
235+
).fit()
236+
237+
238+
def test_unsupported_framework_version_max(
239+
huggingface_training_compiler_version,
240+
):
241+
with pytest.raises(ValueError):
242+
HuggingFace(
243+
py_version="py38",
244+
entry_point=SCRIPT_PATH,
245+
role=ROLE,
246+
instance_count=INSTANCE_COUNT,
247+
instance_type=INSTANCE_TYPE,
248+
transformers_version=huggingface_training_compiler_version,
249+
pytorch_version="1.12",
235250
enable_sagemaker_metrics=False,
236251
compiler_config=TrainingCompilerConfig(),
237252
).fit()

tests/unit/sagemaker/training_compiler/test_tensorflow_compiler.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def test_gpu_instance(
189189
compiler_config=TrainingCompilerConfig(),
190190
).fit()
191191

192-
def test_framework_version(self, tensorflow_training_py_version):
192+
def test_framework_version_min(self, tensorflow_training_py_version):
193193
with pytest.raises(ValueError):
194194
TensorFlow(
195195
py_version=tensorflow_training_py_version,
@@ -202,6 +202,19 @@ def test_framework_version(self, tensorflow_training_py_version):
202202
compiler_config=TrainingCompilerConfig(),
203203
).fit()
204204

205+
def test_framework_version_max(self, tensorflow_training_py_version):
206+
with pytest.raises(ValueError):
207+
TensorFlow(
208+
py_version=tensorflow_training_py_version,
209+
entry_point=SCRIPT_PATH,
210+
role=ROLE,
211+
instance_count=INSTANCE_COUNT,
212+
instance_type=INSTANCE_TYPE,
213+
framework_version="2.12",
214+
enable_sagemaker_metrics=False,
215+
compiler_config=TrainingCompilerConfig(),
216+
).fit()
217+
205218
def test_mwms(self, tensorflow_training_version, tensorflow_training_py_version):
206219
with pytest.raises(ValueError):
207220
TensorFlow(

0 commit comments

Comments
 (0)