[azure-ai-ml] Fix models.get(name, label="latest") dropping deployment-template references (Bug 5423568)#47997
Draft
swarupecenits wants to merge 1 commit into
Conversation
…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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Notes
models.get(name, label="latest")returned aModelwhosedefault_deployment_template.asset_idandallowed_deployment_templateswereNone, even thoughmodels.get(name, version=<same version>)populated them correctly for the same underlying version.get()and label resolution use different REST endpoints with different shapes. The explicitversion=path calls the GET endpoint (_get→model_versions_operation.get), whose response carries the deployment-template references. Thelabel=path goes through_resolve_label_to_asset→_get_latest_version→_get_latest, which uses the version LIST endpoint (list(..., top=1)); its items omitdefault_deployment_template/allowed_deployment_templates, soModel._from_rest_objecthydrates them asNone. Same version, different shape - a silent data loss with no error._resolve_label_to_assetresolves 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 theversion=path. The change is scoped to thelabelbranch ofmodels.get(); theversion=path and_get_model_properties(which only reads.properties) are untouched.models.get()signature already acceptslabel=, so there is no API surface change (noapi.mdregeneration required).Testing
test_get_with_label_rehydrates_deployment_template_references- mocks the two real REST shapes (LISTtop=1without 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 thatdefault_deployment_template.asset_id/allowed_deployment_templates[*].asset_idare populated, matching theversion=path.getcalled 0 times); with the fix it passes.azure-huggingfaceregistry (modelzai-org--glm-5.2-fp8,latest→ v5): thelabel="latest"andversion="5"calls now return identicaldefault_deployment_templateandallowed_deployment_templatesvalues.modelunit tests pass (67 tests, incl. the existingdefault_deployment_template/allowed_deployment_templatessuites);blackclean.Description
Fixes internal bug #5423568.
models.get(name, label="latest")no longer returns aModelwith empty deployment-template references. Label resolution routes through the version list endpoint (top=1), whose items omitdefault_deployment_template/allowed_deployment_templates; the explicitversion=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 ofmodels.get(); no public API surface change.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines
Verification
All checks below were run against the live
azure-huggingfaceregistry (and the in-repo unit tests), on the branch with this fix.1. Repro - the crash is gone
2. Reporter's suggested acceptance test - passing
3. In-repo unit tests - passing