-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: inference instance type conditioned on training instance type #4230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
knikure
merged 7 commits into
aws:master
from
evakravi:feat/inference-instance-type-conditioned-on-training-instance-type
Oct 26, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cea49d7
feat: inference instance type conditioned on training instance type
evakravi 389fadf
chore: address PR comments
evakravi 8a696cc
chore: remove unnecessary comment
evakravi c3a0b33
chore: improve function name to make more generic
evakravi 97a5816
chore: improve logic for getting training instance variants
evakravi 727989a
Merge branch 'master' into feat/inference-instance-type-conditioned-o…
evakravi b376a67
Merge branch 'master' into feat/inference-instance-type-conditioned-o…
evakravi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -581,6 +581,56 @@ def get_instance_specific_environment_variables(self, instance_type: str) -> Dic | |
|
||
return instance_family_environment_variables | ||
|
||
def get_instance_specific_default_inference_instance_type( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consider renaming: |
||
self, instance_type: str | ||
) -> Optional[str]: | ||
"""Returns instance specific default inference instance type. | ||
|
||
Returns None if a model, instance type tuple does not have instance | ||
specific inference instance types. | ||
""" | ||
|
||
return self._get_instance_specific_property( | ||
instance_type, "default_inference_instance_type" | ||
) | ||
|
||
def get_instance_specific_supported_inference_instance_types( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment please |
||
self, instance_type: str | ||
) -> List[str]: | ||
"""Returns instance specific supported inference instance types. | ||
|
||
Returns empty list if a model, instance type tuple does not have instance | ||
specific inference instance types. | ||
""" | ||
|
||
if self.variants is None: | ||
return [] | ||
|
||
instance_specific_inference_instance_types: List[str] = ( | ||
self.variants.get(instance_type, {}) | ||
.get("properties", {}) | ||
.get("supported_inference_instance_types", []) | ||
) | ||
|
||
instance_type_family = get_instance_type_family(instance_type) | ||
|
||
instance_family_inference_instance_types: List[str] = ( | ||
self.variants.get(instance_type_family, {}) | ||
.get("properties", {}) | ||
.get("supported_inference_instance_types", []) | ||
if instance_type_family not in {"", None} | ||
else [] | ||
) | ||
|
||
return sorted( | ||
list( | ||
set( | ||
instance_specific_inference_instance_types | ||
+ instance_family_inference_instance_types | ||
) | ||
) | ||
) | ||
|
||
def get_image_uri(self, instance_type: str, region: str) -> Optional[str]: | ||
"""Returns image uri from instance type and region. | ||
|
||
|
@@ -971,6 +1021,7 @@ class JumpStartModelInitKwargs(JumpStartKwargs): | |
"dependencies", | ||
"git_config", | ||
"model_package_arn", | ||
"training_instance_type", | ||
] | ||
|
||
SERIALIZATION_EXCLUSION_SET = { | ||
|
@@ -981,6 +1032,7 @@ class JumpStartModelInitKwargs(JumpStartKwargs): | |
"tolerate_deprecated_model", | ||
"region", | ||
"model_package_arn", | ||
"training_instance_type", | ||
} | ||
|
||
def __init__( | ||
|
@@ -1009,6 +1061,7 @@ def __init__( | |
tolerate_vulnerable_model: Optional[bool] = None, | ||
tolerate_deprecated_model: Optional[bool] = None, | ||
model_package_arn: Optional[str] = None, | ||
training_instance_type: Optional[str] = None, | ||
) -> None: | ||
"""Instantiates JumpStartModelInitKwargs object.""" | ||
|
||
|
@@ -1036,6 +1089,7 @@ def __init__( | |
self.tolerate_deprecated_model = tolerate_deprecated_model | ||
self.tolerate_vulnerable_model = tolerate_vulnerable_model | ||
self.model_package_arn = model_package_arn | ||
self.training_instance_type = training_instance_type | ||
|
||
|
||
class JumpStartModelDeployKwargs(JumpStartKwargs): | ||
|
@@ -1065,6 +1119,7 @@ class JumpStartModelDeployKwargs(JumpStartKwargs): | |
"tolerate_vulnerable_model", | ||
"tolerate_deprecated_model", | ||
"sagemaker_session", | ||
"training_instance_type", | ||
] | ||
|
||
SERIALIZATION_EXCLUSION_SET = { | ||
|
@@ -1074,6 +1129,7 @@ class JumpStartModelDeployKwargs(JumpStartKwargs): | |
"tolerate_deprecated_model", | ||
"tolerate_vulnerable_model", | ||
"sagemaker_session", | ||
"training_instance_type", | ||
} | ||
|
||
def __init__( | ||
|
@@ -1101,6 +1157,7 @@ def __init__( | |
tolerate_deprecated_model: Optional[bool] = None, | ||
tolerate_vulnerable_model: Optional[bool] = None, | ||
sagemaker_session: Optional[Session] = None, | ||
training_instance_type: Optional[str] = None, | ||
) -> None: | ||
"""Instantiates JumpStartModelDeployKwargs object.""" | ||
|
||
|
@@ -1127,6 +1184,7 @@ def __init__( | |
self.tolerate_vulnerable_model = tolerate_vulnerable_model | ||
self.tolerate_deprecated_model = tolerate_deprecated_model | ||
self.sagemaker_session = sagemaker_session | ||
self.training_instance_type = training_instance_type | ||
|
||
|
||
class JumpStartEstimatorInitKwargs(JumpStartKwargs): | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.