Skip to content

Commit efa33f4

Browse files
authored
Merge branch 'master' into semantic-versioning
2 parents b2e4ebe + e6b498c commit efa33f4

File tree

9 files changed

+247
-192
lines changed

9 files changed

+247
-192
lines changed

doc/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ sphinx==5.1.1
22
sphinx-rtd-theme==0.5.0
33
docutils==0.15.2
44
packaging==20.9
5-
jinja2==3.1.4
5+
jinja2==3.1.6
66
schema==0.7.5
77
accelerate>=0.24.1,<=0.27.0
88
graphene<4.0

requirements/extras/test_requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ attrs>=23.1.0,<24
2020
fabric==2.6.0
2121
requests==2.32.2
2222
sagemaker-experiments==0.1.35
23-
Jinja2==3.1.4
23+
Jinja2==3.1.6
2424
pyvis==0.2.1
2525
pandas==1.4.4
2626
scikit-learn==1.3.0
@@ -33,7 +33,7 @@ pillow>=10.0.1,<=11
3333
opentelemetry-proto==1.27.0
3434
protobuf==4.25.5
3535
tensorboard>=2.9.0,<=2.15.2
36-
transformers==4.46.1
36+
transformers==4.48.0
3737
sentencepiece==0.1.99
3838
# https://github.com/triton-inference-server/server/issues/6246
3939
tritonclient[http]<2.37.0

src/sagemaker/remote_function/client.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def remote(
9090
spark_config: SparkConfig = None,
9191
use_spot_instances=False,
9292
max_wait_time_in_seconds=None,
93+
disable_output_compression: bool = False,
9394
use_torchrun: bool = False,
9495
use_mpirun: bool = False,
9596
nproc_per_node: Optional[int] = None,
@@ -283,13 +284,16 @@ def remote(
283284
After this amount of time Amazon SageMaker will stop waiting for managed spot training
284285
job to complete. Defaults to ``None``.
285286
287+
disable_output_compression (bool): Optional. When set to true, Model is uploaded to
288+
Amazon S3 without compression after training finishes.
289+
286290
use_torchrun (bool): Specifies whether to use torchrun for distributed training.
287291
Defaults to ``False``.
288292
289293
use_mpirun (bool): Specifies whether to use mpirun for distributed training.
290294
Defaults to ``False``.
291295
292-
nproc_per_node (Optional int): Specifies the number of processes per node for
296+
nproc_per_node (int): Optional. Specifies the number of processes per node for
293297
distributed training. Defaults to ``None``.
294298
This is defined automatically configured on the instance type.
295299
"""
@@ -324,6 +328,7 @@ def _remote(func):
324328
spark_config=spark_config,
325329
use_spot_instances=use_spot_instances,
326330
max_wait_time_in_seconds=max_wait_time_in_seconds,
331+
disable_output_compression=disable_output_compression,
327332
use_torchrun=use_torchrun,
328333
use_mpirun=use_mpirun,
329334
nproc_per_node=nproc_per_node,
@@ -543,6 +548,7 @@ def __init__(
543548
spark_config: SparkConfig = None,
544549
use_spot_instances=False,
545550
max_wait_time_in_seconds=None,
551+
disable_output_compression: bool = False,
546552
use_torchrun: bool = False,
547553
use_mpirun: bool = False,
548554
nproc_per_node: Optional[int] = None,
@@ -736,13 +742,16 @@ def __init__(
736742
After this amount of time Amazon SageMaker will stop waiting for managed spot training
737743
job to complete. Defaults to ``None``.
738744
745+
disable_output_compression (bool): Optional. When set to true, Model is uploaded to
746+
Amazon S3 without compression after training finishes.
747+
739748
use_torchrun (bool): Specifies whether to use torchrun for distributed training.
740749
Defaults to ``False``.
741750
742751
use_mpirun (bool): Specifies whether to use mpirun for distributed training.
743752
Defaults to ``False``.
744753
745-
nproc_per_node (Optional int): Specifies the number of processes per node for
754+
nproc_per_node (int): Optional. Specifies the number of processes per node for
746755
distributed training. Defaults to ``None``.
747756
This is defined automatically configured on the instance type.
748757
"""
@@ -790,6 +799,7 @@ def __init__(
790799
spark_config=spark_config,
791800
use_spot_instances=use_spot_instances,
792801
max_wait_time_in_seconds=max_wait_time_in_seconds,
802+
disable_output_compression=disable_output_compression,
793803
use_torchrun=use_torchrun,
794804
use_mpirun=use_mpirun,
795805
nproc_per_node=nproc_per_node,

src/sagemaker/remote_function/job.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ def __init__(
373373
spark_config: SparkConfig = None,
374374
use_spot_instances=False,
375375
max_wait_time_in_seconds=None,
376+
disable_output_compression: bool = False,
376377
use_torchrun: bool = False,
377378
use_mpirun: bool = False,
378379
nproc_per_node: Optional[int] = None,
@@ -558,13 +559,16 @@ def __init__(
558559
After this amount of time Amazon SageMaker will stop waiting for managed spot
559560
training job to complete. Defaults to ``None``.
560561
562+
disable_output_compression (bool): Optional. When set to true, Model is uploaded to
563+
Amazon S3 without compression after training finishes.
564+
561565
use_torchrun (bool): Specifies whether to use torchrun for distributed training.
562566
Defaults to ``False``.
563567
564568
use_mpirun (bool): Specifies whether to use mpirun for distributed training.
565569
Defaults to ``False``.
566570
567-
nproc_per_node (Optional int): Specifies the number of processes per node for
571+
nproc_per_node (int): Optional. Specifies the number of processes per node for
568572
distributed training. Defaults to ``None``.
569573
This is defined automatically configured on the instance type.
570574
"""
@@ -725,6 +729,7 @@ def __init__(
725729
tags = format_tags(tags)
726730
self.tags = self.sagemaker_session._append_sagemaker_config_tags(tags, REMOTE_FUNCTION_TAGS)
727731

732+
self.disable_output_compression = disable_output_compression
728733
self.use_torchrun = use_torchrun
729734
self.use_mpirun = use_mpirun
730735
self.nproc_per_node = nproc_per_node
@@ -954,6 +959,8 @@ def compile(
954959
output_config = {"S3OutputPath": s3_base_uri}
955960
if job_settings.s3_kms_key is not None:
956961
output_config["KmsKeyId"] = job_settings.s3_kms_key
962+
if job_settings.disable_output_compression:
963+
output_config["CompressionType"] = "NONE"
957964
request_dict["OutputDataConfig"] = output_config
958965

959966
container_args = ["--s3_base_uri", s3_base_uri]

tests/integ/test_spark_processing.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
SPARK_PATH = os.path.join(DATA_DIR, "spark")
3636

3737

38-
@pytest.fixture(scope="module")
38+
@pytest.fixture(scope="module", autouse=True)
3939
def build_jar():
4040
jar_file_path = os.path.join(SPARK_PATH, "code", "java", "hello-java-spark")
4141
# compile java file
@@ -207,12 +207,10 @@ def configuration() -> list:
207207

208208

209209
def test_sagemaker_pyspark_v3(
210-
spark_v3_py_processor, spark_v3_jar_processor, sagemaker_session, configuration, build_jar
210+
spark_v3_py_processor, spark_v3_jar_processor, sagemaker_session, configuration
211211
):
212212
test_sagemaker_pyspark_multinode(spark_v3_py_processor, sagemaker_session, configuration)
213-
test_sagemaker_java_jar_multinode(
214-
spark_v3_jar_processor, sagemaker_session, configuration, build_jar
215-
)
213+
test_sagemaker_java_jar_multinode(spark_v3_jar_processor, sagemaker_session, configuration)
216214

217215

218216
def test_sagemaker_pyspark_multinode(spark_py_processor, sagemaker_session, configuration):
@@ -280,9 +278,7 @@ def test_sagemaker_pyspark_multinode(spark_py_processor, sagemaker_session, conf
280278
assert len(output_contents) != 0
281279

282280

283-
def test_sagemaker_java_jar_multinode(
284-
spark_jar_processor, sagemaker_session, configuration, build_jar
285-
):
281+
def test_sagemaker_java_jar_multinode(spark_jar_processor, sagemaker_session, configuration):
286282
"""Test SparkJarProcessor using Java application jar"""
287283
bucket = spark_jar_processor.sagemaker_session.default_bucket()
288284
with open(os.path.join(SPARK_PATH, "files", "data.jsonl")) as data:

tests/unit/sagemaker/feature_store/feature_processor/test_feature_scheduler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ def test_remote_decorator_fields_consistency(get_execution_role, session):
907907
"use_spot_instances",
908908
"max_wait_time_in_seconds",
909909
"custom_file_filter",
910+
"disable_output_compression",
910911
"use_torchrun",
911912
"use_mpirun",
912913
"nproc_per_node",

tests/unit/sagemaker/monitor/test_clarify_model_monitor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,11 +568,12 @@ def test_clarify_model_monitor():
568568

569569
# The subclass should has monitoring_type() defined
570570
# noinspection PyAbstractClass
571-
class DummyClarifyModelMonitoir(ClarifyModelMonitor):
571+
class DummyClarifyModelMonitor(ClarifyModelMonitor):
572+
_TEST_CLASS = True
572573
pass
573574

574575
with pytest.raises(TypeError):
575-
DummyClarifyModelMonitoir.monitoring_type()
576+
DummyClarifyModelMonitor.monitoring_type()
576577

577578

578579
def test_clarify_model_monitor_invalid_update(clarify_model_monitors):
@@ -593,6 +594,8 @@ def test_clarify_model_monitor_invalid_attach(sagemaker_session):
593594
)
594595
# attach, invalid monitoring type
595596
for clarify_model_monitor_cls in ClarifyModelMonitor.__subclasses__():
597+
if hasattr(clarify_model_monitor_cls, "_TEST_CLASS"):
598+
continue
596599
with pytest.raises(TypeError):
597600
clarify_model_monitor_cls.attach(SCHEDULE_NAME, sagemaker_session)
598601

tests/unit/sagemaker/remote_function/test_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,7 @@ def test_consistency_between_remote_and_step_decorator():
15041504
"s3_kms_key",
15051505
"s3_root_uri",
15061506
"sagemaker_session",
1507+
"disable_output_compression",
15071508
"use_torchrun",
15081509
"use_mpirun",
15091510
"nproc_per_node",

0 commit comments

Comments
 (0)