Repository navigation
fix: don't treat SageMaker model-package ARN as a HuggingFace model ID - #6513
Conversation
There was a problem hiding this comment.
🤖 AI code review
This PR fixes ModelBuilder's smart-detection path so a SageMaker model-package ARN is no longer treated as a HuggingFace repo id. It guards _get_default_instance_type and _is_huggingface_model with the existing MODEL_PACKAGE_ARN_REGEX, and distinguishes HTTP 404 from 401 in get_huggingface_model_metadata to produce a clearer error. The changes are correct, reuse the existing regex helper (already imported), and are covered by targeted regression tests. No issues found.
Reviewed commit 9c17b48. Automated review; verify before acting.
ModelBuilder's smart-detection path for choosing a default instance type treated any non-JumpStart string `model` value as a HuggingFace repo id. A SageMaker model-package ARN (a supported `model=` input) was pasted verbatim into https://huggingface.co/api/models/<ARN>, which 404s. The 404 handler only recognized HTTP 401, so it fell through and the failure surfaced as a misleading "provide a HUGGING_FACE_HUB_TOKEN" message. Changes: - Guard the smart-detection branch in `_get_default_instance_type` so a model-package ARN skips HuggingFace metadata lookup and falls back to the CPU default instead of hitting huggingface.co. - Exclude model-package ARNs in `_is_huggingface_model` (an ARN contains "/", which the org/model-name heuristic wrongly matched). - Distinguish HTTP 404 from 401 in `get_huggingface_model_metadata` so a missing repo reports "not found on huggingface.co" instead of suggesting a HUGGING_FACE_HUB_TOKEN. Reuses the existing MODEL_PACKAGE_ARN_REGEX helper. Adds regression tests.
9c17b48 to
558e6be
Compare
There was a problem hiding this comment.
🤖 AI code review
This PR fixes ModelBuilder's smart-detection so a SageMaker model-package ARN is no longer treated as a HuggingFace repo id. It guards the smart-detection branch in _get_default_instance_type, excludes ARNs in _is_huggingface_model, and distinguishes HTTP 404 from 401 in get_huggingface_model_metadata for a clearer error. The re import and MODEL_PACKAGE_ARN_REGEX are already present and reused appropriately, and the changes come with targeted regression tests. The change is correct and well-scoped; no issues found.
Reviewed commit 558e6be. Automated review; verify before acting.
ModelBuilder's smart-detection path for choosing a default instance type treated any non-JumpStart string
modelvalue as a HuggingFace repo id. A SageMaker model-package ARN (a supportedmodel=input) was pasted verbatim into https://huggingface.co/api/models/, which 404s. The 404 handler only recognized HTTP 401, so it fell through and the failure surfaced as a misleading "provide a HUGGING_FACE_HUB_TOKEN" message.Changes:
_get_default_instance_typeso a model-package ARN skips HuggingFace metadata lookup and falls back to the CPU default instead of hitting huggingface.co._is_huggingface_model(an ARN contains "/", which the org/model-name heuristic wrongly matched).get_huggingface_model_metadataso a missing repo reports "not found on huggingface.co" instead of suggesting a HUGGING_FACE_HUB_TOKEN.Reuses the existing MODEL_PACKAGE_ARN_REGEX helper. Adds regression tests.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.