Skip to content

fix(serve): pre-deploy JumpStart benchmark data + public HuggingFace download helper - #6175

Open
ZealSV wants to merge 1 commit into
aws:masterfrom
ZealSV:fix/pysdk-benchmark-configs-hf-helper
Open

fix(serve): pre-deploy JumpStart benchmark data + public HuggingFace download helper#6175
ZealSV wants to merge 1 commit into
aws:masterfrom
ZealSV:fix/pysdk-benchmark-configs-hf-helper

Conversation

@ZealSV

@ZealSV ZealSV commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Fixes two issues with ModelBuilder benchmark APIs for pre-deploy JumpStart models, plus adds a public HuggingFace-Hub download helper:

  • benchmark_metrics: display_benchmark_metrics() read self.benchmark_metrics, a property that existed in v2 but was dropped in the v3 port, so it raised AttributeError. Restore the property (a pandas DataFrame built from the model's published deployment-config benchmark data).

  • list_deployment_configs(): with no instance_type it called _get_deployment_configs() without first loading the JumpStart metadata configs, so a pre-deploy builder (_metadata_configs=None) got []. Added _ensure_metadata_configs() into _get_deployment_configs so every caller (listing and benchmark data) lazily loads them.

  • download_huggingface_model(): new public helper in serve.utils.hf_utils, exported from sagemaker.serve. Downloads a Hub snapshot and optionally uploads it to S3, so notebooks no longer hand-roll snapshot_download + S3Uploader. The previous downloader was a method on a private class and not importable.

Unit: 11 new tests (6 benchmark/config, 5 HF helper).

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.

Comment thread sagemaker-serve/src/sagemaker/serve/utils/hf_utils.py Outdated
Comment thread sagemaker-core/src/sagemaker/core/jumpstart/utils.py
Comment thread sagemaker-serve/src/sagemaker/serve/__init__.py
Comment thread sagemaker-serve/src/sagemaker/serve/model_builder.py Outdated
Comment thread sagemaker-serve/src/sagemaker/serve/model_builder_utils.py
Comment thread sagemaker-serve/tests/unit/utils/test_hf_utils.py Outdated
Comment thread sagemaker-serve/src/sagemaker/serve/utils/hf_utils.py Outdated
Comment thread sagemaker-serve/tests/unit/utils/test_hf_utils.py Outdated
…download helper

Fixes ModelBuilder benchmark APIs for pre-deploy JumpStart models and adds a
public HuggingFace-Hub download helper:

- benchmark_metrics: display_benchmark_metrics() read self.benchmark_metrics, a
  property that existed in v2 but was dropped in the v3 port, so it raised
  AttributeError. Restore the property (a pandas DataFrame built from the
  model's published deployment-config benchmark data).

- list_deployment_configs(): with no instance_type it called
  _get_deployment_configs() before the JumpStart metadata configs were loaded,
  so a pre-deploy builder (_metadata_configs=None) got []. _get_deployment_configs
  now calls _ensure_metadata_configs() itself, so every caller lazily loads them.

- ragged benchmark data: get_metrics_from_deployment_configs built columns
  independently, appending the instance-rate (pricing) column only for
  instances that had it. That produced unequal-length columns (crashing
  pd.DataFrame with "All arrays must be of the same length") AND misaligned the
  present rate values onto the wrong rows. Assemble one record per row and pivot
  to columns at the end, padding unset cells with None, so columns stay equal
  length and every value stays on its own row. Column layout is unchanged (the
  rate column still comes last).

- download_huggingface_model(): new public helper in serve.utils.hf_utils,
  exported from sagemaker.serve. Downloads a Hub snapshot and optionally uploads
  it to S3, so notebooks no longer hand-roll snapshot_download + S3Uploader.
  Supports revision / allow_patterns / ignore_patterns passthroughs; when
  staging to S3 without a caller-supplied local_dir it uses a temporary
  directory that is removed after the upload. migration.md documents both new
  surfaces.

Unit: 11 new tests (benchmark/config, ragged-metrics alignment/order, HF helper
incl. temp-dir cleanup and passthroughs).
@ZealSV
ZealSV force-pushed the fix/pysdk-benchmark-configs-hf-helper branch from 6032115 to 31956b7 Compare August 11, 2026 19:34
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.

2 participants