Skip to content

[azure-ai-ml] Fix models.get(name, label="latest") dropping deployment-template references (Bug 5423568)#47997

Draft
swarupecenits wants to merge 1 commit into
Azure:mainfrom
swarupecenits:fix/model-get-label-deployment-template-hydration
Draft

[azure-ai-ml] Fix models.get(name, label="latest") dropping deployment-template references (Bug 5423568)#47997
swarupecenits wants to merge 1 commit into
Azure:mainfrom
swarupecenits:fix/model-get-label-deployment-template-hydration

Conversation

@swarupecenits

@swarupecenits swarupecenits commented Jul 10, 2026

Copy link
Copy Markdown
Member

Notes

  • Fixes internal bug #5423568: models.get(name, label="latest") returned a Model whose default_deployment_template.asset_id and allowed_deployment_templates were None, even though models.get(name, version=<same version>) populated them correctly for the same underlying version.
  • Root cause: get() and label resolution use different REST endpoints with different shapes. The explicit version= path calls the GET endpoint (_getmodel_versions_operation.get), whose response carries the deployment-template references. The label= path goes through _resolve_label_to_asset_get_latest_version_get_latest, which uses the version LIST endpoint (list(..., top=1)); its items omit default_deployment_template / allowed_deployment_templates, so Model._from_rest_object hydrates them as None. Same version, different shape - a silent data loss with no error.
  • Fix: after _resolve_label_to_asset resolves the label to a concrete version, re-fetch that version through the GET endpoint (Model._from_rest_object(self._get(name, resolved_version))) so the label path hydrates the deployment-template references identically to the version= path. The change is scoped to the label branch of models.get(); the version= path and _get_model_properties (which only reads .properties) are untouched.
  • This is an internal fix only - the public models.get() signature already accepts label=, so there is no API surface change (no api.md regeneration required).

Testing

  • Added test_get_with_label_rehydrates_deployment_template_references - mocks the two real REST shapes (LIST top=1 without DT refs used by label resolution, GET with DT refs used by the re-fetch) and asserts the resolved version is re-fetched via GET and that default_deployment_template.asset_id / allowed_deployment_templates[*].asset_id are populated, matching the version= path.
  • Verified the test genuinely catches the bug: with the fix reverted it fails (get called 0 times); with the fix it passes.
  • Verified live against the azure-huggingface registry (model zai-org--glm-5.2-fp8, latest → v5): the label="latest" and version="5" calls now return identical default_deployment_template and allowed_deployment_templates values.
  • Full model unit tests pass (67 tests, incl. the existing default_deployment_template / allowed_deployment_templates suites); black clean.

Description

Fixes internal bug #5423568. models.get(name, label="latest") no longer returns a Model with empty deployment-template references. Label resolution routes through the version list endpoint (top=1), whose items omit default_deployment_template / allowed_deployment_templates; the explicit version= path uses the get endpoint, which includes them. After resolving the label to a concrete version, the resolved version is now re-fetched through the get endpoint, so the label path hydrates these references identically to the version path. The fix is scoped to the label branch of models.get(); no public API surface change.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Verification

All checks below were run against the live azure-huggingface registry (and the in-repo unit tests), on the branch with this fix.

1. Repro - the crash is gone

Screenshot 2026-07-10 192855

2. Reporter's suggested acceptance test - passing

Screenshot 2026-07-10 171146

3. In-repo unit tests - passing

…erences

models.get(name, label="latest") returned a Model whose default_deployment_template and allowed_deployment_templates references had asset_id=None, while models.get(name, version=<same>) populated them. Label resolution goes through the version list endpoint (top=1), whose items omit the deployment-template references; the explicit version path uses the get endpoint, which includes them. After resolving the label to a concrete version, the resolved version is now re-fetched through the get endpoint so the label path hydrates these references identically to the version path.

Bug 5423568
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant