test: add integ tests for show_metrics and model reuse (reuse_resourc… - #6158
Conversation
| endpoint2 = builder2.deploy(reuse_resources=True) | ||
|
|
||
| assert endpoint2 is not None | ||
| assert endpoint2.endpoint_arn == endpoint.endpoint_arn, ( |
| role=config["role"], | ||
| accept_eula=True, | ||
| ) | ||
| trainer._latest_job = job |
There was a problem hiding this comment.
Can we also call stream_logs() here. Not sure how we can validation stream_logs() output. But at least calling it in the test will ensure no exception was thrown.
| assert training_job.output_model_package_arn is not None | ||
|
|
||
| # Verify show_metrics() works via MLflow path for OSS models | ||
| result = sft_trainer.show_metrics() |
There was a problem hiding this comment.
Same, can we also add stream_logs() below show_metrics()
| import matplotlib | ||
| matplotlib.use("Agg") | ||
|
|
||
| df = sft_trainer.show_metrics() |
There was a problem hiding this comment.
Can we add stream logs here too?
| First build creates a Model, second build with reuse finds it. | ||
| """ | ||
| training_job = TrainingJob.get(training_job_name=training_job_name, region=AWS_REGION) | ||
| unique_id = f"{int(time.time())}-{random.randint(100, 10000)}" |
There was a problem hiding this comment.
There is a super small chance of race condition here. If 2 codebuild test runs end up having the same unique_id. Might want to call this out as a code comment.
| # Verify only one model exists with our unique prefix | ||
| sm_client = boto3.client("sagemaker", region_name=AWS_REGION) | ||
| models = sm_client.list_models(NameContains=f"reuse-build-{unique_id}", MaxResults=10).get("Models", []) | ||
| assert len(models) == 1, ( |
There was a problem hiding this comment.
Should we assert model2.model_arn == model1.model_arn instead?
| NameContains=f"nova-reuse-build-{unique_id}", | ||
| MaxResults=10, | ||
| ).get("Models", []) | ||
| assert len(models) == 1, ( |
There was a problem hiding this comment.
Should we assert model2.model_arn == model1.model_arn instead?
1abebcf to
e0ac4e3
Compare
…es=True) - Add show_metrics() assertions to existing Nova SFT tests (serverless + serverful) - Add show_metrics() via MLflow to OSS Llama SFT test - Add show_metrics() to MTRL trainer integration test - Add reuse round-trip tests to test_model_customization_deployment.py (OSS, us-west-2) - Add reuse round-trip tests to test_nova_model_customization_deployment.py (Nova, us-east-1) - Add build(reuse_resources=True) tests to both deployment test files
e0ac4e3 to
c4f3737
Compare
…es=True)
Issue #, if available:
Description of changes:
Adds integration test coverage for:
show_metrics()
global_step, metric filter, and step range filter — added totest_sft_trainer_integration.py(serverless) andtest_sft_trainer_serverful_smtj.py(serverful)show_metrics()executes without error after training completes — added totest_sft_trainer_integration.pyshow_metrics()on completed MTRL job — added totest_mtrl_trainer_integration.pyreuse_resources=True
reuse_resources=Truereturns the same endpoint ARN — added totest_nova_model_customization_deployment.pyandtest_model_customization_deployment.pybuild(reuse_resources=True)doesn't create a duplicate Model resource — validated inline with the deploy testdeploy(reuse_resources=True)finds existing tagged custom model — added totest_nova_model_customization_deployment.pyCleanup:
import timestatementsTested in: a different account (us-east-1) via equivalent tests for OSS and Nova models.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.