Skip to content

fix(serve): restore JumpStart default instance type from model spec#6045

Open
e-davidson wants to merge 2 commits into
aws:masterfrom
e-davidson:fix/jumpstart-default-instance-type-v2
Open

fix(serve): restore JumpStart default instance type from model spec#6045
e-davidson wants to merge 2 commits into
aws:masterfrom
e-davidson:fix/jumpstart-default-instance-type-v2

Conversation

@e-davidson

Copy link
Copy Markdown
Contributor

Issue

In the v2 SDK, ModelBuilder selected the model spec's default instance type when the user did not specify compute. In v3 this silently regressed: every no-compute JumpStart build falls back to ml.m5.large regardless of what the model spec recommends. This affects public hub deploys as well.

Root cause

__post_init__ calls _initialize_compute_config() before self.region is assigned. The spec-resolution chain inside it raises AttributeError, which a bare except Exception: pass swallows, so the builder silently takes the hardcoded ml.m5.large fallback instead of the spec default.

Fix

  • Extract _initialize_region() and call it first in __post_init__, so region is available before compute config initialization.
  • Replace the bare except Exception: pass with a warning log, so future failures in the spec-resolution chain are visible instead of silently changing behavior.

Tests

Mirrors master-v2's testing approach for this behavior: unit tests with mocking, no E2E.

  • Fixture: a real JumpStartModelSpecs built from master-v2 constants.py BASE_SPEC; JumpStartModelsAccessor.get_model_specs is patched to return it (the real spec-resolution chain runs, only the network fetch is mocked).
  • The fixture's default instance type is set to ml.g5.12xlarge with ml.m5.large excluded from supported types, so the tests discriminate the buggy fallback from the correct spec default.
  • 10 unit tests, red-green verified against current master: 8 fail on baseline (ml.m5.large != ml.g5.12xlarge), 10/10 pass with the fix. Existing private hub unit suite (17 tests) unaffected.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

In v2, ModelBuilder selected the model spec's default instance type
when the user did not specify compute. In v3 this silently regressed:
__post_init__ calls _initialize_compute_config() before self.region is
assigned, raising AttributeError inside the spec-resolution chain that
a bare 'except Exception: pass' swallows, so every no-compute build
falls back to ml.m5.large instead of the spec default. Affects public
hub deploys too.

Fix:
- Extract _initialize_region() and call it first in __post_init__ so
  region is available before compute config initialization.
- Replace the bare except with a warning log so future failures in the
  spec-resolution chain are visible instead of silent.

Tests (mirrors master-v2's approach, unit-only with mocking, no E2E):
- Fixture is a real JumpStartModelSpecs built from master-v2
  constants.py BASE_SPEC; JumpStartModelsAccessor.get_model_specs is
  patched to return it. The spec default is set to ml.g5.12xlarge and
  ml.m5.large excluded from supported types so the tests discriminate
  the buggy fallback from the correct spec default.
- 10 unit tests, red-green verified on current master: 8 fail on
  baseline (ml.m5.large != ml.g5.12xlarge), 10/10 pass with the fix.
  Private hub unit suite (17 tests) unaffected.
Add TestUserOverrideFlowsDownstream (4 tests) closing the coverage gap
between the override-wins assertions and the downstream-forwarding
assertions, which previously only used the spec default:

- deploy() hands the user's instance type (not the spec default) to
  _deploy
- _deploy_core_endpoint places the user's instance type into the
  ProductionVariant for CreateEndpointConfig
- _build_for_jumpstart forwards the user's instance type to
  get_init_kwargs, which drives instance-type-specific image URI and
  env var selection
- instance_type via the Compute object behaves identically to a direct
  instance_type: honored verbatim, spec lookup skipped

These are behavior pins, not regression discriminators: they pass on
both baseline and fix (override was never broken; the bug only affected
the no-compute default path). Suite is now 14 tests: baseline 8 failed
6 passed, with fix 14/14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant