Skip to content

Commit 8bf0026

Browse files
authored
Merge branch 'master' into master
2 parents 1918a96 + 96e49ba commit 8bf0026

File tree

20 files changed

+237
-56
lines changed

20 files changed

+237
-56
lines changed

doc/frameworks/tensorflow/using_tf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Training with parameter servers
246246

247247
If you specify parameter_server as the value of the distribution parameter, the container launches a parameter server
248248
thread on each instance in the training cluster, and then executes your training code. You can find more information on
249-
TensorFlow distributed training at `TensorFlow docs <https://www.tensorflow.org/deploy/distributed>`__.
249+
TensorFlow distributed training at `TensorFlow docs <https://www.tensorflow.org/guide/distributed_training>`__.
250250
To enable parameter server training:
251251

252252
.. code:: python

doc/overview.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,15 +1958,15 @@ Make sure to have a Compose Version compatible with your Docker Engine installat
19581958
Local mode configuration
19591959
========================
19601960

1961-
The local mode uses a YAML configuration file located at ``~/.sagemaker/config.yaml`` to define the default values that are automatically passed to the ``config`` attribute of ``LocalSession``. This is an example of the configuration, for the full schema, see `sagemaker.config.config_schema.SAGEMAKER_PYTHON_SDK_LOCAL_MODE_CONFIG_SCHEMA <https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/config/config_schema.py>`_.
1961+
The local mode uses a YAML configuration file located at ``${user_config_directory}/sagemaker/config.yaml`` to define the default values that are automatically passed to the ``config`` attribute of ``LocalSession``. This is an example of the configuration, for the full schema, see `sagemaker.config.config_schema.SAGEMAKER_PYTHON_SDK_LOCAL_MODE_CONFIG_SCHEMA <https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/config/config_schema.py>`_.
19621962

19631963
.. code:: yaml
19641964
19651965
local:
19661966
local_code: true # Using everything locally
19671967
region_name: "us-west-2" # Name of the region
19681968
container_config: # Additional docker container config
1969-
shm_size: "128M
1969+
shm_size: "128M"
19701970
19711971
If you want to keep everything local, and not use Amazon S3 either, you can enable "local code" in one of two ways:
19721972

src/sagemaker/estimator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ def __init__(
387387
source_dir (str or PipelineVariable): The absolute, relative, or S3 URI Path to
388388
a directory with any other training source code dependencies aside from the entry
389389
point file (default: None). If ``source_dir`` is an S3 URI, it must
390-
point to a tar.gz file. The structure within this directory is preserved
391-
when training on Amazon SageMaker. If 'git_config' is provided,
390+
point to a file with name ``sourcedir.tar.gz``. The structure within this directory
391+
is preserved when training on Amazon SageMaker. If 'git_config' is provided,
392392
'source_dir' should be a relative location to a directory in the Git
393393
repo.
394394
With the following GitHub repo directory structure:
@@ -3421,8 +3421,8 @@ def __init__(
34213421
source_dir (str or PipelineVariable): Path (absolute, relative or an S3 URI)
34223422
to a directory with any other training source code dependencies aside from
34233423
the entry point file (default: None). If ``source_dir`` is an S3 URI, it must
3424-
point to a tar.gz file. Structure within this directory are preserved
3425-
when training on Amazon SageMaker. If 'git_config' is provided,
3424+
point to a file with name ``sourcedir.tar.gz``. Structure within this directory
3425+
are preserved when training on Amazon SageMaker. If 'git_config' is provided,
34263426
'source_dir' should be a relative location to a directory in the Git
34273427
repo.
34283428

src/sagemaker/feature_store/feature_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ def __str__(self) -> str:
631631
class FeatureGroup:
632632
"""FeatureGroup definition.
633633
634-
This class instantiates a FeatureGroup object that comprises of a name for the FeatureGroup,
634+
This class instantiates a FeatureGroup object that comprises a name for the FeatureGroup,
635635
session instance, and a list of feature definition objects i.e., FeatureDefinition.
636636
637637
Attributes:

src/sagemaker/fw_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def validate_source_code_input_against_pipeline_variables(
252252
logger.warning(
253253
"The source_dir is a pipeline variable: %s. During pipeline execution, "
254254
"the interpreted value of source_dir has to be an S3 URI and "
255-
"must point to a tar.gz file",
255+
"must point to a file with name ``sourcedir.tar.gz``",
256256
type(source_dir),
257257
)
258258

src/sagemaker/huggingface/estimator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def __init__(
8484
source_dir (str or PipelineVariable): Path (absolute, relative or an S3 URI) to a
8585
directory with any other training source code dependencies aside from the entry
8686
point file (default: None). If ``source_dir`` is an S3 URI, it must
87-
point to a tar.gz file. Structure within this directory are preserved
88-
when training on Amazon SageMaker.
87+
point to a file with name ``sourcedir.tar.gz``. Structure within this directory are
88+
preserved when training on Amazon SageMaker.
8989
hyperparameters (dict[str, str] or dict[str, PipelineVariable]): Hyperparameters
9090
that will be used for training (default: None). The hyperparameters are made
9191
accessible as a dict[str, str] to the training code on

src/sagemaker/jumpstart/cache.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def _model_id_retrieval_function(
263263
return JumpStartVersionedModelId(model_id, sm_compatible_model_version)
264264

265265
versions_incompatible_with_sagemaker = [
266-
Version(header.version)
266+
header.version
267267
for header in manifest.values() # type: ignore
268268
if header.model_id == model_id
269269
]
@@ -541,9 +541,7 @@ def _select_version(
541541
"""
542542

543543
if version_str == "*":
544-
if len(available_versions) == 0:
545-
return None
546-
return str(max(available_versions))
544+
return utils.get_latest_version(available_versions)
547545

548546
if model_type == JumpStartModelType.PROPRIETARY:
549547
if "*" in version_str:

src/sagemaker/jumpstart/estimator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ def __init__(
350350
source_dir (Optional[Union[str, PipelineVariable]]): The absolute, relative, or
351351
S3 URI Path to a directory with any other training source code dependencies
352352
aside from the entry point file. If ``source_dir`` is an S3 URI, it must
353-
point to a tar.gz file. Structure within this directory is preserved
354-
when training on Amazon SageMaker. If 'git_config' is provided,
353+
point to a file with name ``sourcedir.tar.gz``. Structure within this directory
354+
is preserved when training on Amazon SageMaker. If 'git_config' is provided,
355355
'source_dir' should be a relative location to a directory in the Git
356356
repo.
357357
(Default: None).
@@ -947,8 +947,8 @@ def deploy(
947947
source_dir (Optional[str]): The absolute, relative, or S3 URI Path to a directory
948948
with any other training source code dependencies aside from the entry
949949
point file (Default: None). If ``source_dir`` is an S3 URI, it must
950-
point to a tar.gz file. Structure within this directory is preserved
951-
when training on Amazon SageMaker. If 'git_config' is provided,
950+
point to a file with name ``sourcedir.tar.gz``. Structure within this directory is
951+
preserved when training on Amazon SageMaker. If 'git_config' is provided,
952952
'source_dir' should be a relative location to a directory in the Git repo.
953953
If the directory points to S3, no code is uploaded and the S3 location
954954
is used instead. (Default: None).

src/sagemaker/jumpstart/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ def __init__(
178178
source_dir (Optional[str]): The absolute, relative, or S3 URI Path to a directory
179179
with any other training source code dependencies aside from the entry
180180
point file (Default: None). If ``source_dir`` is an S3 URI, it must
181-
point to a tar.gz file. Structure within this directory is preserved
182-
when training on Amazon SageMaker. If 'git_config' is provided,
181+
point to a file with name ``sourcedir.tar.gz``. Structure within this directory is
182+
preserved when training on Amazon SageMaker. If 'git_config' is provided,
183183
'source_dir' should be a relative location to a directory in the Git repo.
184184
If the directory points to S3, no code is uploaded and the S3 location
185185
is used instead. (Default: None).

src/sagemaker/jumpstart/utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from urllib.parse import urlparse
2222
import boto3
2323
from botocore.exceptions import ClientError
24-
from packaging.version import Version
24+
from packaging.version import Version, InvalidVersion
2525
import botocore
2626
from sagemaker_core.shapes import ModelAccessConfig
2727
import sagemaker
@@ -1630,3 +1630,11 @@ def get_draft_model_content_bucket(provider: Dict, region: str) -> str:
16301630
return get_jumpstart_gated_content_bucket(region=region)
16311631
return get_jumpstart_content_bucket(region=region)
16321632
return neo_bucket
1633+
1634+
1635+
def get_latest_version(versions: List[str]) -> Optional[str]:
1636+
"""Returns the latest version using sem-ver when possible."""
1637+
try:
1638+
return None if not versions else max(versions, key=Version)
1639+
except InvalidVersion:
1640+
return max(versions)

0 commit comments

Comments
 (0)