repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | HyperparameterTuningJobAnalytics._fetch_dataframe | def _fetch_dataframe(self):
"""Return a pandas dataframe with all the training jobs, along with their
hyperparameters, results, and metadata. This also includes a column to indicate
if a training job was the best seen so far.
"""
def reshape(training_summary):
# Helpe... | python | def _fetch_dataframe(self):
"""Return a pandas dataframe with all the training jobs, along with their
hyperparameters, results, and metadata. This also includes a column to indicate
if a training job was the best seen so far.
"""
def reshape(training_summary):
# Helpe... | [
"def",
"_fetch_dataframe",
"(",
"self",
")",
":",
"def",
"reshape",
"(",
"training_summary",
")",
":",
"# Helper method to reshape a single training job summary into a dataframe record",
"out",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"training_summary",
"[",
"'Tune... | Return a pandas dataframe with all the training jobs, along with their
hyperparameters, results, and metadata. This also includes a column to indicate
if a training job was the best seen so far. | [
"Return",
"a",
"pandas",
"dataframe",
"with",
"all",
"the",
"training",
"jobs",
"along",
"with",
"their",
"hyperparameters",
"results",
"and",
"metadata",
".",
"This",
"also",
"includes",
"a",
"column",
"to",
"indicate",
"if",
"a",
"training",
"job",
"was",
... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L109-L138 | train |
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | HyperparameterTuningJobAnalytics.tuning_ranges | def tuning_ranges(self):
"""A dictionary describing the ranges of all tuned hyperparameters.
The keys are the names of the hyperparameter, and the values are the ranges.
"""
out = {}
for _, ranges in self.description()['HyperParameterTuningJobConfig']['ParameterRanges'].items():
... | python | def tuning_ranges(self):
"""A dictionary describing the ranges of all tuned hyperparameters.
The keys are the names of the hyperparameter, and the values are the ranges.
"""
out = {}
for _, ranges in self.description()['HyperParameterTuningJobConfig']['ParameterRanges'].items():
... | [
"def",
"tuning_ranges",
"(",
"self",
")",
":",
"out",
"=",
"{",
"}",
"for",
"_",
",",
"ranges",
"in",
"self",
".",
"description",
"(",
")",
"[",
"'HyperParameterTuningJobConfig'",
"]",
"[",
"'ParameterRanges'",
"]",
".",
"items",
"(",
")",
":",
"for",
... | A dictionary describing the ranges of all tuned hyperparameters.
The keys are the names of the hyperparameter, and the values are the ranges. | [
"A",
"dictionary",
"describing",
"the",
"ranges",
"of",
"all",
"tuned",
"hyperparameters",
".",
"The",
"keys",
"are",
"the",
"names",
"of",
"the",
"hyperparameter",
"and",
"the",
"values",
"are",
"the",
"ranges",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L141-L149 | train |
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | HyperparameterTuningJobAnalytics.description | def description(self, force_refresh=False):
"""Call ``DescribeHyperParameterTuningJob`` for the hyperparameter tuning job.
Args:
force_refresh (bool): Set to True to fetch the latest data from SageMaker API.
Returns:
dict: The Amazon SageMaker response for ``DescribeHyp... | python | def description(self, force_refresh=False):
"""Call ``DescribeHyperParameterTuningJob`` for the hyperparameter tuning job.
Args:
force_refresh (bool): Set to True to fetch the latest data from SageMaker API.
Returns:
dict: The Amazon SageMaker response for ``DescribeHyp... | [
"def",
"description",
"(",
"self",
",",
"force_refresh",
"=",
"False",
")",
":",
"if",
"force_refresh",
":",
"self",
".",
"clear_cache",
"(",
")",
"if",
"not",
"self",
".",
"_tuning_job_describe_result",
":",
"self",
".",
"_tuning_job_describe_result",
"=",
"s... | Call ``DescribeHyperParameterTuningJob`` for the hyperparameter tuning job.
Args:
force_refresh (bool): Set to True to fetch the latest data from SageMaker API.
Returns:
dict: The Amazon SageMaker response for ``DescribeHyperParameterTuningJob``. | [
"Call",
"DescribeHyperParameterTuningJob",
"for",
"the",
"hyperparameter",
"tuning",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L151-L166 | train |
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | HyperparameterTuningJobAnalytics.training_job_summaries | def training_job_summaries(self, force_refresh=False):
"""A (paginated) list of everything from ``ListTrainingJobsForTuningJob``.
Args:
force_refresh (bool): Set to True to fetch the latest data from SageMaker API.
Returns:
dict: The Amazon SageMaker response for ``List... | python | def training_job_summaries(self, force_refresh=False):
"""A (paginated) list of everything from ``ListTrainingJobsForTuningJob``.
Args:
force_refresh (bool): Set to True to fetch the latest data from SageMaker API.
Returns:
dict: The Amazon SageMaker response for ``List... | [
"def",
"training_job_summaries",
"(",
"self",
",",
"force_refresh",
"=",
"False",
")",
":",
"if",
"force_refresh",
":",
"self",
".",
"clear_cache",
"(",
")",
"if",
"self",
".",
"_training_job_summaries",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_tra... | A (paginated) list of everything from ``ListTrainingJobsForTuningJob``.
Args:
force_refresh (bool): Set to True to fetch the latest data from SageMaker API.
Returns:
dict: The Amazon SageMaker response for ``ListTrainingJobsForTuningJob``. | [
"A",
"(",
"paginated",
")",
"list",
"of",
"everything",
"from",
"ListTrainingJobsForTuningJob",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L168-L196 | train |
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | TrainingJobAnalytics.clear_cache | def clear_cache(self):
"""Clear the object of all local caches of API methods, so
that the next time any properties are accessed they will be refreshed from
the service.
"""
super(TrainingJobAnalytics, self).clear_cache()
self._data = defaultdict(list)
self._time_... | python | def clear_cache(self):
"""Clear the object of all local caches of API methods, so
that the next time any properties are accessed they will be refreshed from
the service.
"""
super(TrainingJobAnalytics, self).clear_cache()
self._data = defaultdict(list)
self._time_... | [
"def",
"clear_cache",
"(",
"self",
")",
":",
"super",
"(",
"TrainingJobAnalytics",
",",
"self",
")",
".",
"clear_cache",
"(",
")",
"self",
".",
"_data",
"=",
"defaultdict",
"(",
"list",
")",
"self",
".",
"_time_interval",
"=",
"self",
".",
"_determine_time... | Clear the object of all local caches of API methods, so
that the next time any properties are accessed they will be refreshed from
the service. | [
"Clear",
"the",
"object",
"of",
"all",
"local",
"caches",
"of",
"API",
"methods",
"so",
"that",
"the",
"next",
"time",
"any",
"properties",
"are",
"accessed",
"they",
"will",
"be",
"refreshed",
"from",
"the",
"service",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L240-L247 | train |
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | TrainingJobAnalytics._determine_timeinterval | def _determine_timeinterval(self):
"""Return a dictionary with two datetime objects, start_time and end_time,
covering the interval of the training job
"""
description = self._sage_client.describe_training_job(TrainingJobName=self.name)
start_time = self._start_time or descriptio... | python | def _determine_timeinterval(self):
"""Return a dictionary with two datetime objects, start_time and end_time,
covering the interval of the training job
"""
description = self._sage_client.describe_training_job(TrainingJobName=self.name)
start_time = self._start_time or descriptio... | [
"def",
"_determine_timeinterval",
"(",
"self",
")",
":",
"description",
"=",
"self",
".",
"_sage_client",
".",
"describe_training_job",
"(",
"TrainingJobName",
"=",
"self",
".",
"name",
")",
"start_time",
"=",
"self",
".",
"_start_time",
"or",
"description",
"["... | Return a dictionary with two datetime objects, start_time and end_time,
covering the interval of the training job | [
"Return",
"a",
"dictionary",
"with",
"two",
"datetime",
"objects",
"start_time",
"and",
"end_time",
"covering",
"the",
"interval",
"of",
"the",
"training",
"job"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L249-L266 | train |
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | TrainingJobAnalytics._fetch_metric | def _fetch_metric(self, metric_name):
"""Fetch all the values of a named metric, and add them to _data
"""
request = {
'Namespace': self.CLOUDWATCH_NAMESPACE,
'MetricName': metric_name,
'Dimensions': [
{
'Name': 'TrainingJob... | python | def _fetch_metric(self, metric_name):
"""Fetch all the values of a named metric, and add them to _data
"""
request = {
'Namespace': self.CLOUDWATCH_NAMESPACE,
'MetricName': metric_name,
'Dimensions': [
{
'Name': 'TrainingJob... | [
"def",
"_fetch_metric",
"(",
"self",
",",
"metric_name",
")",
":",
"request",
"=",
"{",
"'Namespace'",
":",
"self",
".",
"CLOUDWATCH_NAMESPACE",
",",
"'MetricName'",
":",
"metric_name",
",",
"'Dimensions'",
":",
"[",
"{",
"'Name'",
":",
"'TrainingJobName'",
",... | Fetch all the values of a named metric, and add them to _data | [
"Fetch",
"all",
"the",
"values",
"of",
"a",
"named",
"metric",
"and",
"add",
"them",
"to",
"_data"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L273-L306 | train |
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | TrainingJobAnalytics._add_single_metric | def _add_single_metric(self, timestamp, metric_name, value):
"""Store a single metric in the _data dict which can be
converted to a dataframe.
"""
# note that this method is built this way to make it possible to
# support live-refreshing charts in Bokeh at some point in the futur... | python | def _add_single_metric(self, timestamp, metric_name, value):
"""Store a single metric in the _data dict which can be
converted to a dataframe.
"""
# note that this method is built this way to make it possible to
# support live-refreshing charts in Bokeh at some point in the futur... | [
"def",
"_add_single_metric",
"(",
"self",
",",
"timestamp",
",",
"metric_name",
",",
"value",
")",
":",
"# note that this method is built this way to make it possible to",
"# support live-refreshing charts in Bokeh at some point in the future.",
"self",
".",
"_data",
"[",
"'times... | Store a single metric in the _data dict which can be
converted to a dataframe. | [
"Store",
"a",
"single",
"metric",
"in",
"the",
"_data",
"dict",
"which",
"can",
"be",
"converted",
"to",
"a",
"dataframe",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L308-L316 | train |
aws/sagemaker-python-sdk | src/sagemaker/analytics.py | TrainingJobAnalytics._metric_names_for_training_job | def _metric_names_for_training_job(self):
"""Helper method to discover the metrics defined for a training job.
"""
training_description = self._sage_client.describe_training_job(TrainingJobName=self._training_job_name)
metric_definitions = training_description['AlgorithmSpecification'][... | python | def _metric_names_for_training_job(self):
"""Helper method to discover the metrics defined for a training job.
"""
training_description = self._sage_client.describe_training_job(TrainingJobName=self._training_job_name)
metric_definitions = training_description['AlgorithmSpecification'][... | [
"def",
"_metric_names_for_training_job",
"(",
"self",
")",
":",
"training_description",
"=",
"self",
".",
"_sage_client",
".",
"describe_training_job",
"(",
"TrainingJobName",
"=",
"self",
".",
"_training_job_name",
")",
"metric_definitions",
"=",
"training_description",
... | Helper method to discover the metrics defined for a training job. | [
"Helper",
"method",
"to",
"discover",
"the",
"metrics",
"defined",
"for",
"a",
"training",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/analytics.py#L318-L326 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | name_from_base | def name_from_base(base, max_length=63, short=False):
"""Append a timestamp to the provided string.
This function assures that the total length of the resulting string is not
longer than the specified max length, trimming the input parameter if necessary.
Args:
base (str): String used as prefi... | python | def name_from_base(base, max_length=63, short=False):
"""Append a timestamp to the provided string.
This function assures that the total length of the resulting string is not
longer than the specified max length, trimming the input parameter if necessary.
Args:
base (str): String used as prefi... | [
"def",
"name_from_base",
"(",
"base",
",",
"max_length",
"=",
"63",
",",
"short",
"=",
"False",
")",
":",
"timestamp",
"=",
"sagemaker_short_timestamp",
"(",
")",
"if",
"short",
"else",
"sagemaker_timestamp",
"(",
")",
"trimmed_base",
"=",
"base",
"[",
":",
... | Append a timestamp to the provided string.
This function assures that the total length of the resulting string is not
longer than the specified max length, trimming the input parameter if necessary.
Args:
base (str): String used as prefix to generate the unique name.
max_length (int): Maxi... | [
"Append",
"a",
"timestamp",
"to",
"the",
"provided",
"string",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L46-L62 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | base_name_from_image | def base_name_from_image(image):
"""Extract the base name of the image to use as the 'algorithm name' for the job.
Args:
image (str): Image name.
Returns:
str: Algorithm name, as extracted from the image name.
"""
m = re.match("^(.+/)?([^:/]+)(:[^:]+)?$", image)
algo_name = m.g... | python | def base_name_from_image(image):
"""Extract the base name of the image to use as the 'algorithm name' for the job.
Args:
image (str): Image name.
Returns:
str: Algorithm name, as extracted from the image name.
"""
m = re.match("^(.+/)?([^:/]+)(:[^:]+)?$", image)
algo_name = m.g... | [
"def",
"base_name_from_image",
"(",
"image",
")",
":",
"m",
"=",
"re",
".",
"match",
"(",
"\"^(.+/)?([^:/]+)(:[^:]+)?$\"",
",",
"image",
")",
"algo_name",
"=",
"m",
".",
"group",
"(",
"2",
")",
"if",
"m",
"else",
"image",
"return",
"algo_name"
] | Extract the base name of the image to use as the 'algorithm name' for the job.
Args:
image (str): Image name.
Returns:
str: Algorithm name, as extracted from the image name. | [
"Extract",
"the",
"base",
"name",
"of",
"the",
"image",
"to",
"use",
"as",
"the",
"algorithm",
"name",
"for",
"the",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L73-L84 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | sagemaker_timestamp | def sagemaker_timestamp():
"""Return a timestamp with millisecond precision."""
moment = time.time()
moment_ms = repr(moment).split('.')[1][:3]
return time.strftime("%Y-%m-%d-%H-%M-%S-{}".format(moment_ms), time.gmtime(moment)) | python | def sagemaker_timestamp():
"""Return a timestamp with millisecond precision."""
moment = time.time()
moment_ms = repr(moment).split('.')[1][:3]
return time.strftime("%Y-%m-%d-%H-%M-%S-{}".format(moment_ms), time.gmtime(moment)) | [
"def",
"sagemaker_timestamp",
"(",
")",
":",
"moment",
"=",
"time",
".",
"time",
"(",
")",
"moment_ms",
"=",
"repr",
"(",
"moment",
")",
".",
"split",
"(",
"'.'",
")",
"[",
"1",
"]",
"[",
":",
"3",
"]",
"return",
"time",
".",
"strftime",
"(",
"\"... | Return a timestamp with millisecond precision. | [
"Return",
"a",
"timestamp",
"with",
"millisecond",
"precision",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L87-L91 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | debug | def debug(func):
"""Print the function name and arguments for debugging."""
@wraps(func)
def wrapper(*args, **kwargs):
print("{} args: {} kwargs: {}".format(func.__name__, args, kwargs))
return func(*args, **kwargs)
return wrapper | python | def debug(func):
"""Print the function name and arguments for debugging."""
@wraps(func)
def wrapper(*args, **kwargs):
print("{} args: {} kwargs: {}".format(func.__name__, args, kwargs))
return func(*args, **kwargs)
return wrapper | [
"def",
"debug",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"print",
"(",
"\"{} args: {} kwargs: {}\"",
".",
"format",
"(",
"func",
".",
"__name__",
",",
"args",
",",
... | Print the function name and arguments for debugging. | [
"Print",
"the",
"function",
"name",
"and",
"arguments",
"for",
"debugging",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L99-L106 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | to_str | def to_str(value):
"""Convert the input to a string, unless it is a unicode string in Python 2.
Unicode strings are supported as native strings in Python 3, but ``str()`` cannot be
invoked on unicode strings in Python 2, so we need to check for that case when
converting user-specified values to strings... | python | def to_str(value):
"""Convert the input to a string, unless it is a unicode string in Python 2.
Unicode strings are supported as native strings in Python 3, but ``str()`` cannot be
invoked on unicode strings in Python 2, so we need to check for that case when
converting user-specified values to strings... | [
"def",
"to_str",
"(",
"value",
")",
":",
"if",
"sys",
".",
"version_info",
".",
"major",
"<",
"3",
"and",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"return",
"value",
"return",
"str",
"(",
"value",
")"
] | Convert the input to a string, unless it is a unicode string in Python 2.
Unicode strings are supported as native strings in Python 3, but ``str()`` cannot be
invoked on unicode strings in Python 2, so we need to check for that case when
converting user-specified values to strings.
Args:
value... | [
"Convert",
"the",
"input",
"to",
"a",
"string",
"unless",
"it",
"is",
"a",
"unicode",
"string",
"in",
"Python",
"2",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L123-L138 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | extract_name_from_job_arn | def extract_name_from_job_arn(arn):
"""Returns the name used in the API given a full ARN for a training job
or hyperparameter tuning job.
"""
slash_pos = arn.find('/')
if slash_pos == -1:
raise ValueError("Cannot parse invalid ARN: %s" % arn)
return arn[(slash_pos + 1):] | python | def extract_name_from_job_arn(arn):
"""Returns the name used in the API given a full ARN for a training job
or hyperparameter tuning job.
"""
slash_pos = arn.find('/')
if slash_pos == -1:
raise ValueError("Cannot parse invalid ARN: %s" % arn)
return arn[(slash_pos + 1):] | [
"def",
"extract_name_from_job_arn",
"(",
"arn",
")",
":",
"slash_pos",
"=",
"arn",
".",
"find",
"(",
"'/'",
")",
"if",
"slash_pos",
"==",
"-",
"1",
":",
"raise",
"ValueError",
"(",
"\"Cannot parse invalid ARN: %s\"",
"%",
"arn",
")",
"return",
"arn",
"[",
... | Returns the name used in the API given a full ARN for a training job
or hyperparameter tuning job. | [
"Returns",
"the",
"name",
"used",
"in",
"the",
"API",
"given",
"a",
"full",
"ARN",
"for",
"a",
"training",
"job",
"or",
"hyperparameter",
"tuning",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L141-L148 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | secondary_training_status_message | def secondary_training_status_message(job_description, prev_description):
"""Returns a string contains last modified time and the secondary training job status message.
Args:
job_description: Returned response from DescribeTrainingJob call
prev_description: Previous job description from Describ... | python | def secondary_training_status_message(job_description, prev_description):
"""Returns a string contains last modified time and the secondary training job status message.
Args:
job_description: Returned response from DescribeTrainingJob call
prev_description: Previous job description from Describ... | [
"def",
"secondary_training_status_message",
"(",
"job_description",
",",
"prev_description",
")",
":",
"if",
"job_description",
"is",
"None",
"or",
"job_description",
".",
"get",
"(",
"'SecondaryStatusTransitions'",
")",
"is",
"None",
"or",
"len",
"(",
"job_descriptio... | Returns a string contains last modified time and the secondary training job status message.
Args:
job_description: Returned response from DescribeTrainingJob call
prev_description: Previous job description from DescribeTrainingJob call
Returns:
str: Job status string to be printed. | [
"Returns",
"a",
"string",
"contains",
"last",
"modified",
"time",
"and",
"the",
"secondary",
"training",
"job",
"status",
"message",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L177-L213 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | download_folder | def download_folder(bucket_name, prefix, target, sagemaker_session):
"""Download a folder from S3 to a local path
Args:
bucket_name (str): S3 bucket name
prefix (str): S3 prefix within the bucket that will be downloaded. Can be a single file.
target (str): destination path where the dow... | python | def download_folder(bucket_name, prefix, target, sagemaker_session):
"""Download a folder from S3 to a local path
Args:
bucket_name (str): S3 bucket name
prefix (str): S3 prefix within the bucket that will be downloaded. Can be a single file.
target (str): destination path where the dow... | [
"def",
"download_folder",
"(",
"bucket_name",
",",
"prefix",
",",
"target",
",",
"sagemaker_session",
")",
":",
"boto_session",
"=",
"sagemaker_session",
".",
"boto_session",
"s3",
"=",
"boto_session",
".",
"resource",
"(",
"'s3'",
")",
"bucket",
"=",
"s3",
".... | Download a folder from S3 to a local path
Args:
bucket_name (str): S3 bucket name
prefix (str): S3 prefix within the bucket that will be downloaded. Can be a single file.
target (str): destination path where the downloaded items will be placed
sagemaker_session (:class:`sagemaker.se... | [
"Download",
"a",
"folder",
"from",
"S3",
"to",
"a",
"local",
"path"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L216-L256 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | create_tar_file | def create_tar_file(source_files, target=None):
"""Create a tar file containing all the source_files
Args:
source_files (List[str]): List of file paths that will be contained in the tar file
Returns:
(str): path to created tar file
"""
if target:
filename = target
els... | python | def create_tar_file(source_files, target=None):
"""Create a tar file containing all the source_files
Args:
source_files (List[str]): List of file paths that will be contained in the tar file
Returns:
(str): path to created tar file
"""
if target:
filename = target
els... | [
"def",
"create_tar_file",
"(",
"source_files",
",",
"target",
"=",
"None",
")",
":",
"if",
"target",
":",
"filename",
"=",
"target",
"else",
":",
"_",
",",
"filename",
"=",
"tempfile",
".",
"mkstemp",
"(",
")",
"with",
"tarfile",
".",
"open",
"(",
"fil... | Create a tar file containing all the source_files
Args:
source_files (List[str]): List of file paths that will be contained in the tar file
Returns:
(str): path to created tar file | [
"Create",
"a",
"tar",
"file",
"containing",
"all",
"the",
"source_files"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L259-L278 | train |
aws/sagemaker-python-sdk | src/sagemaker/utils.py | download_file | def download_file(bucket_name, path, target, sagemaker_session):
"""Download a Single File from S3 into a local path
Args:
bucket_name (str): S3 bucket name
path (str): file path within the bucket
target (str): destination directory for the downloaded file.
sagemaker_session (:c... | python | def download_file(bucket_name, path, target, sagemaker_session):
"""Download a Single File from S3 into a local path
Args:
bucket_name (str): S3 bucket name
path (str): file path within the bucket
target (str): destination directory for the downloaded file.
sagemaker_session (:c... | [
"def",
"download_file",
"(",
"bucket_name",
",",
"path",
",",
"target",
",",
"sagemaker_session",
")",
":",
"path",
"=",
"path",
".",
"lstrip",
"(",
"'/'",
")",
"boto_session",
"=",
"sagemaker_session",
".",
"boto_session",
"s3",
"=",
"boto_session",
".",
"r... | Download a Single File from S3 into a local path
Args:
bucket_name (str): S3 bucket name
path (str): file path within the bucket
target (str): destination directory for the downloaded file.
sagemaker_session (:class:`sagemaker.session.Session`): a sagemaker session to interact with ... | [
"Download",
"a",
"Single",
"File",
"from",
"S3",
"into",
"a",
"local",
"path"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/utils.py#L281-L295 | train |
aws/sagemaker-python-sdk | src/sagemaker/tensorflow/estimator.py | Tensorboard._sync_directories | def _sync_directories(from_directory, to_directory):
"""Sync to_directory with from_directory by copying each file in
to_directory with new contents. Files in to_directory will be
overwritten by files of the same name in from_directory. We need to
keep two copies of the log directory bec... | python | def _sync_directories(from_directory, to_directory):
"""Sync to_directory with from_directory by copying each file in
to_directory with new contents. Files in to_directory will be
overwritten by files of the same name in from_directory. We need to
keep two copies of the log directory bec... | [
"def",
"_sync_directories",
"(",
"from_directory",
",",
"to_directory",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"to_directory",
")",
":",
"os",
".",
"mkdir",
"(",
"to_directory",
")",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
... | Sync to_directory with from_directory by copying each file in
to_directory with new contents. Files in to_directory will be
overwritten by files of the same name in from_directory. We need to
keep two copies of the log directory because otherwise TensorBoard
picks up temp files from `aws... | [
"Sync",
"to_directory",
"with",
"from_directory",
"by",
"copying",
"each",
"file",
"in",
"to_directory",
"with",
"new",
"contents",
".",
"Files",
"in",
"to_directory",
"will",
"be",
"overwritten",
"by",
"files",
"of",
"the",
"same",
"name",
"in",
"from_directory... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tensorflow/estimator.py#L66-L92 | train |
aws/sagemaker-python-sdk | src/sagemaker/tensorflow/estimator.py | Tensorboard.create_tensorboard_process | def create_tensorboard_process(self):
"""Create a TensorBoard process.
Returns:
tuple: A tuple containing:
int: The port number.
process: The TensorBoard process.
Raises:
OSError: If no ports between 6006 and 6105 are available for starti... | python | def create_tensorboard_process(self):
"""Create a TensorBoard process.
Returns:
tuple: A tuple containing:
int: The port number.
process: The TensorBoard process.
Raises:
OSError: If no ports between 6006 and 6105 are available for starti... | [
"def",
"create_tensorboard_process",
"(",
"self",
")",
":",
"port",
"=",
"6006",
"for",
"_",
"in",
"range",
"(",
"100",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"tensorboard\"",
",",
"\"--logdir\"",
",",
"self",
".",
"logdir",
",",
"... | Create a TensorBoard process.
Returns:
tuple: A tuple containing:
int: The port number.
process: The TensorBoard process.
Raises:
OSError: If no ports between 6006 and 6105 are available for starting TensorBoard. | [
"Create",
"a",
"TensorBoard",
"process",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tensorflow/estimator.py#L124-L151 | train |
aws/sagemaker-python-sdk | src/sagemaker/tensorflow/estimator.py | Tensorboard.run | def run(self):
"""Run TensorBoard process."""
port, tensorboard_process = self.create_tensorboard_process()
LOGGER.info('TensorBoard 0.1.7 at http://localhost:{}'.format(port))
while not self.estimator.checkpoint_path:
self.event.wait(1)
with self._temporary_director... | python | def run(self):
"""Run TensorBoard process."""
port, tensorboard_process = self.create_tensorboard_process()
LOGGER.info('TensorBoard 0.1.7 at http://localhost:{}'.format(port))
while not self.estimator.checkpoint_path:
self.event.wait(1)
with self._temporary_director... | [
"def",
"run",
"(",
"self",
")",
":",
"port",
",",
"tensorboard_process",
"=",
"self",
".",
"create_tensorboard_process",
"(",
")",
"LOGGER",
".",
"info",
"(",
"'TensorBoard 0.1.7 at http://localhost:{}'",
".",
"format",
"(",
"port",
")",
")",
"while",
"not",
"... | Run TensorBoard process. | [
"Run",
"TensorBoard",
"process",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tensorflow/estimator.py#L153-L166 | train |
aws/sagemaker-python-sdk | src/sagemaker/tensorflow/estimator.py | TensorFlow.fit | def fit(self, inputs=None, wait=True, logs=True, job_name=None, run_tensorboard_locally=False):
"""Train a model using the input training dataset.
See :func:`~sagemaker.estimator.EstimatorBase.fit` for more details.
Args:
inputs (str or dict or sagemaker.session.s3_input): Informat... | python | def fit(self, inputs=None, wait=True, logs=True, job_name=None, run_tensorboard_locally=False):
"""Train a model using the input training dataset.
See :func:`~sagemaker.estimator.EstimatorBase.fit` for more details.
Args:
inputs (str or dict or sagemaker.session.s3_input): Informat... | [
"def",
"fit",
"(",
"self",
",",
"inputs",
"=",
"None",
",",
"wait",
"=",
"True",
",",
"logs",
"=",
"True",
",",
"job_name",
"=",
"None",
",",
"run_tensorboard_locally",
"=",
"False",
")",
":",
"def",
"fit_super",
"(",
")",
":",
"super",
"(",
"TensorF... | Train a model using the input training dataset.
See :func:`~sagemaker.estimator.EstimatorBase.fit` for more details.
Args:
inputs (str or dict or sagemaker.session.s3_input): Information about the training data.
This can be one of three types:
* (str) - the... | [
"Train",
"a",
"model",
"using",
"the",
"input",
"training",
"dataset",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tensorflow/estimator.py#L289-L338 | train |
aws/sagemaker-python-sdk | src/sagemaker/tensorflow/estimator.py | TensorFlow._prepare_init_params_from_job_description | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
Returns:
... | python | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
Returns:
... | [
"def",
"_prepare_init_params_from_job_description",
"(",
"cls",
",",
"job_details",
",",
"model_channel_name",
"=",
"None",
")",
":",
"init_params",
"=",
"super",
"(",
"TensorFlow",
",",
"cls",
")",
".",
"_prepare_init_params_from_job_description",
"(",
"job_details",
... | Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
Returns:
dictionary: The transformed init_params | [
"Convert",
"the",
"job",
"description",
"to",
"init",
"params",
"that",
"can",
"be",
"handled",
"by",
"the",
"class",
"constructor"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tensorflow/estimator.py#L341-L385 | train |
aws/sagemaker-python-sdk | src/sagemaker/tensorflow/estimator.py | TensorFlow.create_model | def create_model(self, model_server_workers=None, role=None,
vpc_config_override=VPC_CONFIG_DEFAULT, endpoint_type=None):
"""Create a SageMaker ``TensorFlowModel`` object that can be deployed to an ``Endpoint``.
Args:
role (str): The ``ExecutionRoleArn`` IAM Role ARN fo... | python | def create_model(self, model_server_workers=None, role=None,
vpc_config_override=VPC_CONFIG_DEFAULT, endpoint_type=None):
"""Create a SageMaker ``TensorFlowModel`` object that can be deployed to an ``Endpoint``.
Args:
role (str): The ``ExecutionRoleArn`` IAM Role ARN fo... | [
"def",
"create_model",
"(",
"self",
",",
"model_server_workers",
"=",
"None",
",",
"role",
"=",
"None",
",",
"vpc_config_override",
"=",
"VPC_CONFIG_DEFAULT",
",",
"endpoint_type",
"=",
"None",
")",
":",
"role",
"=",
"role",
"or",
"self",
".",
"role",
"if",
... | Create a SageMaker ``TensorFlowModel`` object that can be deployed to an ``Endpoint``.
Args:
role (str): The ``ExecutionRoleArn`` IAM Role ARN for the ``Model``, which is also used during
transform jobs. If not specified, the role from the Estimator will be used.
model_s... | [
"Create",
"a",
"SageMaker",
"TensorFlowModel",
"object",
"that",
"can",
"be",
"deployed",
"to",
"an",
"Endpoint",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tensorflow/estimator.py#L387-L415 | train |
aws/sagemaker-python-sdk | src/sagemaker/tensorflow/estimator.py | TensorFlow.hyperparameters | def hyperparameters(self):
"""Return hyperparameters used by your custom TensorFlow code during model training."""
hyperparameters = super(TensorFlow, self).hyperparameters()
self.checkpoint_path = self.checkpoint_path or self._default_s3_path('checkpoints')
mpi_enabled = False
... | python | def hyperparameters(self):
"""Return hyperparameters used by your custom TensorFlow code during model training."""
hyperparameters = super(TensorFlow, self).hyperparameters()
self.checkpoint_path = self.checkpoint_path or self._default_s3_path('checkpoints')
mpi_enabled = False
... | [
"def",
"hyperparameters",
"(",
"self",
")",
":",
"hyperparameters",
"=",
"super",
"(",
"TensorFlow",
",",
"self",
")",
".",
"hyperparameters",
"(",
")",
"self",
".",
"checkpoint_path",
"=",
"self",
".",
"checkpoint_path",
"or",
"self",
".",
"_default_s3_path",... | Return hyperparameters used by your custom TensorFlow code during model training. | [
"Return",
"hyperparameters",
"used",
"by",
"your",
"custom",
"TensorFlow",
"code",
"during",
"model",
"training",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tensorflow/estimator.py#L442-L472 | train |
aws/sagemaker-python-sdk | src/sagemaker/vpc_utils.py | from_dict | def from_dict(vpc_config, do_sanitize=False):
"""
Extracts subnets and security group ids as lists from a VpcConfig dict
Args:
vpc_config (dict): a VpcConfig dict containing 'Subnets' and 'SecurityGroupIds'
do_sanitize (bool): whether to sanitize the VpcConfig dict before extracting values
... | python | def from_dict(vpc_config, do_sanitize=False):
"""
Extracts subnets and security group ids as lists from a VpcConfig dict
Args:
vpc_config (dict): a VpcConfig dict containing 'Subnets' and 'SecurityGroupIds'
do_sanitize (bool): whether to sanitize the VpcConfig dict before extracting values
... | [
"def",
"from_dict",
"(",
"vpc_config",
",",
"do_sanitize",
"=",
"False",
")",
":",
"if",
"do_sanitize",
":",
"vpc_config",
"=",
"sanitize",
"(",
"vpc_config",
")",
"if",
"vpc_config",
"is",
"None",
":",
"return",
"None",
",",
"None",
"return",
"vpc_config",
... | Extracts subnets and security group ids as lists from a VpcConfig dict
Args:
vpc_config (dict): a VpcConfig dict containing 'Subnets' and 'SecurityGroupIds'
do_sanitize (bool): whether to sanitize the VpcConfig dict before extracting values
Returns:
Tuple of lists as (subnets, security... | [
"Extracts",
"subnets",
"and",
"security",
"group",
"ids",
"as",
"lists",
"from",
"a",
"VpcConfig",
"dict"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/vpc_utils.py#L44-L64 | train |
aws/sagemaker-python-sdk | src/sagemaker/vpc_utils.py | sanitize | def sanitize(vpc_config):
"""
Checks that an instance of VpcConfig has the expected keys and values, removes unexpected keys,
and raises ValueErrors if any expectations are violated
Args:
vpc_config (dict): a VpcConfig dict containing 'Subnets' and 'SecurityGroupIds'
Returns:
A val... | python | def sanitize(vpc_config):
"""
Checks that an instance of VpcConfig has the expected keys and values, removes unexpected keys,
and raises ValueErrors if any expectations are violated
Args:
vpc_config (dict): a VpcConfig dict containing 'Subnets' and 'SecurityGroupIds'
Returns:
A val... | [
"def",
"sanitize",
"(",
"vpc_config",
")",
":",
"if",
"vpc_config",
"is",
"None",
":",
"return",
"vpc_config",
"elif",
"type",
"(",
"vpc_config",
")",
"is",
"not",
"dict",
":",
"raise",
"ValueError",
"(",
"'vpc_config is not a dict: {}'",
".",
"format",
"(",
... | Checks that an instance of VpcConfig has the expected keys and values, removes unexpected keys,
and raises ValueErrors if any expectations are violated
Args:
vpc_config (dict): a VpcConfig dict containing 'Subnets' and 'SecurityGroupIds'
Returns:
A valid VpcConfig dict containing only 'Sub... | [
"Checks",
"that",
"an",
"instance",
"of",
"VpcConfig",
"has",
"the",
"expected",
"keys",
"and",
"values",
"removes",
"unexpected",
"keys",
"and",
"raises",
"ValueErrors",
"if",
"any",
"expectations",
"are",
"violated"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/vpc_utils.py#L67-L108 | train |
aws/sagemaker-python-sdk | src/sagemaker/amazon/kmeans.py | KMeans.hyperparameters | def hyperparameters(self):
"""Return the SageMaker hyperparameters for training this KMeans Estimator"""
hp_dict = dict(force_dense='True') # KMeans requires this hp to fit on Record objects
hp_dict.update(super(KMeans, self).hyperparameters())
return hp_dict | python | def hyperparameters(self):
"""Return the SageMaker hyperparameters for training this KMeans Estimator"""
hp_dict = dict(force_dense='True') # KMeans requires this hp to fit on Record objects
hp_dict.update(super(KMeans, self).hyperparameters())
return hp_dict | [
"def",
"hyperparameters",
"(",
"self",
")",
":",
"hp_dict",
"=",
"dict",
"(",
"force_dense",
"=",
"'True'",
")",
"# KMeans requires this hp to fit on Record objects",
"hp_dict",
".",
"update",
"(",
"super",
"(",
"KMeans",
",",
"self",
")",
".",
"hyperparameters",
... | Return the SageMaker hyperparameters for training this KMeans Estimator | [
"Return",
"the",
"SageMaker",
"hyperparameters",
"for",
"training",
"this",
"KMeans",
"Estimator"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/amazon/kmeans.py#L122-L126 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | create_identical_dataset_and_algorithm_tuner | def create_identical_dataset_and_algorithm_tuner(parent, additional_parents=None, sagemaker_session=None):
"""Creates a new tuner by copying the request fields from the provided parent to the new instance of
``HyperparameterTuner`` followed by addition of warm start configuration with the type as
"I... | python | def create_identical_dataset_and_algorithm_tuner(parent, additional_parents=None, sagemaker_session=None):
"""Creates a new tuner by copying the request fields from the provided parent to the new instance of
``HyperparameterTuner`` followed by addition of warm start configuration with the type as
"I... | [
"def",
"create_identical_dataset_and_algorithm_tuner",
"(",
"parent",
",",
"additional_parents",
"=",
"None",
",",
"sagemaker_session",
"=",
"None",
")",
":",
"parent_tuner",
"=",
"HyperparameterTuner",
".",
"attach",
"(",
"tuning_job_name",
"=",
"parent",
",",
"sagem... | Creates a new tuner by copying the request fields from the provided parent to the new instance of
``HyperparameterTuner`` followed by addition of warm start configuration with the type as
"IdenticalDataAndAlgorithm" and ``parents`` as the union of provided list of ``additional_parents`` and the
... | [
"Creates",
"a",
"new",
"tuner",
"by",
"copying",
"the",
"request",
"fields",
"from",
"the",
"provided",
"parent",
"to",
"the",
"new",
"instance",
"of",
"HyperparameterTuner",
"followed",
"by",
"addition",
"of",
"warm",
"start",
"configuration",
"with",
"the",
... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L663-L683 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | create_transfer_learning_tuner | def create_transfer_learning_tuner(parent, additional_parents=None, estimator=None, sagemaker_session=None):
"""Creates a new ``HyperParameterTuner`` by copying the request fields from the provided parent to the new instance
of ``HyperparameterTuner`` followed by addition of warm start configuration with th... | python | def create_transfer_learning_tuner(parent, additional_parents=None, estimator=None, sagemaker_session=None):
"""Creates a new ``HyperParameterTuner`` by copying the request fields from the provided parent to the new instance
of ``HyperparameterTuner`` followed by addition of warm start configuration with th... | [
"def",
"create_transfer_learning_tuner",
"(",
"parent",
",",
"additional_parents",
"=",
"None",
",",
"estimator",
"=",
"None",
",",
"sagemaker_session",
"=",
"None",
")",
":",
"parent_tuner",
"=",
"HyperparameterTuner",
".",
"attach",
"(",
"tuning_job_name",
"=",
... | Creates a new ``HyperParameterTuner`` by copying the request fields from the provided parent to the new instance
of ``HyperparameterTuner`` followed by addition of warm start configuration with the type as "TransferLearning"
and ``parents`` as the union of provided list of ``additional_parents`` and the... | [
"Creates",
"a",
"new",
"HyperParameterTuner",
"by",
"copying",
"the",
"request",
"fields",
"from",
"the",
"provided",
"parent",
"to",
"the",
"new",
"instance",
"of",
"HyperparameterTuner",
"followed",
"by",
"addition",
"of",
"warm",
"start",
"configuration",
"with... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L686-L707 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | WarmStartConfig.from_job_desc | def from_job_desc(cls, warm_start_config):
"""Creates an instance of ``WarmStartConfig`` class, from warm start configuration response from
DescribeTrainingJob.
Args:
warm_start_config (dict): The expected format of the ``warm_start_config`` contains two first-class
fiel... | python | def from_job_desc(cls, warm_start_config):
"""Creates an instance of ``WarmStartConfig`` class, from warm start configuration response from
DescribeTrainingJob.
Args:
warm_start_config (dict): The expected format of the ``warm_start_config`` contains two first-class
fiel... | [
"def",
"from_job_desc",
"(",
"cls",
",",
"warm_start_config",
")",
":",
"if",
"not",
"warm_start_config",
"or",
"WARM_START_TYPE",
"not",
"in",
"warm_start_config",
"or",
"PARENT_HYPERPARAMETER_TUNING_JOBS",
"not",
"in",
"warm_start_config",
":",
"return",
"None",
"pa... | Creates an instance of ``WarmStartConfig`` class, from warm start configuration response from
DescribeTrainingJob.
Args:
warm_start_config (dict): The expected format of the ``warm_start_config`` contains two first-class
fields:
* "type": Type of warm start tuner... | [
"Creates",
"an",
"instance",
"of",
"WarmStartConfig",
"class",
"from",
"warm",
"start",
"configuration",
"response",
"from",
"DescribeTrainingJob",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L91-L129 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | WarmStartConfig.to_input_req | def to_input_req(self):
"""Converts the ``self`` instance to the desired input request format.
Returns:
dict: Containing the "WarmStartType" and "ParentHyperParameterTuningJobs" as the first class fields.
Examples:
>>> warm_start_config = WarmStartConfig(warm_start_type... | python | def to_input_req(self):
"""Converts the ``self`` instance to the desired input request format.
Returns:
dict: Containing the "WarmStartType" and "ParentHyperParameterTuningJobs" as the first class fields.
Examples:
>>> warm_start_config = WarmStartConfig(warm_start_type... | [
"def",
"to_input_req",
"(",
"self",
")",
":",
"return",
"{",
"WARM_START_TYPE",
":",
"self",
".",
"type",
".",
"value",
",",
"PARENT_HYPERPARAMETER_TUNING_JOBS",
":",
"[",
"{",
"HYPERPARAMETER_TUNING_JOB_NAME",
":",
"parent",
"}",
"for",
"parent",
"in",
"self",
... | Converts the ``self`` instance to the desired input request format.
Returns:
dict: Containing the "WarmStartType" and "ParentHyperParameterTuningJobs" as the first class fields.
Examples:
>>> warm_start_config = WarmStartConfig(warm_start_type=WarmStartTypes.TransferLearning,pa... | [
"Converts",
"the",
"self",
"instance",
"to",
"the",
"desired",
"input",
"request",
"format",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L131-L151 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner.fit | def fit(self, inputs=None, job_name=None, include_cls_metadata=False, **kwargs):
"""Start a hyperparameter tuning job.
Args:
inputs: Information about the training data. Please refer to the ``fit()`` method of
the associated estimator, as this can take any of the following f... | python | def fit(self, inputs=None, job_name=None, include_cls_metadata=False, **kwargs):
"""Start a hyperparameter tuning job.
Args:
inputs: Information about the training data. Please refer to the ``fit()`` method of
the associated estimator, as this can take any of the following f... | [
"def",
"fit",
"(",
"self",
",",
"inputs",
"=",
"None",
",",
"job_name",
"=",
"None",
",",
"include_cls_metadata",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"inputs",
",",
"list",
")",
"or",
"isinstance",
"(",
"inputs",
... | Start a hyperparameter tuning job.
Args:
inputs: Information about the training data. Please refer to the ``fit()`` method of
the associated estimator, as this can take any of the following forms:
* (str) - The S3 location where training data is saved.
... | [
"Start",
"a",
"hyperparameter",
"tuning",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L240-L278 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner.attach | def attach(cls, tuning_job_name, sagemaker_session=None, job_details=None, estimator_cls=None):
"""Attach to an existing hyperparameter tuning job.
Create a HyperparameterTuner bound to an existing hyperparameter tuning job. After attaching, if there exists a
best training job (or any other com... | python | def attach(cls, tuning_job_name, sagemaker_session=None, job_details=None, estimator_cls=None):
"""Attach to an existing hyperparameter tuning job.
Create a HyperparameterTuner bound to an existing hyperparameter tuning job. After attaching, if there exists a
best training job (or any other com... | [
"def",
"attach",
"(",
"cls",
",",
"tuning_job_name",
",",
"sagemaker_session",
"=",
"None",
",",
"job_details",
"=",
"None",
",",
"estimator_cls",
"=",
"None",
")",
":",
"sagemaker_session",
"=",
"sagemaker_session",
"or",
"Session",
"(",
")",
"if",
"job_detai... | Attach to an existing hyperparameter tuning job.
Create a HyperparameterTuner bound to an existing hyperparameter tuning job. After attaching, if there exists a
best training job (or any other completed training job), that can be deployed to create
an Amazon SageMaker Endpoint and return a ``Pr... | [
"Attach",
"to",
"an",
"existing",
"hyperparameter",
"tuning",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L281-L325 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner.deploy | def deploy(self, initial_instance_count, instance_type, accelerator_type=None, endpoint_name=None, **kwargs):
"""Deploy the best trained or user specified model to an Amazon SageMaker endpoint and return a
``sagemaker.RealTimePredictor`` object.
For more information: http://docs.aws.amazon.com/... | python | def deploy(self, initial_instance_count, instance_type, accelerator_type=None, endpoint_name=None, **kwargs):
"""Deploy the best trained or user specified model to an Amazon SageMaker endpoint and return a
``sagemaker.RealTimePredictor`` object.
For more information: http://docs.aws.amazon.com/... | [
"def",
"deploy",
"(",
"self",
",",
"initial_instance_count",
",",
"instance_type",
",",
"accelerator_type",
"=",
"None",
",",
"endpoint_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"endpoint_name",
"=",
"endpoint_name",
"or",
"self",
".",
"best_train... | Deploy the best trained or user specified model to an Amazon SageMaker endpoint and return a
``sagemaker.RealTimePredictor`` object.
For more information: http://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-training.html
Args:
initial_instance_count (int): Minimum number of... | [
"Deploy",
"the",
"best",
"trained",
"or",
"user",
"specified",
"model",
"to",
"an",
"Amazon",
"SageMaker",
"endpoint",
"and",
"return",
"a",
"sagemaker",
".",
"RealTimePredictor",
"object",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L327-L355 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner.best_training_job | def best_training_job(self):
"""Return name of the best training job for the latest hyperparameter tuning job.
Raises:
Exception: If there is no best training job available for the hyperparameter tuning job.
"""
self._ensure_last_tuning_job()
tuning_job_describe_res... | python | def best_training_job(self):
"""Return name of the best training job for the latest hyperparameter tuning job.
Raises:
Exception: If there is no best training job available for the hyperparameter tuning job.
"""
self._ensure_last_tuning_job()
tuning_job_describe_res... | [
"def",
"best_training_job",
"(",
"self",
")",
":",
"self",
".",
"_ensure_last_tuning_job",
"(",
")",
"tuning_job_describe_result",
"=",
"self",
".",
"estimator",
".",
"sagemaker_session",
".",
"sagemaker_client",
".",
"describe_hyper_parameter_tuning_job",
"(",
"HyperPa... | Return name of the best training job for the latest hyperparameter tuning job.
Raises:
Exception: If there is no best training job available for the hyperparameter tuning job. | [
"Return",
"name",
"of",
"the",
"best",
"training",
"job",
"for",
"the",
"latest",
"hyperparameter",
"tuning",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L369-L384 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner.delete_endpoint | def delete_endpoint(self, endpoint_name=None):
"""Delete an Amazon SageMaker endpoint.
If an endpoint name is not specified, this defaults to looking for an endpoint that
shares a name with the best training job for deletion.
Args:
endpoint_name (str): Name of the endpoint ... | python | def delete_endpoint(self, endpoint_name=None):
"""Delete an Amazon SageMaker endpoint.
If an endpoint name is not specified, this defaults to looking for an endpoint that
shares a name with the best training job for deletion.
Args:
endpoint_name (str): Name of the endpoint ... | [
"def",
"delete_endpoint",
"(",
"self",
",",
"endpoint_name",
"=",
"None",
")",
":",
"endpoint_name",
"=",
"endpoint_name",
"or",
"self",
".",
"best_training_job",
"(",
")",
"self",
".",
"sagemaker_session",
".",
"delete_endpoint",
"(",
"endpoint_name",
")"
] | Delete an Amazon SageMaker endpoint.
If an endpoint name is not specified, this defaults to looking for an endpoint that
shares a name with the best training job for deletion.
Args:
endpoint_name (str): Name of the endpoint to delete | [
"Delete",
"an",
"Amazon",
"SageMaker",
"endpoint",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L386-L396 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner.hyperparameter_ranges | def hyperparameter_ranges(self):
"""Return the hyperparameter ranges in a dictionary to be used as part of a request for creating a
hyperparameter tuning job.
"""
hyperparameter_ranges = dict()
for range_type in ParameterRange.__all_types__:
parameter_ranges = []
... | python | def hyperparameter_ranges(self):
"""Return the hyperparameter ranges in a dictionary to be used as part of a request for creating a
hyperparameter tuning job.
"""
hyperparameter_ranges = dict()
for range_type in ParameterRange.__all_types__:
parameter_ranges = []
... | [
"def",
"hyperparameter_ranges",
"(",
"self",
")",
":",
"hyperparameter_ranges",
"=",
"dict",
"(",
")",
"for",
"range_type",
"in",
"ParameterRange",
".",
"__all_types__",
":",
"parameter_ranges",
"=",
"[",
"]",
"for",
"parameter_name",
",",
"parameter",
"in",
"se... | Return the hyperparameter ranges in a dictionary to be used as part of a request for creating a
hyperparameter tuning job. | [
"Return",
"the",
"hyperparameter",
"ranges",
"in",
"a",
"dictionary",
"to",
"be",
"used",
"as",
"part",
"of",
"a",
"request",
"for",
"creating",
"a",
"hyperparameter",
"tuning",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L473-L489 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner.transfer_learning_tuner | def transfer_learning_tuner(self, additional_parents=None, estimator=None):
"""Creates a new ``HyperparameterTuner`` by copying the request fields from the provided parent to the new
instance of ``HyperparameterTuner``. Followed by addition of warm start configuration with the type as
"TransferL... | python | def transfer_learning_tuner(self, additional_parents=None, estimator=None):
"""Creates a new ``HyperparameterTuner`` by copying the request fields from the provided parent to the new
instance of ``HyperparameterTuner``. Followed by addition of warm start configuration with the type as
"TransferL... | [
"def",
"transfer_learning_tuner",
"(",
"self",
",",
"additional_parents",
"=",
"None",
",",
"estimator",
"=",
"None",
")",
":",
"return",
"self",
".",
"_create_warm_start_tuner",
"(",
"additional_parents",
"=",
"additional_parents",
",",
"warm_start_type",
"=",
"War... | Creates a new ``HyperparameterTuner`` by copying the request fields from the provided parent to the new
instance of ``HyperparameterTuner``. Followed by addition of warm start configuration with the type as
"TransferLearning" and parents as the union of provided list of ``additional_parents`` and the ``... | [
"Creates",
"a",
"new",
"HyperparameterTuner",
"by",
"copying",
"the",
"request",
"fields",
"from",
"the",
"provided",
"parent",
"to",
"the",
"new",
"instance",
"of",
"HyperparameterTuner",
".",
"Followed",
"by",
"addition",
"of",
"warm",
"start",
"configuration",
... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L532-L557 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner.identical_dataset_and_algorithm_tuner | def identical_dataset_and_algorithm_tuner(self, additional_parents=None):
"""Creates a new ``HyperparameterTuner`` by copying the request fields from the provided parent to the new
instance of ``HyperparameterTuner``. Followed by addition of warm start configuration with the type as
"IdenticalDa... | python | def identical_dataset_and_algorithm_tuner(self, additional_parents=None):
"""Creates a new ``HyperparameterTuner`` by copying the request fields from the provided parent to the new
instance of ``HyperparameterTuner``. Followed by addition of warm start configuration with the type as
"IdenticalDa... | [
"def",
"identical_dataset_and_algorithm_tuner",
"(",
"self",
",",
"additional_parents",
"=",
"None",
")",
":",
"return",
"self",
".",
"_create_warm_start_tuner",
"(",
"additional_parents",
"=",
"additional_parents",
",",
"warm_start_type",
"=",
"WarmStartTypes",
".",
"I... | Creates a new ``HyperparameterTuner`` by copying the request fields from the provided parent to the new
instance of ``HyperparameterTuner``. Followed by addition of warm start configuration with the type as
"IdenticalDataAndAlgorithm" and parents as the union of provided list of ``additional_parents`` a... | [
"Creates",
"a",
"new",
"HyperparameterTuner",
"by",
"copying",
"the",
"request",
"fields",
"from",
"the",
"provided",
"parent",
"to",
"the",
"new",
"instance",
"of",
"HyperparameterTuner",
".",
"Followed",
"by",
"addition",
"of",
"warm",
"start",
"configuration",
... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L559-L581 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | HyperparameterTuner._create_warm_start_tuner | def _create_warm_start_tuner(self, additional_parents, warm_start_type, estimator=None):
"""Creates a new ``HyperparameterTuner`` with ``WarmStartConfig``, where type will be equal to
``warm_start_type`` and``parents`` would be equal to union of ``additional_parents`` and self.
Args:
... | python | def _create_warm_start_tuner(self, additional_parents, warm_start_type, estimator=None):
"""Creates a new ``HyperparameterTuner`` with ``WarmStartConfig``, where type will be equal to
``warm_start_type`` and``parents`` would be equal to union of ``additional_parents`` and self.
Args:
... | [
"def",
"_create_warm_start_tuner",
"(",
"self",
",",
"additional_parents",
",",
"warm_start_type",
",",
"estimator",
"=",
"None",
")",
":",
"all_parents",
"=",
"{",
"self",
".",
"latest_tuning_job",
".",
"name",
"}",
"if",
"additional_parents",
":",
"all_parents",... | Creates a new ``HyperparameterTuner`` with ``WarmStartConfig``, where type will be equal to
``warm_start_type`` and``parents`` would be equal to union of ``additional_parents`` and self.
Args:
additional_parents (set{str}): Additional parents along with self, to be used for warm starting.
... | [
"Creates",
"a",
"new",
"HyperparameterTuner",
"with",
"WarmStartConfig",
"where",
"type",
"will",
"be",
"equal",
"to",
"warm_start_type",
"and",
"parents",
"would",
"be",
"equal",
"to",
"union",
"of",
"additional_parents",
"and",
"self",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L583-L606 | train |
aws/sagemaker-python-sdk | src/sagemaker/tuner.py | _TuningJob.start_new | def start_new(cls, tuner, inputs):
"""Create a new Amazon SageMaker hyperparameter tuning job from the HyperparameterTuner.
Args:
tuner (sagemaker.tuner.HyperparameterTuner): HyperparameterTuner object created by the user.
inputs (str): Parameters used when called :meth:`~sagema... | python | def start_new(cls, tuner, inputs):
"""Create a new Amazon SageMaker hyperparameter tuning job from the HyperparameterTuner.
Args:
tuner (sagemaker.tuner.HyperparameterTuner): HyperparameterTuner object created by the user.
inputs (str): Parameters used when called :meth:`~sagema... | [
"def",
"start_new",
"(",
"cls",
",",
"tuner",
",",
"inputs",
")",
":",
"config",
"=",
"_Job",
".",
"_load_config",
"(",
"inputs",
",",
"tuner",
".",
"estimator",
")",
"warm_start_config_req",
"=",
"None",
"if",
"tuner",
".",
"warm_start_config",
":",
"warm... | Create a new Amazon SageMaker hyperparameter tuning job from the HyperparameterTuner.
Args:
tuner (sagemaker.tuner.HyperparameterTuner): HyperparameterTuner object created by the user.
inputs (str): Parameters used when called :meth:`~sagemaker.estimator.EstimatorBase.fit`.
Ret... | [
"Create",
"a",
"new",
"Amazon",
"SageMaker",
"hyperparameter",
"tuning",
"job",
"from",
"the",
"HyperparameterTuner",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/tuner.py#L611-L654 | train |
aws/sagemaker-python-sdk | src/sagemaker/logs.py | some | def some(arr):
"""Return True iff there is an element, a, of arr such that a is not None"""
return functools.reduce(lambda x, y: x or (y is not None), arr, False) | python | def some(arr):
"""Return True iff there is an element, a, of arr such that a is not None"""
return functools.reduce(lambda x, y: x or (y is not None), arr, False) | [
"def",
"some",
"(",
"arr",
")",
":",
"return",
"functools",
".",
"reduce",
"(",
"lambda",
"x",
",",
"y",
":",
"x",
"or",
"(",
"y",
"is",
"not",
"None",
")",
",",
"arr",
",",
"False",
")"
] | Return True iff there is an element, a, of arr such that a is not None | [
"Return",
"True",
"iff",
"there",
"is",
"an",
"element",
"a",
"of",
"arr",
"such",
"that",
"a",
"is",
"not",
"None"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/logs.py#L70-L72 | train |
aws/sagemaker-python-sdk | src/sagemaker/logs.py | multi_stream_iter | def multi_stream_iter(client, log_group, streams, positions=None):
"""Iterate over the available events coming from a set of log streams in a single log group
interleaving the events from each stream so they're yielded in timestamp order.
Args:
client (boto3 client): The boto client for logs.
... | python | def multi_stream_iter(client, log_group, streams, positions=None):
"""Iterate over the available events coming from a set of log streams in a single log group
interleaving the events from each stream so they're yielded in timestamp order.
Args:
client (boto3 client): The boto client for logs.
... | [
"def",
"multi_stream_iter",
"(",
"client",
",",
"log_group",
",",
"streams",
",",
"positions",
"=",
"None",
")",
":",
"positions",
"=",
"positions",
"or",
"{",
"s",
":",
"Position",
"(",
"timestamp",
"=",
"0",
",",
"skip",
"=",
"0",
")",
"for",
"s",
... | Iterate over the available events coming from a set of log streams in a single log group
interleaving the events from each stream so they're yielded in timestamp order.
Args:
client (boto3 client): The boto client for logs.
log_group (str): The name of the log group.
streams (list of st... | [
"Iterate",
"over",
"the",
"available",
"events",
"coming",
"from",
"a",
"set",
"of",
"log",
"streams",
"in",
"a",
"single",
"log",
"group",
"interleaving",
"the",
"events",
"from",
"each",
"stream",
"so",
"they",
"re",
"yielded",
"in",
"timestamp",
"order",
... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/logs.py#L80-L113 | train |
aws/sagemaker-python-sdk | src/sagemaker/logs.py | log_stream | def log_stream(client, log_group, stream_name, start_time=0, skip=0):
"""A generator for log items in a single stream. This will yield all the
items that are available at the current moment.
Args:
client (boto3.CloudWatchLogs.Client): The Boto client for CloudWatch logs.
log_group (str): Th... | python | def log_stream(client, log_group, stream_name, start_time=0, skip=0):
"""A generator for log items in a single stream. This will yield all the
items that are available at the current moment.
Args:
client (boto3.CloudWatchLogs.Client): The Boto client for CloudWatch logs.
log_group (str): Th... | [
"def",
"log_stream",
"(",
"client",
",",
"log_group",
",",
"stream_name",
",",
"start_time",
"=",
"0",
",",
"skip",
"=",
"0",
")",
":",
"next_token",
"=",
"None",
"event_count",
"=",
"1",
"while",
"event_count",
">",
"0",
":",
"if",
"next_token",
"is",
... | A generator for log items in a single stream. This will yield all the
items that are available at the current moment.
Args:
client (boto3.CloudWatchLogs.Client): The Boto client for CloudWatch logs.
log_group (str): The name of the log group.
stream_name (str): The name of the specific ... | [
"A",
"generator",
"for",
"log",
"items",
"in",
"a",
"single",
"stream",
".",
"This",
"will",
"yield",
"all",
"the",
"items",
"that",
"are",
"available",
"at",
"the",
"current",
"moment",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/logs.py#L116-L156 | train |
aws/sagemaker-python-sdk | src/sagemaker/rl/estimator.py | RLEstimator.create_model | def create_model(self, role=None, vpc_config_override=VPC_CONFIG_DEFAULT,
entry_point=None, source_dir=None, dependencies=None):
"""Create a SageMaker ``RLEstimatorModel`` object that can be deployed to an Endpoint.
Args:
role (str): The ``ExecutionRoleArn`` IAM Role AR... | python | def create_model(self, role=None, vpc_config_override=VPC_CONFIG_DEFAULT,
entry_point=None, source_dir=None, dependencies=None):
"""Create a SageMaker ``RLEstimatorModel`` object that can be deployed to an Endpoint.
Args:
role (str): The ``ExecutionRoleArn`` IAM Role AR... | [
"def",
"create_model",
"(",
"self",
",",
"role",
"=",
"None",
",",
"vpc_config_override",
"=",
"VPC_CONFIG_DEFAULT",
",",
"entry_point",
"=",
"None",
",",
"source_dir",
"=",
"None",
",",
"dependencies",
"=",
"None",
")",
":",
"base_args",
"=",
"dict",
"(",
... | Create a SageMaker ``RLEstimatorModel`` object that can be deployed to an Endpoint.
Args:
role (str): The ``ExecutionRoleArn`` IAM Role ARN for the ``Model``, which is also used
during transform jobs. If not specified, the role from the Estimator will be used.
vpc_config... | [
"Create",
"a",
"SageMaker",
"RLEstimatorModel",
"object",
"that",
"can",
"be",
"deployed",
"to",
"an",
"Endpoint",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/rl/estimator.py#L145-L219 | train |
aws/sagemaker-python-sdk | src/sagemaker/rl/estimator.py | RLEstimator.train_image | def train_image(self):
"""Return the Docker image to use for training.
The :meth:`~sagemaker.estimator.EstimatorBase.fit` method, which does the model training,
calls this method to find the image to use for model training.
Returns:
str: The URI of the Docker image.
... | python | def train_image(self):
"""Return the Docker image to use for training.
The :meth:`~sagemaker.estimator.EstimatorBase.fit` method, which does the model training,
calls this method to find the image to use for model training.
Returns:
str: The URI of the Docker image.
... | [
"def",
"train_image",
"(",
"self",
")",
":",
"if",
"self",
".",
"image_name",
":",
"return",
"self",
".",
"image_name",
"else",
":",
"return",
"fw_utils",
".",
"create_image_uri",
"(",
"self",
".",
"sagemaker_session",
".",
"boto_region_name",
",",
"self",
"... | Return the Docker image to use for training.
The :meth:`~sagemaker.estimator.EstimatorBase.fit` method, which does the model training,
calls this method to find the image to use for model training.
Returns:
str: The URI of the Docker image. | [
"Return",
"the",
"Docker",
"image",
"to",
"use",
"for",
"training",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/rl/estimator.py#L221-L237 | train |
aws/sagemaker-python-sdk | src/sagemaker/rl/estimator.py | RLEstimator._prepare_init_params_from_job_description | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | python | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | [
"def",
"_prepare_init_params_from_job_description",
"(",
"cls",
",",
"job_details",
",",
"model_channel_name",
"=",
"None",
")",
":",
"init_params",
"=",
"super",
"(",
"RLEstimator",
",",
"cls",
")",
".",
"_prepare_init_params_from_job_description",
"(",
"job_details",
... | Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_name (str): Name of the channel where pre-trained model data will be
downloaded.
... | [
"Convert",
"the",
"job",
"description",
"to",
"init",
"params",
"that",
"can",
"be",
"handled",
"by",
"the",
"class",
"constructor"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/rl/estimator.py#L240-L276 | train |
aws/sagemaker-python-sdk | src/sagemaker/rl/estimator.py | RLEstimator.hyperparameters | def hyperparameters(self):
"""Return hyperparameters used by your custom TensorFlow code during model training."""
hyperparameters = super(RLEstimator, self).hyperparameters()
additional_hyperparameters = {SAGEMAKER_OUTPUT_LOCATION: self.output_path,
# TODO... | python | def hyperparameters(self):
"""Return hyperparameters used by your custom TensorFlow code during model training."""
hyperparameters = super(RLEstimator, self).hyperparameters()
additional_hyperparameters = {SAGEMAKER_OUTPUT_LOCATION: self.output_path,
# TODO... | [
"def",
"hyperparameters",
"(",
"self",
")",
":",
"hyperparameters",
"=",
"super",
"(",
"RLEstimator",
",",
"self",
")",
".",
"hyperparameters",
"(",
")",
"additional_hyperparameters",
"=",
"{",
"SAGEMAKER_OUTPUT_LOCATION",
":",
"self",
".",
"output_path",
",",
"... | Return hyperparameters used by your custom TensorFlow code during model training. | [
"Return",
"hyperparameters",
"used",
"by",
"your",
"custom",
"TensorFlow",
"code",
"during",
"model",
"training",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/rl/estimator.py#L278-L287 | train |
aws/sagemaker-python-sdk | src/sagemaker/rl/estimator.py | RLEstimator.default_metric_definitions | def default_metric_definitions(cls, toolkit):
"""Provides default metric definitions based on provided toolkit.
Args:
toolkit(sagemaker.rl.RLToolkit): RL Toolkit to be used for training.
Returns:
list: metric definitions
"""
if toolkit is RLToolkit.COACH... | python | def default_metric_definitions(cls, toolkit):
"""Provides default metric definitions based on provided toolkit.
Args:
toolkit(sagemaker.rl.RLToolkit): RL Toolkit to be used for training.
Returns:
list: metric definitions
"""
if toolkit is RLToolkit.COACH... | [
"def",
"default_metric_definitions",
"(",
"cls",
",",
"toolkit",
")",
":",
"if",
"toolkit",
"is",
"RLToolkit",
".",
"COACH",
":",
"return",
"[",
"{",
"'Name'",
":",
"'reward-training'",
",",
"'Regex'",
":",
"'^Training>.*Total reward=(.*?),'",
"}",
",",
"{",
"... | Provides default metric definitions based on provided toolkit.
Args:
toolkit(sagemaker.rl.RLToolkit): RL Toolkit to be used for training.
Returns:
list: metric definitions | [
"Provides",
"default",
"metric",
"definitions",
"based",
"on",
"provided",
"toolkit",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/rl/estimator.py#L370-L393 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | prepare_framework | def prepare_framework(estimator, s3_operations):
"""Prepare S3 operations (specify where to upload `source_dir`) and environment variables
related to framework.
Args:
estimator (sagemaker.estimator.Estimator): The framework estimator to get information from and update.
s3_operations (dict):... | python | def prepare_framework(estimator, s3_operations):
"""Prepare S3 operations (specify where to upload `source_dir`) and environment variables
related to framework.
Args:
estimator (sagemaker.estimator.Estimator): The framework estimator to get information from and update.
s3_operations (dict):... | [
"def",
"prepare_framework",
"(",
"estimator",
",",
"s3_operations",
")",
":",
"if",
"estimator",
".",
"code_location",
"is",
"not",
"None",
":",
"bucket",
",",
"key",
"=",
"fw_utils",
".",
"parse_s3_url",
"(",
"estimator",
".",
"code_location",
")",
"key",
"... | Prepare S3 operations (specify where to upload `source_dir`) and environment variables
related to framework.
Args:
estimator (sagemaker.estimator.Estimator): The framework estimator to get information from and update.
s3_operations (dict): The dict to specify s3 operations (upload `source_dir`)... | [
"Prepare",
"S3",
"operations",
"(",
"specify",
"where",
"to",
"upload",
"source_dir",
")",
"and",
"environment",
"variables",
"related",
"to",
"framework",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L23-L57 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | prepare_amazon_algorithm_estimator | def prepare_amazon_algorithm_estimator(estimator, inputs, mini_batch_size=None):
""" Set up amazon algorithm estimator, adding the required `feature_dim` hyperparameter from training data.
Args:
estimator (sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase):
An estimator for a b... | python | def prepare_amazon_algorithm_estimator(estimator, inputs, mini_batch_size=None):
""" Set up amazon algorithm estimator, adding the required `feature_dim` hyperparameter from training data.
Args:
estimator (sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase):
An estimator for a b... | [
"def",
"prepare_amazon_algorithm_estimator",
"(",
"estimator",
",",
"inputs",
",",
"mini_batch_size",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"inputs",
",",
"list",
")",
":",
"for",
"record",
"in",
"inputs",
":",
"if",
"isinstance",
"(",
"record",
",... | Set up amazon algorithm estimator, adding the required `feature_dim` hyperparameter from training data.
Args:
estimator (sagemaker.amazon.amazon_estimator.AmazonAlgorithmEstimatorBase):
An estimator for a built-in Amazon algorithm to get information from and update.
inputs: The training... | [
"Set",
"up",
"amazon",
"algorithm",
"estimator",
"adding",
"the",
"required",
"feature_dim",
"hyperparameter",
"from",
"training",
"data",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L60-L83 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | training_base_config | def training_base_config(estimator, inputs=None, job_name=None, mini_batch_size=None):
"""Export Airflow base training config from an estimator
Args:
estimator (sagemaker.estimator.EstimatorBase):
The estimator to export training config from. Can be a BYO estimator,
Framework es... | python | def training_base_config(estimator, inputs=None, job_name=None, mini_batch_size=None):
"""Export Airflow base training config from an estimator
Args:
estimator (sagemaker.estimator.EstimatorBase):
The estimator to export training config from. Can be a BYO estimator,
Framework es... | [
"def",
"training_base_config",
"(",
"estimator",
",",
"inputs",
"=",
"None",
",",
"job_name",
"=",
"None",
",",
"mini_batch_size",
"=",
"None",
")",
":",
"default_bucket",
"=",
"estimator",
".",
"sagemaker_session",
".",
"default_bucket",
"(",
")",
"s3_operation... | Export Airflow base training config from an estimator
Args:
estimator (sagemaker.estimator.EstimatorBase):
The estimator to export training config from. Can be a BYO estimator,
Framework estimator or Amazon algorithm estimator.
inputs: Information about the training data. Pl... | [
"Export",
"Airflow",
"base",
"training",
"config",
"from",
"an",
"estimator"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L86-L162 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | training_config | def training_config(estimator, inputs=None, job_name=None, mini_batch_size=None):
"""Export Airflow training config from an estimator
Args:
estimator (sagemaker.estimator.EstimatorBase):
The estimator to export training config from. Can be a BYO estimator,
Framework estimator or... | python | def training_config(estimator, inputs=None, job_name=None, mini_batch_size=None):
"""Export Airflow training config from an estimator
Args:
estimator (sagemaker.estimator.EstimatorBase):
The estimator to export training config from. Can be a BYO estimator,
Framework estimator or... | [
"def",
"training_config",
"(",
"estimator",
",",
"inputs",
"=",
"None",
",",
"job_name",
"=",
"None",
",",
"mini_batch_size",
"=",
"None",
")",
":",
"train_config",
"=",
"training_base_config",
"(",
"estimator",
",",
"inputs",
",",
"job_name",
",",
"mini_batch... | Export Airflow training config from an estimator
Args:
estimator (sagemaker.estimator.EstimatorBase):
The estimator to export training config from. Can be a BYO estimator,
Framework estimator or Amazon algorithm estimator.
inputs: Information about the training data. Please ... | [
"Export",
"Airflow",
"training",
"config",
"from",
"an",
"estimator"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L165-L204 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | tuning_config | def tuning_config(tuner, inputs, job_name=None):
"""Export Airflow tuning config from an estimator
Args:
tuner (sagemaker.tuner.HyperparameterTuner): The tuner to export tuning config from.
inputs: Information about the training data. Please refer to the ``fit()`` method of
the ... | python | def tuning_config(tuner, inputs, job_name=None):
"""Export Airflow tuning config from an estimator
Args:
tuner (sagemaker.tuner.HyperparameterTuner): The tuner to export tuning config from.
inputs: Information about the training data. Please refer to the ``fit()`` method of
the ... | [
"def",
"tuning_config",
"(",
"tuner",
",",
"inputs",
",",
"job_name",
"=",
"None",
")",
":",
"train_config",
"=",
"training_base_config",
"(",
"tuner",
".",
"estimator",
",",
"inputs",
")",
"hyperparameters",
"=",
"train_config",
".",
"pop",
"(",
"'HyperParame... | Export Airflow tuning config from an estimator
Args:
tuner (sagemaker.tuner.HyperparameterTuner): The tuner to export tuning config from.
inputs: Information about the training data. Please refer to the ``fit()`` method of
the associated estimator in the tuner, as this can take any ... | [
"Export",
"Airflow",
"tuning",
"config",
"from",
"an",
"estimator"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L207-L280 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | update_submit_s3_uri | def update_submit_s3_uri(estimator, job_name):
"""Updated the S3 URI of the framework source directory in given estimator.
Args:
estimator (sagemaker.estimator.Framework): The Framework estimator to update.
job_name (str): The new job name included in the submit S3 URI
Returns:
str... | python | def update_submit_s3_uri(estimator, job_name):
"""Updated the S3 URI of the framework source directory in given estimator.
Args:
estimator (sagemaker.estimator.Framework): The Framework estimator to update.
job_name (str): The new job name included in the submit S3 URI
Returns:
str... | [
"def",
"update_submit_s3_uri",
"(",
"estimator",
",",
"job_name",
")",
":",
"if",
"estimator",
".",
"uploaded_code",
"is",
"None",
":",
"return",
"pattern",
"=",
"r'(?<=/)[^/]+?(?=/source/sourcedir.tar.gz)'",
"# update the S3 URI with the latest training job.",
"# s3://path/o... | Updated the S3 URI of the framework source directory in given estimator.
Args:
estimator (sagemaker.estimator.Framework): The Framework estimator to update.
job_name (str): The new job name included in the submit S3 URI
Returns:
str: The updated S3 URI of framework source directory | [
"Updated",
"the",
"S3",
"URI",
"of",
"the",
"framework",
"source",
"directory",
"in",
"given",
"estimator",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L283-L303 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | update_estimator_from_task | def update_estimator_from_task(estimator, task_id, task_type):
"""Update training job of the estimator from a task in the DAG
Args:
estimator (sagemaker.estimator.EstimatorBase): The estimator to update
task_id (str): The task id of any airflow.contrib.operators.SageMakerTrainingOperator or
... | python | def update_estimator_from_task(estimator, task_id, task_type):
"""Update training job of the estimator from a task in the DAG
Args:
estimator (sagemaker.estimator.EstimatorBase): The estimator to update
task_id (str): The task id of any airflow.contrib.operators.SageMakerTrainingOperator or
... | [
"def",
"update_estimator_from_task",
"(",
"estimator",
",",
"task_id",
",",
"task_type",
")",
":",
"if",
"task_type",
"is",
"None",
":",
"return",
"if",
"task_type",
".",
"lower",
"(",
")",
"==",
"'training'",
":",
"training_job",
"=",
"\"{{ ti.xcom_pull(task_id... | Update training job of the estimator from a task in the DAG
Args:
estimator (sagemaker.estimator.EstimatorBase): The estimator to update
task_id (str): The task id of any airflow.contrib.operators.SageMakerTrainingOperator or
airflow.contrib.operators.SageMakerTuningOperator that genera... | [
"Update",
"training",
"job",
"of",
"the",
"estimator",
"from",
"a",
"task",
"in",
"the",
"DAG"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L306-L330 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | prepare_framework_container_def | def prepare_framework_container_def(model, instance_type, s3_operations):
"""Prepare the framework model container information. Specify related S3 operations for Airflow to perform.
(Upload `source_dir`)
Args:
model (sagemaker.model.FrameworkModel): The framework model
instance_type (str): ... | python | def prepare_framework_container_def(model, instance_type, s3_operations):
"""Prepare the framework model container information. Specify related S3 operations for Airflow to perform.
(Upload `source_dir`)
Args:
model (sagemaker.model.FrameworkModel): The framework model
instance_type (str): ... | [
"def",
"prepare_framework_container_def",
"(",
"model",
",",
"instance_type",
",",
"s3_operations",
")",
":",
"deploy_image",
"=",
"model",
".",
"image",
"if",
"not",
"deploy_image",
":",
"region_name",
"=",
"model",
".",
"sagemaker_session",
".",
"boto_session",
... | Prepare the framework model container information. Specify related S3 operations for Airflow to perform.
(Upload `source_dir`)
Args:
model (sagemaker.model.FrameworkModel): The framework model
instance_type (str): The EC2 instance type to deploy this Model to. For example, 'ml.p2.xlarge'.
... | [
"Prepare",
"the",
"framework",
"model",
"container",
"information",
".",
"Specify",
"related",
"S3",
"operations",
"for",
"Airflow",
"to",
"perform",
".",
"(",
"Upload",
"source_dir",
")"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L333-L381 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | model_config | def model_config(instance_type, model, role=None, image=None):
"""Export Airflow model config from a SageMaker model
Args:
instance_type (str): The EC2 instance type to deploy this Model to. For example, 'ml.p2.xlarge'
model (sagemaker.model.FrameworkModel): The SageMaker model to export Airflo... | python | def model_config(instance_type, model, role=None, image=None):
"""Export Airflow model config from a SageMaker model
Args:
instance_type (str): The EC2 instance type to deploy this Model to. For example, 'ml.p2.xlarge'
model (sagemaker.model.FrameworkModel): The SageMaker model to export Airflo... | [
"def",
"model_config",
"(",
"instance_type",
",",
"model",
",",
"role",
"=",
"None",
",",
"image",
"=",
"None",
")",
":",
"s3_operations",
"=",
"{",
"}",
"model",
".",
"image",
"=",
"image",
"or",
"model",
".",
"image",
"if",
"isinstance",
"(",
"model"... | Export Airflow model config from a SageMaker model
Args:
instance_type (str): The EC2 instance type to deploy this Model to. For example, 'ml.p2.xlarge'
model (sagemaker.model.FrameworkModel): The SageMaker model to export Airflow config from
role (str): The ``ExecutionRoleArn`` IAM Role AR... | [
"Export",
"Airflow",
"model",
"config",
"from",
"a",
"SageMaker",
"model"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L384-L421 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | model_config_from_estimator | def model_config_from_estimator(instance_type, estimator, task_id, task_type, role=None, image=None, name=None,
model_server_workers=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT):
"""Export Airflow model config from a SageMaker estimator
Args:
instance_type (st... | python | def model_config_from_estimator(instance_type, estimator, task_id, task_type, role=None, image=None, name=None,
model_server_workers=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT):
"""Export Airflow model config from a SageMaker estimator
Args:
instance_type (st... | [
"def",
"model_config_from_estimator",
"(",
"instance_type",
",",
"estimator",
",",
"task_id",
",",
"task_type",
",",
"role",
"=",
"None",
",",
"image",
"=",
"None",
",",
"name",
"=",
"None",
",",
"model_server_workers",
"=",
"None",
",",
"vpc_config_override",
... | Export Airflow model config from a SageMaker estimator
Args:
instance_type (str): The EC2 instance type to deploy this Model to. For example, 'ml.p2.xlarge'
estimator (sagemaker.model.EstimatorBase): The SageMaker estimator to export Airflow config from.
It has to be an estimator associ... | [
"Export",
"Airflow",
"model",
"config",
"from",
"a",
"SageMaker",
"estimator"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L424-L465 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | transform_config | def transform_config(transformer, data, data_type='S3Prefix', content_type=None, compression_type=None,
split_type=None, job_name=None):
"""Export Airflow transform config from a SageMaker transformer
Args:
transformer (sagemaker.transformer.Transformer): The SageMaker transformer ... | python | def transform_config(transformer, data, data_type='S3Prefix', content_type=None, compression_type=None,
split_type=None, job_name=None):
"""Export Airflow transform config from a SageMaker transformer
Args:
transformer (sagemaker.transformer.Transformer): The SageMaker transformer ... | [
"def",
"transform_config",
"(",
"transformer",
",",
"data",
",",
"data_type",
"=",
"'S3Prefix'",
",",
"content_type",
"=",
"None",
",",
"compression_type",
"=",
"None",
",",
"split_type",
"=",
"None",
",",
"job_name",
"=",
"None",
")",
":",
"if",
"job_name",... | Export Airflow transform config from a SageMaker transformer
Args:
transformer (sagemaker.transformer.Transformer): The SageMaker transformer to export Airflow
config from.
data (str): Input data location in S3.
data_type (str): What the S3 location defines (default: 'S3Prefix')... | [
"Export",
"Airflow",
"transform",
"config",
"from",
"a",
"SageMaker",
"transformer"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L468-L530 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | transform_config_from_estimator | def transform_config_from_estimator(estimator, task_id, task_type, instance_count, instance_type, data,
data_type='S3Prefix', content_type=None, compression_type=None, split_type=None,
job_name=None, model_name=None, strategy=None, assemble_with=No... | python | def transform_config_from_estimator(estimator, task_id, task_type, instance_count, instance_type, data,
data_type='S3Prefix', content_type=None, compression_type=None, split_type=None,
job_name=None, model_name=None, strategy=None, assemble_with=No... | [
"def",
"transform_config_from_estimator",
"(",
"estimator",
",",
"task_id",
",",
"task_type",
",",
"instance_count",
",",
"instance_type",
",",
"data",
",",
"data_type",
"=",
"'S3Prefix'",
",",
"content_type",
"=",
"None",
",",
"compression_type",
"=",
"None",
","... | Export Airflow transform config from a SageMaker estimator
Args:
estimator (sagemaker.model.EstimatorBase): The SageMaker estimator to export Airflow config from.
It has to be an estimator associated with a training job.
task_id (str): The task id of any airflow.contrib.operators.SageMa... | [
"Export",
"Airflow",
"transform",
"config",
"from",
"a",
"SageMaker",
"estimator"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L533-L617 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | deploy_config | def deploy_config(model, initial_instance_count, instance_type, endpoint_name=None, tags=None):
"""Export Airflow deploy config from a SageMaker model
Args:
model (sagemaker.model.Model): The SageMaker model to export the Airflow config from.
instance_type (str): The EC2 instance type to deploy... | python | def deploy_config(model, initial_instance_count, instance_type, endpoint_name=None, tags=None):
"""Export Airflow deploy config from a SageMaker model
Args:
model (sagemaker.model.Model): The SageMaker model to export the Airflow config from.
instance_type (str): The EC2 instance type to deploy... | [
"def",
"deploy_config",
"(",
"model",
",",
"initial_instance_count",
",",
"instance_type",
",",
"endpoint_name",
"=",
"None",
",",
"tags",
"=",
"None",
")",
":",
"model_base_config",
"=",
"model_config",
"(",
"instance_type",
",",
"model",
")",
"production_variant... | Export Airflow deploy config from a SageMaker model
Args:
model (sagemaker.model.Model): The SageMaker model to export the Airflow config from.
instance_type (str): The EC2 instance type to deploy this Model to. For example, 'ml.p2.xlarge'.
initial_instance_count (int): The initial number o... | [
"Export",
"Airflow",
"deploy",
"config",
"from",
"a",
"SageMaker",
"model"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L620-L662 | train |
aws/sagemaker-python-sdk | src/sagemaker/workflow/airflow.py | deploy_config_from_estimator | def deploy_config_from_estimator(estimator, task_id, task_type, initial_instance_count, instance_type,
model_name=None, endpoint_name=None, tags=None, **kwargs):
"""Export Airflow deploy config from a SageMaker estimator
Args:
estimator (sagemaker.model.EstimatorBase): ... | python | def deploy_config_from_estimator(estimator, task_id, task_type, initial_instance_count, instance_type,
model_name=None, endpoint_name=None, tags=None, **kwargs):
"""Export Airflow deploy config from a SageMaker estimator
Args:
estimator (sagemaker.model.EstimatorBase): ... | [
"def",
"deploy_config_from_estimator",
"(",
"estimator",
",",
"task_id",
",",
"task_type",
",",
"initial_instance_count",
",",
"instance_type",
",",
"model_name",
"=",
"None",
",",
"endpoint_name",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"*",
"*",
"kwargs",
... | Export Airflow deploy config from a SageMaker estimator
Args:
estimator (sagemaker.model.EstimatorBase): The SageMaker estimator to export Airflow config from.
It has to be an estimator associated with a training job.
task_id (str): The task id of any airflow.contrib.operators.SageMaker... | [
"Export",
"Airflow",
"deploy",
"config",
"from",
"a",
"SageMaker",
"estimator"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/workflow/airflow.py#L665-L696 | train |
aws/sagemaker-python-sdk | src/sagemaker/algorithm.py | AlgorithmEstimator.create_model | def create_model(
self,
role=None,
predictor_cls=None,
serializer=None,
deserializer=None,
content_type=None,
accept=None,
vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT,
**kwargs
):
"""Create a model to deploy.
The serialize... | python | def create_model(
self,
role=None,
predictor_cls=None,
serializer=None,
deserializer=None,
content_type=None,
accept=None,
vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT,
**kwargs
):
"""Create a model to deploy.
The serialize... | [
"def",
"create_model",
"(",
"self",
",",
"role",
"=",
"None",
",",
"predictor_cls",
"=",
"None",
",",
"serializer",
"=",
"None",
",",
"deserializer",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"accept",
"=",
"None",
",",
"vpc_config_override",
"="... | Create a model to deploy.
The serializer, deserializer, content_type, and accept arguments are only used to define a default
RealTimePredictor. They are ignored if an explicit predictor class is passed in. Other arguments
are passed through to the Model class.
Args:
role (s... | [
"Create",
"a",
"model",
"to",
"deploy",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/algorithm.py#L204-L259 | train |
aws/sagemaker-python-sdk | src/sagemaker/algorithm.py | AlgorithmEstimator.transformer | def transformer(self, instance_count, instance_type, strategy=None, assemble_with=None, output_path=None,
output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None,
max_payload=None, tags=None, role=None, volume_kms_key=None):
"""Return a ``Transformer`` ... | python | def transformer(self, instance_count, instance_type, strategy=None, assemble_with=None, output_path=None,
output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None,
max_payload=None, tags=None, role=None, volume_kms_key=None):
"""Return a ``Transformer`` ... | [
"def",
"transformer",
"(",
"self",
",",
"instance_count",
",",
"instance_type",
",",
"strategy",
"=",
"None",
",",
"assemble_with",
"=",
"None",
",",
"output_path",
"=",
"None",
",",
"output_kms_key",
"=",
"None",
",",
"accept",
"=",
"None",
",",
"env",
"=... | Return a ``Transformer`` that uses a SageMaker Model based on the training job. It reuses the
SageMaker Session and base job name used by the Estimator.
Args:
instance_count (int): Number of EC2 instances to use.
instance_type (str): Type of EC2 instance to use, for example, 'ml... | [
"Return",
"a",
"Transformer",
"that",
"uses",
"a",
"SageMaker",
"Model",
"based",
"on",
"the",
"training",
"job",
".",
"It",
"reuses",
"the",
"SageMaker",
"Session",
"and",
"base",
"job",
"name",
"used",
"by",
"the",
"Estimator",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/algorithm.py#L261-L311 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase._prepare_for_training | def _prepare_for_training(self, job_name=None):
"""Set any values in the estimator that need to be set before training.
Args:
* job_name (str): Name of the training job to be created. If not specified, one is generated,
using the base name given to the constructor if applica... | python | def _prepare_for_training(self, job_name=None):
"""Set any values in the estimator that need to be set before training.
Args:
* job_name (str): Name of the training job to be created. If not specified, one is generated,
using the base name given to the constructor if applica... | [
"def",
"_prepare_for_training",
"(",
"self",
",",
"job_name",
"=",
"None",
")",
":",
"if",
"job_name",
"is",
"not",
"None",
":",
"self",
".",
"_current_job_name",
"=",
"job_name",
"else",
":",
"# honor supplied base_job_name or generate it",
"if",
"self",
".",
"... | Set any values in the estimator that need to be set before training.
Args:
* job_name (str): Name of the training job to be created. If not specified, one is generated,
using the base name given to the constructor if applicable. | [
"Set",
"any",
"values",
"in",
"the",
"estimator",
"that",
"need",
"to",
"be",
"set",
"before",
"training",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L175-L202 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.fit | def fit(self, inputs=None, wait=True, logs=True, job_name=None):
"""Train a model using the input training dataset.
The API calls the Amazon SageMaker CreateTrainingJob API to start model training.
The API uses configuration you provided to create the estimator and the
specified input t... | python | def fit(self, inputs=None, wait=True, logs=True, job_name=None):
"""Train a model using the input training dataset.
The API calls the Amazon SageMaker CreateTrainingJob API to start model training.
The API uses configuration you provided to create the estimator and the
specified input t... | [
"def",
"fit",
"(",
"self",
",",
"inputs",
"=",
"None",
",",
"wait",
"=",
"True",
",",
"logs",
"=",
"True",
",",
"job_name",
"=",
"None",
")",
":",
"self",
".",
"_prepare_for_training",
"(",
"job_name",
"=",
"job_name",
")",
"self",
".",
"latest_trainin... | Train a model using the input training dataset.
The API calls the Amazon SageMaker CreateTrainingJob API to start model training.
The API uses configuration you provided to create the estimator and the
specified input training data to send the CreatingTrainingJob request to Amazon SageMaker.
... | [
"Train",
"a",
"model",
"using",
"the",
"input",
"training",
"dataset",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L204-L236 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.compile_model | def compile_model(self, target_instance_family, input_shape, output_path, framework=None, framework_version=None,
compile_max_run=5 * 60, tags=None, **kwargs):
"""Compile a Neo model using the input model.
Args:
target_instance_family (str): Identifies the device that ... | python | def compile_model(self, target_instance_family, input_shape, output_path, framework=None, framework_version=None,
compile_max_run=5 * 60, tags=None, **kwargs):
"""Compile a Neo model using the input model.
Args:
target_instance_family (str): Identifies the device that ... | [
"def",
"compile_model",
"(",
"self",
",",
"target_instance_family",
",",
"input_shape",
",",
"output_path",
",",
"framework",
"=",
"None",
",",
"framework_version",
"=",
"None",
",",
"compile_max_run",
"=",
"5",
"*",
"60",
",",
"tags",
"=",
"None",
",",
"*",... | Compile a Neo model using the input model.
Args:
target_instance_family (str): Identifies the device that you want to run your model after compilation, for
example: ml_c5. Allowed strings are: ml_c5, ml_m5, ml_c4, ml_m4, jetsontx1, jetsontx2, ml_p2, ml_p3,
deeplens, ... | [
"Compile",
"a",
"Neo",
"model",
"using",
"the",
"input",
"model",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L242-L287 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.attach | def attach(cls, training_job_name, sagemaker_session=None, model_channel_name='model'):
"""Attach to an existing training job.
Create an Estimator bound to an existing training job, each subclass is responsible to implement
``_prepare_init_params_from_job_description()`` as this method delegate... | python | def attach(cls, training_job_name, sagemaker_session=None, model_channel_name='model'):
"""Attach to an existing training job.
Create an Estimator bound to an existing training job, each subclass is responsible to implement
``_prepare_init_params_from_job_description()`` as this method delegate... | [
"def",
"attach",
"(",
"cls",
",",
"training_job_name",
",",
"sagemaker_session",
"=",
"None",
",",
"model_channel_name",
"=",
"'model'",
")",
":",
"sagemaker_session",
"=",
"sagemaker_session",
"or",
"Session",
"(",
")",
"job_details",
"=",
"sagemaker_session",
".... | Attach to an existing training job.
Create an Estimator bound to an existing training job, each subclass is responsible to implement
``_prepare_init_params_from_job_description()`` as this method delegates the actual conversion of a training
job description to the arguments that the class const... | [
"Attach",
"to",
"an",
"existing",
"training",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L290-L328 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.deploy | def deploy(self, initial_instance_count, instance_type, accelerator_type=None, endpoint_name=None,
use_compiled_model=False, update_endpoint=False, **kwargs):
"""Deploy the trained model to an Amazon SageMaker endpoint and return a ``sagemaker.RealTimePredictor`` object.
More information... | python | def deploy(self, initial_instance_count, instance_type, accelerator_type=None, endpoint_name=None,
use_compiled_model=False, update_endpoint=False, **kwargs):
"""Deploy the trained model to an Amazon SageMaker endpoint and return a ``sagemaker.RealTimePredictor`` object.
More information... | [
"def",
"deploy",
"(",
"self",
",",
"initial_instance_count",
",",
"instance_type",
",",
"accelerator_type",
"=",
"None",
",",
"endpoint_name",
"=",
"None",
",",
"use_compiled_model",
"=",
"False",
",",
"update_endpoint",
"=",
"False",
",",
"*",
"*",
"kwargs",
... | Deploy the trained model to an Amazon SageMaker endpoint and return a ``sagemaker.RealTimePredictor`` object.
More information:
http://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-training.html
Args:
initial_instance_count (int): Minimum number of EC2 instances to deploy to... | [
"Deploy",
"the",
"trained",
"model",
"to",
"an",
"Amazon",
"SageMaker",
"endpoint",
"and",
"return",
"a",
"sagemaker",
".",
"RealTimePredictor",
"object",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L330-L381 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.model_data | def model_data(self):
"""str: The model location in S3. Only set if Estimator has been ``fit()``."""
if self.latest_training_job is not None:
model_uri = self.sagemaker_session.sagemaker_client.describe_training_job(
TrainingJobName=self.latest_training_job.name)['ModelArtifa... | python | def model_data(self):
"""str: The model location in S3. Only set if Estimator has been ``fit()``."""
if self.latest_training_job is not None:
model_uri = self.sagemaker_session.sagemaker_client.describe_training_job(
TrainingJobName=self.latest_training_job.name)['ModelArtifa... | [
"def",
"model_data",
"(",
"self",
")",
":",
"if",
"self",
".",
"latest_training_job",
"is",
"not",
"None",
":",
"model_uri",
"=",
"self",
".",
"sagemaker_session",
".",
"sagemaker_client",
".",
"describe_training_job",
"(",
"TrainingJobName",
"=",
"self",
".",
... | str: The model location in S3. Only set if Estimator has been ``fit()``. | [
"str",
":",
"The",
"model",
"location",
"in",
"S3",
".",
"Only",
"set",
"if",
"Estimator",
"has",
"been",
"fit",
"()",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L384-L394 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase._prepare_init_params_from_job_description | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | python | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | [
"def",
"_prepare_init_params_from_job_description",
"(",
"cls",
",",
"job_details",
",",
"model_channel_name",
"=",
"None",
")",
":",
"init_params",
"=",
"dict",
"(",
")",
"init_params",
"[",
"'role'",
"]",
"=",
"job_details",
"[",
"'RoleArn'",
"]",
"init_params",... | Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_name (str): Name of the channel where pre-trained model data will be downloaded.
Returns:
... | [
"Convert",
"the",
"job",
"description",
"to",
"init",
"params",
"that",
"can",
"be",
"handled",
"by",
"the",
"class",
"constructor"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L408-L462 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.delete_endpoint | def delete_endpoint(self):
"""Delete an Amazon SageMaker ``Endpoint``.
Raises:
ValueError: If the endpoint does not exist.
"""
self._ensure_latest_training_job(error_message='Endpoint was not created yet')
self.sagemaker_session.delete_endpoint(self.latest_training_j... | python | def delete_endpoint(self):
"""Delete an Amazon SageMaker ``Endpoint``.
Raises:
ValueError: If the endpoint does not exist.
"""
self._ensure_latest_training_job(error_message='Endpoint was not created yet')
self.sagemaker_session.delete_endpoint(self.latest_training_j... | [
"def",
"delete_endpoint",
"(",
"self",
")",
":",
"self",
".",
"_ensure_latest_training_job",
"(",
"error_message",
"=",
"'Endpoint was not created yet'",
")",
"self",
".",
"sagemaker_session",
".",
"delete_endpoint",
"(",
"self",
".",
"latest_training_job",
".",
"name... | Delete an Amazon SageMaker ``Endpoint``.
Raises:
ValueError: If the endpoint does not exist. | [
"Delete",
"an",
"Amazon",
"SageMaker",
"Endpoint",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L464-L471 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.transformer | def transformer(self, instance_count, instance_type, strategy=None, assemble_with=None, output_path=None,
output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None,
max_payload=None, tags=None, role=None, volume_kms_key=None):
"""Return a ``Transformer`` ... | python | def transformer(self, instance_count, instance_type, strategy=None, assemble_with=None, output_path=None,
output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None,
max_payload=None, tags=None, role=None, volume_kms_key=None):
"""Return a ``Transformer`` ... | [
"def",
"transformer",
"(",
"self",
",",
"instance_count",
",",
"instance_type",
",",
"strategy",
"=",
"None",
",",
"assemble_with",
"=",
"None",
",",
"output_path",
"=",
"None",
",",
"output_kms_key",
"=",
"None",
",",
"accept",
"=",
"None",
",",
"env",
"=... | Return a ``Transformer`` that uses a SageMaker Model based on the training job. It reuses the
SageMaker Session and base job name used by the Estimator.
Args:
instance_count (int): Number of EC2 instances to use.
instance_type (str): Type of EC2 instance to use, for example, 'ml... | [
"Return",
"a",
"Transformer",
"that",
"uses",
"a",
"SageMaker",
"Model",
"based",
"on",
"the",
"training",
"job",
".",
"It",
"reuses",
"the",
"SageMaker",
"Session",
"and",
"base",
"job",
"name",
"used",
"by",
"the",
"Estimator",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L473-L513 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.training_job_analytics | def training_job_analytics(self):
"""Return a ``TrainingJobAnalytics`` object for the current training job.
"""
if self._current_job_name is None:
raise ValueError('Estimator is not associated with a TrainingJob')
return TrainingJobAnalytics(self._current_job_name, sagemaker_... | python | def training_job_analytics(self):
"""Return a ``TrainingJobAnalytics`` object for the current training job.
"""
if self._current_job_name is None:
raise ValueError('Estimator is not associated with a TrainingJob')
return TrainingJobAnalytics(self._current_job_name, sagemaker_... | [
"def",
"training_job_analytics",
"(",
"self",
")",
":",
"if",
"self",
".",
"_current_job_name",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Estimator is not associated with a TrainingJob'",
")",
"return",
"TrainingJobAnalytics",
"(",
"self",
".",
"_current_job_name... | Return a ``TrainingJobAnalytics`` object for the current training job. | [
"Return",
"a",
"TrainingJobAnalytics",
"object",
"for",
"the",
"current",
"training",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L516-L521 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | EstimatorBase.get_vpc_config | def get_vpc_config(self, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT):
"""
Returns VpcConfig dict either from this Estimator's subnets and security groups,
or else validate and return an optional override value.
"""
if vpc_config_override is vpc_utils.VPC_CONFIG_DEFAULT:
... | python | def get_vpc_config(self, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT):
"""
Returns VpcConfig dict either from this Estimator's subnets and security groups,
or else validate and return an optional override value.
"""
if vpc_config_override is vpc_utils.VPC_CONFIG_DEFAULT:
... | [
"def",
"get_vpc_config",
"(",
"self",
",",
"vpc_config_override",
"=",
"vpc_utils",
".",
"VPC_CONFIG_DEFAULT",
")",
":",
"if",
"vpc_config_override",
"is",
"vpc_utils",
".",
"VPC_CONFIG_DEFAULT",
":",
"return",
"vpc_utils",
".",
"to_dict",
"(",
"self",
".",
"subne... | Returns VpcConfig dict either from this Estimator's subnets and security groups,
or else validate and return an optional override value. | [
"Returns",
"VpcConfig",
"dict",
"either",
"from",
"this",
"Estimator",
"s",
"subnets",
"and",
"security",
"groups",
"or",
"else",
"validate",
"and",
"return",
"an",
"optional",
"override",
"value",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L523-L531 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | _TrainingJob.start_new | def start_new(cls, estimator, inputs):
"""Create a new Amazon SageMaker training job from the estimator.
Args:
estimator (sagemaker.estimator.EstimatorBase): Estimator object created by the user.
inputs (str): Parameters used when called :meth:`~sagemaker.estimator.EstimatorBas... | python | def start_new(cls, estimator, inputs):
"""Create a new Amazon SageMaker training job from the estimator.
Args:
estimator (sagemaker.estimator.EstimatorBase): Estimator object created by the user.
inputs (str): Parameters used when called :meth:`~sagemaker.estimator.EstimatorBas... | [
"def",
"start_new",
"(",
"cls",
",",
"estimator",
",",
"inputs",
")",
":",
"local_mode",
"=",
"estimator",
".",
"sagemaker_session",
".",
"local_mode",
"model_uri",
"=",
"estimator",
".",
"model_uri",
"# Allow file:// input only in local mode",
"if",
"cls",
".",
"... | Create a new Amazon SageMaker training job from the estimator.
Args:
estimator (sagemaker.estimator.EstimatorBase): Estimator object created by the user.
inputs (str): Parameters used when called :meth:`~sagemaker.estimator.EstimatorBase.fit`.
Returns:
sagemaker.es... | [
"Create",
"a",
"new",
"Amazon",
"SageMaker",
"training",
"job",
"from",
"the",
"estimator",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L540-L585 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Estimator.create_model | def create_model(self, role=None, image=None, predictor_cls=None, serializer=None, deserializer=None,
content_type=None, accept=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT, **kwargs):
"""
Create a model to deploy.
Args:
role (str): The ``ExecutionRole... | python | def create_model(self, role=None, image=None, predictor_cls=None, serializer=None, deserializer=None,
content_type=None, accept=None, vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT, **kwargs):
"""
Create a model to deploy.
Args:
role (str): The ``ExecutionRole... | [
"def",
"create_model",
"(",
"self",
",",
"role",
"=",
"None",
",",
"image",
"=",
"None",
",",
"predictor_cls",
"=",
"None",
",",
"serializer",
"=",
"None",
",",
"deserializer",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"accept",
"=",
"None",
... | Create a model to deploy.
Args:
role (str): The ``ExecutionRoleArn`` IAM Role ARN for the ``Model``, which is also used during
transform jobs. If not specified, the role from the Estimator will be used.
image (str): An container image to use for deploying the model. Defa... | [
"Create",
"a",
"model",
"to",
"deploy",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L695-L732 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Estimator._prepare_init_params_from_job_description | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | python | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | [
"def",
"_prepare_init_params_from_job_description",
"(",
"cls",
",",
"job_details",
",",
"model_channel_name",
"=",
"None",
")",
":",
"init_params",
"=",
"super",
"(",
"Estimator",
",",
"cls",
")",
".",
"_prepare_init_params_from_job_description",
"(",
"job_details",
... | Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_name (str): Name of the channel where pre-trained model data will be downloaded
Returns:
... | [
"Convert",
"the",
"job",
"description",
"to",
"init",
"params",
"that",
"can",
"be",
"handled",
"by",
"the",
"class",
"constructor"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L735-L749 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Framework._prepare_for_training | def _prepare_for_training(self, job_name=None):
"""Set hyperparameters needed for training. This method will also validate ``source_dir``.
Args:
* job_name (str): Name of the training job to be created. If not specified, one is generated,
using the base name given to the con... | python | def _prepare_for_training(self, job_name=None):
"""Set hyperparameters needed for training. This method will also validate ``source_dir``.
Args:
* job_name (str): Name of the training job to be created. If not specified, one is generated,
using the base name given to the con... | [
"def",
"_prepare_for_training",
"(",
"self",
",",
"job_name",
"=",
"None",
")",
":",
"super",
"(",
"Framework",
",",
"self",
")",
".",
"_prepare_for_training",
"(",
"job_name",
"=",
"job_name",
")",
"# validate source dir will raise a ValueError if there is something wr... | Set hyperparameters needed for training. This method will also validate ``source_dir``.
Args:
* job_name (str): Name of the training job to be created. If not specified, one is generated,
using the base name given to the constructor if applicable. | [
"Set",
"hyperparameters",
"needed",
"for",
"training",
".",
"This",
"method",
"will",
"also",
"validate",
"source_dir",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L824-L860 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Framework._stage_user_code_in_s3 | def _stage_user_code_in_s3(self):
"""Upload the user training script to s3 and return the location.
Returns: s3 uri
"""
local_mode = self.output_path.startswith('file://')
if self.code_location is None and local_mode:
code_bucket = self.sagemaker_session.default_bu... | python | def _stage_user_code_in_s3(self):
"""Upload the user training script to s3 and return the location.
Returns: s3 uri
"""
local_mode = self.output_path.startswith('file://')
if self.code_location is None and local_mode:
code_bucket = self.sagemaker_session.default_bu... | [
"def",
"_stage_user_code_in_s3",
"(",
"self",
")",
":",
"local_mode",
"=",
"self",
".",
"output_path",
".",
"startswith",
"(",
"'file://'",
")",
"if",
"self",
".",
"code_location",
"is",
"None",
"and",
"local_mode",
":",
"code_bucket",
"=",
"self",
".",
"sag... | Upload the user training script to s3 and return the location.
Returns: s3 uri | [
"Upload",
"the",
"user",
"training",
"script",
"to",
"s3",
"and",
"return",
"the",
"location",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L862-L892 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Framework._model_source_dir | def _model_source_dir(self):
"""Get the appropriate value to pass as source_dir to model constructor on deploying
Returns:
str: Either a local or an S3 path pointing to the source_dir to be used for code by the model to be deployed
"""
return self.source_dir if self.sagemake... | python | def _model_source_dir(self):
"""Get the appropriate value to pass as source_dir to model constructor on deploying
Returns:
str: Either a local or an S3 path pointing to the source_dir to be used for code by the model to be deployed
"""
return self.source_dir if self.sagemake... | [
"def",
"_model_source_dir",
"(",
"self",
")",
":",
"return",
"self",
".",
"source_dir",
"if",
"self",
".",
"sagemaker_session",
".",
"local_mode",
"else",
"self",
".",
"uploaded_code",
".",
"s3_prefix"
] | Get the appropriate value to pass as source_dir to model constructor on deploying
Returns:
str: Either a local or an S3 path pointing to the source_dir to be used for code by the model to be deployed | [
"Get",
"the",
"appropriate",
"value",
"to",
"pass",
"as",
"source_dir",
"to",
"model",
"constructor",
"on",
"deploying"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L894-L900 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Framework._prepare_init_params_from_job_description | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | python | def _prepare_init_params_from_job_description(cls, job_details, model_channel_name=None):
"""Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_n... | [
"def",
"_prepare_init_params_from_job_description",
"(",
"cls",
",",
"job_details",
",",
"model_channel_name",
"=",
"None",
")",
":",
"init_params",
"=",
"super",
"(",
"Framework",
",",
"cls",
")",
".",
"_prepare_init_params_from_job_description",
"(",
"job_details",
... | Convert the job description to init params that can be handled by the class constructor
Args:
job_details: the returned job details from a describe_training_job API call.
model_channel_name (str): Name of the channel where pre-trained model data will be downloaded
Returns:
... | [
"Convert",
"the",
"job",
"description",
"to",
"init",
"params",
"that",
"can",
"be",
"handled",
"by",
"the",
"class",
"constructor"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L914-L946 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Framework.train_image | def train_image(self):
"""Return the Docker image to use for training.
The :meth:`~sagemaker.estimator.EstimatorBase.fit` method, which does the model training,
calls this method to find the image to use for model training.
Returns:
str: The URI of the Docker image.
... | python | def train_image(self):
"""Return the Docker image to use for training.
The :meth:`~sagemaker.estimator.EstimatorBase.fit` method, which does the model training,
calls this method to find the image to use for model training.
Returns:
str: The URI of the Docker image.
... | [
"def",
"train_image",
"(",
"self",
")",
":",
"if",
"self",
".",
"image_name",
":",
"return",
"self",
".",
"image_name",
"else",
":",
"return",
"create_image_uri",
"(",
"self",
".",
"sagemaker_session",
".",
"boto_region_name",
",",
"self",
".",
"__framework_na... | Return the Docker image to use for training.
The :meth:`~sagemaker.estimator.EstimatorBase.fit` method, which does the model training,
calls this method to find the image to use for model training.
Returns:
str: The URI of the Docker image. | [
"Return",
"the",
"Docker",
"image",
"to",
"use",
"for",
"training",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L948-L964 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Framework.attach | def attach(cls, training_job_name, sagemaker_session=None, model_channel_name='model'):
"""Attach to an existing training job.
Create an Estimator bound to an existing training job, each subclass is responsible to implement
``_prepare_init_params_from_job_description()`` as this method delegate... | python | def attach(cls, training_job_name, sagemaker_session=None, model_channel_name='model'):
"""Attach to an existing training job.
Create an Estimator bound to an existing training job, each subclass is responsible to implement
``_prepare_init_params_from_job_description()`` as this method delegate... | [
"def",
"attach",
"(",
"cls",
",",
"training_job_name",
",",
"sagemaker_session",
"=",
"None",
",",
"model_channel_name",
"=",
"'model'",
")",
":",
"estimator",
"=",
"super",
"(",
"Framework",
",",
"cls",
")",
".",
"attach",
"(",
"training_job_name",
",",
"sa... | Attach to an existing training job.
Create an Estimator bound to an existing training job, each subclass is responsible to implement
``_prepare_init_params_from_job_description()`` as this method delegates the actual conversion of a training
job description to the arguments that the class const... | [
"Attach",
"to",
"an",
"existing",
"training",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L967-L1002 | train |
aws/sagemaker-python-sdk | src/sagemaker/estimator.py | Framework.transformer | def transformer(self, instance_count, instance_type, strategy=None, assemble_with=None, output_path=None,
output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None,
max_payload=None, tags=None, role=None, model_server_workers=None, volume_kms_key=None):
"... | python | def transformer(self, instance_count, instance_type, strategy=None, assemble_with=None, output_path=None,
output_kms_key=None, accept=None, env=None, max_concurrent_transforms=None,
max_payload=None, tags=None, role=None, model_server_workers=None, volume_kms_key=None):
"... | [
"def",
"transformer",
"(",
"self",
",",
"instance_count",
",",
"instance_type",
",",
"strategy",
"=",
"None",
",",
"assemble_with",
"=",
"None",
",",
"output_path",
"=",
"None",
",",
"output_kms_key",
"=",
"None",
",",
"accept",
"=",
"None",
",",
"env",
"=... | Return a ``Transformer`` that uses a SageMaker Model based on the training job. It reuses the
SageMaker Session and base job name used by the Estimator.
Args:
instance_count (int): Number of EC2 instances to use.
instance_type (str): Type of EC2 instance to use, for example, 'ml... | [
"Return",
"a",
"Transformer",
"that",
"uses",
"a",
"SageMaker",
"Model",
"based",
"on",
"the",
"training",
"job",
".",
"It",
"reuses",
"the",
"SageMaker",
"Session",
"and",
"base",
"job",
"name",
"used",
"by",
"the",
"Estimator",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/estimator.py#L1018-L1070 | train |
aws/sagemaker-python-sdk | src/sagemaker/amazon/hyperparameter.py | Hyperparameter.serialize_all | def serialize_all(obj):
"""Return all non-None ``hyperparameter`` values on ``obj`` as a ``dict[str,str].``"""
if '_hyperparameters' not in dir(obj):
return {}
return {k: str(v) for k, v in obj._hyperparameters.items() if v is not None} | python | def serialize_all(obj):
"""Return all non-None ``hyperparameter`` values on ``obj`` as a ``dict[str,str].``"""
if '_hyperparameters' not in dir(obj):
return {}
return {k: str(v) for k, v in obj._hyperparameters.items() if v is not None} | [
"def",
"serialize_all",
"(",
"obj",
")",
":",
"if",
"'_hyperparameters'",
"not",
"in",
"dir",
"(",
"obj",
")",
":",
"return",
"{",
"}",
"return",
"{",
"k",
":",
"str",
"(",
"v",
")",
"for",
"k",
",",
"v",
"in",
"obj",
".",
"_hyperparameters",
".",
... | Return all non-None ``hyperparameter`` values on ``obj`` as a ``dict[str,str].`` | [
"Return",
"all",
"non",
"-",
"None",
"hyperparameter",
"values",
"on",
"obj",
"as",
"a",
"dict",
"[",
"str",
"str",
"]",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/amazon/hyperparameter.py#L66-L70 | train |
aws/sagemaker-python-sdk | src/sagemaker/local/entities.py | _LocalTransformJob.start | def start(self, input_data, output_data, transform_resources, **kwargs):
"""Start the Local Transform Job
Args:
input_data (dict): Describes the dataset to be transformed and the location where it is stored.
output_data (dict): Identifies the location where to save the results f... | python | def start(self, input_data, output_data, transform_resources, **kwargs):
"""Start the Local Transform Job
Args:
input_data (dict): Describes the dataset to be transformed and the location where it is stored.
output_data (dict): Identifies the location where to save the results f... | [
"def",
"start",
"(",
"self",
",",
"input_data",
",",
"output_data",
",",
"transform_resources",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"transform_resources",
"=",
"transform_resources",
"self",
".",
"input_data",
"=",
"input_data",
"self",
".",
"outpu... | Start the Local Transform Job
Args:
input_data (dict): Describes the dataset to be transformed and the location where it is stored.
output_data (dict): Identifies the location where to save the results from the transform job
transform_resources (dict): compute instances for ... | [
"Start",
"the",
"Local",
"Transform",
"Job"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/local/entities.py#L111-L159 | train |
aws/sagemaker-python-sdk | src/sagemaker/local/entities.py | _LocalTransformJob.describe | def describe(self):
"""Describe this _LocalTransformJob
The response is a JSON-like dictionary that follows the response of the
boto describe_transform_job() API.
Returns:
dict: description of this _LocalTransformJob
"""
response = {
'TransformJo... | python | def describe(self):
"""Describe this _LocalTransformJob
The response is a JSON-like dictionary that follows the response of the
boto describe_transform_job() API.
Returns:
dict: description of this _LocalTransformJob
"""
response = {
'TransformJo... | [
"def",
"describe",
"(",
"self",
")",
":",
"response",
"=",
"{",
"'TransformJobStatus'",
":",
"self",
".",
"state",
",",
"'ModelName'",
":",
"self",
".",
"model_name",
",",
"'TransformJobName'",
":",
"self",
".",
"name",
",",
"'TransformJobArn'",
":",
"_UNUSE... | Describe this _LocalTransformJob
The response is a JSON-like dictionary that follows the response of the
boto describe_transform_job() API.
Returns:
dict: description of this _LocalTransformJob | [
"Describe",
"this",
"_LocalTransformJob"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/local/entities.py#L161-L191 | train |
aws/sagemaker-python-sdk | src/sagemaker/local/entities.py | _LocalTransformJob._get_container_environment | def _get_container_environment(self, **kwargs):
"""Get all the Environment variables that will be passed to the container
Certain input fields such as BatchStrategy have different values for the API vs the Environment
variables, such as SingleRecord vs SINGLE_RECORD. This method also handles th... | python | def _get_container_environment(self, **kwargs):
"""Get all the Environment variables that will be passed to the container
Certain input fields such as BatchStrategy have different values for the API vs the Environment
variables, such as SingleRecord vs SINGLE_RECORD. This method also handles th... | [
"def",
"_get_container_environment",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"environment",
"=",
"{",
"}",
"environment",
".",
"update",
"(",
"self",
".",
"primary_container",
"[",
"'Environment'",
"]",
")",
"environment",
"[",
"'SAGEMAKER_BATCH'",
"]"... | Get all the Environment variables that will be passed to the container
Certain input fields such as BatchStrategy have different values for the API vs the Environment
variables, such as SingleRecord vs SINGLE_RECORD. This method also handles this conversion.
Args:
**kwargs: existin... | [
"Get",
"all",
"the",
"Environment",
"variables",
"that",
"will",
"be",
"passed",
"to",
"the",
"container"
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/local/entities.py#L193-L230 | train |
aws/sagemaker-python-sdk | src/sagemaker/parameter.py | ParameterRange.as_tuning_range | def as_tuning_range(self, name):
"""Represent the parameter range as a dicionary suitable for a request to
create an Amazon SageMaker hyperparameter tuning job.
Args:
name (str): The name of the hyperparameter.
Returns:
dict[str, str]: A dictionary that contains... | python | def as_tuning_range(self, name):
"""Represent the parameter range as a dicionary suitable for a request to
create an Amazon SageMaker hyperparameter tuning job.
Args:
name (str): The name of the hyperparameter.
Returns:
dict[str, str]: A dictionary that contains... | [
"def",
"as_tuning_range",
"(",
"self",
",",
"name",
")",
":",
"return",
"{",
"'Name'",
":",
"name",
",",
"'MinValue'",
":",
"to_str",
"(",
"self",
".",
"min_value",
")",
",",
"'MaxValue'",
":",
"to_str",
"(",
"self",
".",
"max_value",
")",
",",
"'Scali... | Represent the parameter range as a dicionary suitable for a request to
create an Amazon SageMaker hyperparameter tuning job.
Args:
name (str): The name of the hyperparameter.
Returns:
dict[str, str]: A dictionary that contains the name and values of the hyperparameter. | [
"Represent",
"the",
"parameter",
"range",
"as",
"a",
"dicionary",
"suitable",
"for",
"a",
"request",
"to",
"create",
"an",
"Amazon",
"SageMaker",
"hyperparameter",
"tuning",
"job",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/parameter.py#L56-L69 | train |
aws/sagemaker-python-sdk | src/sagemaker/parameter.py | CategoricalParameter.as_json_range | def as_json_range(self, name):
"""Represent the parameter range as a dictionary suitable for a request to
create an Amazon SageMaker hyperparameter tuning job using one of the deep learning frameworks.
The deep learning framework images require that hyperparameters be serialized as JSON.
... | python | def as_json_range(self, name):
"""Represent the parameter range as a dictionary suitable for a request to
create an Amazon SageMaker hyperparameter tuning job using one of the deep learning frameworks.
The deep learning framework images require that hyperparameters be serialized as JSON.
... | [
"def",
"as_json_range",
"(",
"self",
",",
"name",
")",
":",
"return",
"{",
"'Name'",
":",
"name",
",",
"'Values'",
":",
"[",
"json",
".",
"dumps",
"(",
"v",
")",
"for",
"v",
"in",
"self",
".",
"values",
"]",
"}"
] | Represent the parameter range as a dictionary suitable for a request to
create an Amazon SageMaker hyperparameter tuning job using one of the deep learning frameworks.
The deep learning framework images require that hyperparameters be serialized as JSON.
Args:
name (str): The name ... | [
"Represent",
"the",
"parameter",
"range",
"as",
"a",
"dictionary",
"suitable",
"for",
"a",
"request",
"to",
"create",
"an",
"Amazon",
"SageMaker",
"hyperparameter",
"tuning",
"job",
"using",
"one",
"of",
"the",
"deep",
"learning",
"frameworks",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/parameter.py#L114-L127 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | container_def | def container_def(image, model_data_url=None, env=None):
"""Create a definition for executing a container as part of a SageMaker model.
Args:
image (str): Docker image to run for this container.
model_data_url (str): S3 URI of data required by this container,
e.g. SageMaker training... | python | def container_def(image, model_data_url=None, env=None):
"""Create a definition for executing a container as part of a SageMaker model.
Args:
image (str): Docker image to run for this container.
model_data_url (str): S3 URI of data required by this container,
e.g. SageMaker training... | [
"def",
"container_def",
"(",
"image",
",",
"model_data_url",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"if",
"env",
"is",
"None",
":",
"env",
"=",
"{",
"}",
"c_def",
"=",
"{",
"'Image'",
":",
"image",
",",
"'Environment'",
":",
"env",
"}",
"i... | Create a definition for executing a container as part of a SageMaker model.
Args:
image (str): Docker image to run for this container.
model_data_url (str): S3 URI of data required by this container,
e.g. SageMaker training job model artifacts (default: None).
env (dict[str, str... | [
"Create",
"a",
"definition",
"for",
"executing",
"a",
"container",
"as",
"part",
"of",
"a",
"SageMaker",
"model",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L1229-L1246 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | pipeline_container_def | def pipeline_container_def(models, instance_type=None):
"""
Create a definition for executing a pipeline of containers as part of a SageMaker model.
Args:
models (list[sagemaker.Model]): this will be a list of ``sagemaker.Model`` objects in the order the inference
should be invoked.
... | python | def pipeline_container_def(models, instance_type=None):
"""
Create a definition for executing a pipeline of containers as part of a SageMaker model.
Args:
models (list[sagemaker.Model]): this will be a list of ``sagemaker.Model`` objects in the order the inference
should be invoked.
... | [
"def",
"pipeline_container_def",
"(",
"models",
",",
"instance_type",
"=",
"None",
")",
":",
"c_defs",
"=",
"[",
"]",
"# should contain list of container definitions in the same order customer passed",
"for",
"model",
"in",
"models",
":",
"c_defs",
".",
"append",
"(",
... | Create a definition for executing a pipeline of containers as part of a SageMaker model.
Args:
models (list[sagemaker.Model]): this will be a list of ``sagemaker.Model`` objects in the order the inference
should be invoked.
instance_type (str): The EC2 instance type to deploy this Model to. ... | [
"Create",
"a",
"definition",
"for",
"executing",
"a",
"pipeline",
"of",
"containers",
"as",
"part",
"of",
"a",
"SageMaker",
"model",
".",
"Args",
":",
"models",
"(",
"list",
"[",
"sagemaker",
".",
"Model",
"]",
")",
":",
"this",
"will",
"be",
"a",
"lis... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L1249-L1263 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | production_variant | def production_variant(model_name, instance_type, initial_instance_count=1, variant_name='AllTraffic',
initial_weight=1, accelerator_type=None):
"""Create a production variant description suitable for use in a ``ProductionVariant`` list as part of a
``CreateEndpointConfig`` request.
... | python | def production_variant(model_name, instance_type, initial_instance_count=1, variant_name='AllTraffic',
initial_weight=1, accelerator_type=None):
"""Create a production variant description suitable for use in a ``ProductionVariant`` list as part of a
``CreateEndpointConfig`` request.
... | [
"def",
"production_variant",
"(",
"model_name",
",",
"instance_type",
",",
"initial_instance_count",
"=",
"1",
",",
"variant_name",
"=",
"'AllTraffic'",
",",
"initial_weight",
"=",
"1",
",",
"accelerator_type",
"=",
"None",
")",
":",
"production_variant_configuration"... | Create a production variant description suitable for use in a ``ProductionVariant`` list as part of a
``CreateEndpointConfig`` request.
Args:
model_name (str): The name of the SageMaker model this production variant references.
instance_type (str): The EC2 instance type for this production vari... | [
"Create",
"a",
"production",
"variant",
"description",
"suitable",
"for",
"use",
"in",
"a",
"ProductionVariant",
"list",
"as",
"part",
"of",
"a",
"CreateEndpointConfig",
"request",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L1266-L1294 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | get_execution_role | def get_execution_role(sagemaker_session=None):
"""Return the role ARN whose credentials are used to call the API.
Throws an exception if
Args:
sagemaker_session(Session): Current sagemaker session
Returns:
(str): The role ARN
"""
if not sagemaker_session:
sagemaker_sessi... | python | def get_execution_role(sagemaker_session=None):
"""Return the role ARN whose credentials are used to call the API.
Throws an exception if
Args:
sagemaker_session(Session): Current sagemaker session
Returns:
(str): The role ARN
"""
if not sagemaker_session:
sagemaker_sessi... | [
"def",
"get_execution_role",
"(",
"sagemaker_session",
"=",
"None",
")",
":",
"if",
"not",
"sagemaker_session",
":",
"sagemaker_session",
"=",
"Session",
"(",
")",
"arn",
"=",
"sagemaker_session",
".",
"get_caller_identity_arn",
"(",
")",
"if",
"':role/'",
"in",
... | Return the role ARN whose credentials are used to call the API.
Throws an exception if
Args:
sagemaker_session(Session): Current sagemaker session
Returns:
(str): The role ARN | [
"Return",
"the",
"role",
"ARN",
"whose",
"credentials",
"are",
"used",
"to",
"call",
"the",
"API",
".",
"Throws",
"an",
"exception",
"if",
"Args",
":",
"sagemaker_session",
"(",
"Session",
")",
":",
"Current",
"sagemaker",
"session",
"Returns",
":",
"(",
"... | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L1297-L1312 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session._initialize | def _initialize(self, boto_session, sagemaker_client, sagemaker_runtime_client):
"""Initialize this SageMaker Session.
Creates or uses a boto_session, sagemaker_client and sagemaker_runtime_client.
Sets the region_name.
"""
self.boto_session = boto_session or boto3.Session()
... | python | def _initialize(self, boto_session, sagemaker_client, sagemaker_runtime_client):
"""Initialize this SageMaker Session.
Creates or uses a boto_session, sagemaker_client and sagemaker_runtime_client.
Sets the region_name.
"""
self.boto_session = boto_session or boto3.Session()
... | [
"def",
"_initialize",
"(",
"self",
",",
"boto_session",
",",
"sagemaker_client",
",",
"sagemaker_runtime_client",
")",
":",
"self",
".",
"boto_session",
"=",
"boto_session",
"or",
"boto3",
".",
"Session",
"(",
")",
"self",
".",
"_region_name",
"=",
"self",
"."... | Initialize this SageMaker Session.
Creates or uses a boto_session, sagemaker_client and sagemaker_runtime_client.
Sets the region_name. | [
"Initialize",
"this",
"SageMaker",
"Session",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L89-L112 | train |
aws/sagemaker-python-sdk | src/sagemaker/session.py | Session.upload_data | def upload_data(self, path, bucket=None, key_prefix='data'):
"""Upload local file or directory to S3.
If a single file is specified for upload, the resulting S3 object key is ``{key_prefix}/{filename}``
(filename does not include the local path, if any specified).
If a directory is spe... | python | def upload_data(self, path, bucket=None, key_prefix='data'):
"""Upload local file or directory to S3.
If a single file is specified for upload, the resulting S3 object key is ``{key_prefix}/{filename}``
(filename does not include the local path, if any specified).
If a directory is spe... | [
"def",
"upload_data",
"(",
"self",
",",
"path",
",",
"bucket",
"=",
"None",
",",
"key_prefix",
"=",
"'data'",
")",
":",
"# Generate a tuple for each file that we want to upload of the form (local_path, s3_key).",
"files",
"=",
"[",
"]",
"key_suffix",
"=",
"None",
"if"... | Upload local file or directory to S3.
If a single file is specified for upload, the resulting S3 object key is ``{key_prefix}/{filename}``
(filename does not include the local path, if any specified).
If a directory is specified for upload, the API uploads all content, recursively,
pre... | [
"Upload",
"local",
"file",
"or",
"directory",
"to",
"S3",
"."
] | a9e724c7d3f5572b68c3903548c792a59d99799a | https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/session.py#L118-L169 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.