Skip to content

fix: don't treat SageMaker model-package ARN as a HuggingFace model ID - #6513

Merged
mufaddal-rohawala merged 1 commit into
aws:masterfrom
mufaddal-rohawala:fix/modelbuilder-arn-hf-smart-detection
Oct 21, 2026
Merged

mufaddal-rohawala merged 1 commit into
aws:masterfrom
mufaddal-rohawala:fix/modelbuilder-arn-hf-smart-detection

Conversation

@mufaddal-rohawala

Copy link
Copy Markdown
Member

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/, 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.

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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.

@mufaddal-rohawala
mufaddal-rohawala merged commit ab7524e into aws:master Oct 21, 2026
26 of 27 checks passed

This branch was previously deployed

1 inactive deployment
auto-approve — 558e6beb Deployed Oct 21, 2026 by mufaddal-rohawala via wait-for-approval #1800
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.

4 participants