-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fixes for model builder #5631
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
Open
rsareddy0329
wants to merge
5
commits into
aws:master
Choose a base branch
from
rsareddy0329:model-builder-fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+502
−168
Open
fixes for model builder #5631
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6004e8b
fixes for model builder
jjtowner e0c912b
add nova model support
jjtowner 3debf58
fix env_vars merge, update integ test for LORA two-step deployment, f…
54acad2
Merge branch 'aws:master' into model-builder-fixes
rsareddy0329 a31427d
update codegen to mark MinMemoryRequiredInMb as optional
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
|---|---|---|
|
|
@@ -113,33 +113,43 @@ def test_build_from_training_job(self, training_job_name): | |
| assert model_builder.instance_type is not None | ||
|
|
||
| def test_deploy_from_training_job(self, training_job_name, endpoint_name, cleanup_endpoints): | ||
| """Test deploying model from training job and adapter.""" | ||
| from sagemaker.core.resources import TrainingJob | ||
| """Test deploying model from training job. | ||
|
Contributor
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. Can we add a test case for Nova ? |
||
|
|
||
| For LORA models, this verifies the two-step deployment: | ||
| base IC + adapter IC are both created on the same endpoint. | ||
| """ | ||
| from sagemaker.core.resources import TrainingJob, InferenceComponent | ||
| from sagemaker.serve import ModelBuilder | ||
| import time | ||
|
|
||
| training_job = TrainingJob.get(training_job_name=training_job_name) | ||
| model_builder = ModelBuilder(model=training_job) | ||
| model = model_builder.build(model_name=f"test-model-{int(time.time())}-{random.randint(100, 10000)}") | ||
| endpoint = model_builder.deploy(endpoint_name=endpoint_name) | ||
| model_builder = ModelBuilder(model=training_job, instance_type="ml.g5.4xlarge") | ||
| model_builder.build(model_name=f"test-model-{int(time.time())}-{random.randint(100, 10000)}") | ||
|
|
||
| peft_type = model_builder._fetch_peft() | ||
| adapter_name = f"{endpoint_name}-adapter" | ||
|
|
||
| endpoint = model_builder.deploy( | ||
| endpoint_name=endpoint_name, | ||
| inference_component_name=adapter_name if peft_type == "LORA" else None, | ||
| ) | ||
|
|
||
| cleanup_endpoints.append(endpoint_name) | ||
|
|
||
| assert endpoint is not None | ||
| assert endpoint.endpoint_arn is not None | ||
| assert endpoint.endpoint_status == "InService" | ||
|
|
||
| # Deploy adapter to the same endpoint | ||
| adapter_name = f"{endpoint_name}-adapter-{int(time.time())}-{random.randint(100, 100000)}" | ||
| model_builder2 = ModelBuilder(model=training_job) | ||
| model_builder2.build() | ||
| endpoint2 = model_builder2.deploy( | ||
| endpoint_name=endpoint_name, | ||
| inference_component_name=adapter_name | ||
| ) | ||
| if peft_type == "LORA": | ||
| # Verify base IC was created | ||
| base_ic_name = f"{endpoint_name}-inference-component" | ||
| base_ic = InferenceComponent.get(inference_component_name=base_ic_name) | ||
| assert base_ic is not None | ||
| assert base_ic.inference_component_status == "InService" | ||
|
|
||
| assert endpoint2 is not None | ||
| assert endpoint2.endpoint_name == endpoint_name | ||
| # Verify adapter IC was created | ||
| adapter_ic = InferenceComponent.get(inference_component_name=adapter_name) | ||
| assert adapter_ic is not None | ||
|
|
||
| def test_fetch_endpoint_names_for_base_model(self, training_job_name): | ||
| """Test fetching endpoint names for base model.""" | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update the engine to mark this as Optional ?
We can add a condition for this specific case