Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Uh oh!
There was an error while loading. Please reload this page.
fixes for model builder #5631
Changes from all commits
6004e8be0c912b3debf5854acad2a31427d8a763c671ea233a83cbd0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -112,34 +112,45 @@ def test_build_from_training_job(self, training_job_name): | ||
| assert model_builder.image_uri is not None | ||
| assert model_builder.instance_type is not None | ||
| @pytest.mark.skip(reason="Skipped: parallel cleanup race condition under investigation") | ||
| 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.""" | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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