Model builder unable to
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- aws, python
调研方向
从通过 ModelBuilder.build() 进行 Python 复现开始,检查 ModelPackage 返回的 BaseModel 值为 Unassigned 时是如何处理的。将该流程与使用 HubContent.get 和 SageMakerPublicHub 的文档化 workaround 进行比较;当 build 能够在 HubContentVersion 和 RecipeName 缺失时不发生崩溃,并且该行为由适当的回归测试覆盖时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
PySDK Version
- PySDK V2 (2.x)
- PySDK V3 (3.x)
Describe the bug
ModelBuilder fails when building/deploying a model package whose BaseModel has HubContentName set but is missing HubContentVersion and/or RecipeName. These fields are returned as Unassigned from the DescribeModelPackage API response, and ModelBuilder does not handle this — it assumes all three
fields are populated and crashes during the build step.
This is a real problem for model packages created by automated pipelines (e.g., fine-tuning jobs that call CreateModelPackage) where the producer only sets HubContentName but not the version or recipe. The user has no way to patch these fields through the ModelBuilder API — the only workaround
is to manually resolve them before calling build().
To reproduce
python
from sagemaker.serve import ModelBuilder
from sagemaker.core.resources import ModelPackage
A model package where BaseModel has HubContentName but missing HubContentVersion and RecipeName
mp_arn = "arn:aws:sagemaker:us-east-1:123456789012:model-package/my-fine-tuned-models/1"
mp = ModelPackage.get(model_package_name=mp_arn, region="us-east-1")
Inspect — HubContentVersion and RecipeName are Unassigned
base_model = mp.inference_specification.containers[0].base_model
print(base_model.hub_content_name) # e.g. "huggingface-reasoning-qwen3-32b" ✅
print(base_model.hub_content_version) # Unassigned ❌
print(base_model.recipe_name) # Unassigned ❌
role = "arn:aws:iam::123456789012:role/SageMakerRole"
model_builder = ModelBuilder(model=mp, role_arn=role)
model_builder.build(model_name="my-deployment")
^^^ Fails — ModelBuilder cannot resolve the model without version and recipe
Workaround (manually patch before build):
python
from sagemaker.core.resources import HubContent
from sagemaker.core.utils.utils import Unassigned
base_model = mp.inference_specification.containers[0].base_model
if isinstance(base_model.hub_content_version, Unassigned):
hc = HubContent.get(
hub_content_type="Model",
hub_name="SageMakerPublicHub",
hub_content_name=base_model.hub_content_name,
)
base_model.hub_content_version = hc.hub_content_version
if isinstance(base_model.recipe_name, Unassigned) or not base_model.recipe_name:
base_model.recipe_name = "verl-grpo-rlaif-qwen-3-32b-lora"
Now build() works
model_builder = ModelBuilder(model=mp, role_arn=role)
model_builder.build(model_name="my-deployment")
model_builder.deploy(endpoint_name="my-deployment", instance_type="ml.g5.48xlarge")
Expected behavior
ModelBuilder should gracefully handle model packages where HubContentVersion and/or RecipeName are Unassigned. Specifically:
- If HubContentName is present but HubContentVersion is missing, ModelBuilder should resolve it automatically by calling DescribeHubContent on SageMakerPublicHub (as the workaround does).
- If RecipeName is missing, ModelBuilder should either infer a default recipe from the hub content metadata or allow the user to pass it as a parameter.
Screenshots or logs
N/A — error occurs during model_builder.build() when it attempts to use the Unassigned values.
System information
- SageMaker Python SDK version: 3.6.0
- Framework name (eg. PyTorch) or algorithm (eg. KMeans): DJL LMI (Large Model Inference)
- Framework version: DJL 0.36.0, LMI 20.0.0
- Python version: 3.12
- CPU or GPU: GPU (ml.g5.48xlarge — 8x NVIDIA A10G)
- Custom Docker image (Y/N): N
Additional context
- The root cause is split: the model package producer (e.g., fine-tuning pipeline) should ideally populate all three BaseModel fields (HubContentName, HubContentVersion, RecipeName). But ModelBuilder should also be resilient to partially-populated model packages, since it has enough information (HubContentName) to resolve the missing fields itself.
- The workaround is functional but requires the user to know internal SDK types (Unassigned, HubContent.get) which are not documented.
- 主要语言
- Python
- 星标
- 2.3k
- 派生
- 1.3k
- 平均合并
- 3 天 10 小时
- 30 天内合并 PR
- 88
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/sagemaker-python-sdk 的其他 Issue
-
Cannot use spark_event_logs_s3_uri in PySparkProcessor job可能已有人在做 @rsareddy0329 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
aws/sagemaker-python-sdk#6253 ·
维护者通常 2 天内回复
-
[Bug] V3 Hyperparameter Tuning Pipeline page labelled "Download Data" in navigation due to missing title cell可能已有人在做 @admivsn 于 37 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 93/100
aws/sagemaker-python-sdk#6232 ·
维护者通常 2 天内回复
-
[Bug] ModelTrainer with no input channels emits InputDataConfig: [], which CreatePipeline rejects (min=1) — v2 omitted the key可能已有人在做 @sagemaker-bot 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
aws/sagemaker-python-sdk#6156 · 2 条评论 ·
维护者通常 2 天内回复
-
sagemaker-train should depend on mlflow-skinny, following sagemaker-mlflow 0.5.0可能已有人在做 @mohamedzeidan2021 于 10 天前认领。 未关闭
难度 2/5 半天 新手友好度 72/100
aws/sagemaker-python-sdk#6152 ·
维护者通常 2 天内回复
-
ModelTrainer generates sm_train.sh with CRLF line endings on Windows causing training job failure可能已有人在做 @MohammedAlkindi 于 28 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
aws/sagemaker-python-sdk#5904 · 1 个 reaction ·
维护者通常 2 天内回复
查看 aws/sagemaker-python-sdk 的全部 Issue
相似的 Issue
-
documentation
难度 1/5 1 小时以内 新手友好度 65/100
ansys/pydpf-core#3547 ·
维护者通常 1 天内回复
-
core
难度 2/5 1-3 小时 新手友好度 70/100
vectorize-io/hindsight#5457 ·
维护者通常 1 天内回复
-
[Bug]: LangChain drops OpenAI Responses text blocks from session recording可能已有人在做 @ktz03 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
volcengine/OpenViking#5806 ·
维护者通常 1 天内回复
-
HTML: <template> content is extracted as document text可能已有人在做 @ryanmeowy 今天认领。 未关闭bug html
难度 1/5 1 小时以内 新手友好度 82/100
docling-project/docling#4714 · 2 条评论 ·
维护者通常 1 天内回复
-
APIv2 event data accepts a non-string reply and a NaN upper_bound可能已有人在做 @awss1i 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
freedomofpress/securedrop#7946 · 1 条评论 ·
维护者通常 2 天内回复