serving
Use SageMaker Python SDK v3 serving workflows for ModelBuilder, local inference, JumpStart, optimization, Bedrock, and inference recommender.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- serving
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use SageMaker Python SDK v3 serving workflows for ModelBuilder, local inference, JumpStart, optimization, Bedrock, and inference recommender.
- disable-model-invocation
- true
02 资源文件 4
03 SKILL.md 正文
SageMaker Python SDK v3 Serving Sub-skill
Use this sub-skill for model deployment and inference with sagemaker-serve.
It covers ModelBuilder, InferenceSpec, SchemaBuilder, ModelServer,
build(), deploy(), deploy_local(), local container mode, in-process mode,
JumpStart deployment, train-to-inference, optimization, recommendation-driven
deployments, Bedrock deployment, and inference pipelines.
Trigger phrases
Read this sub-skill when the user says or implies:
- deploy a model, serve a model, or create an endpoint
ModelBuilder,ModelServer,InferenceSpec, orSchemaBuilderdeploy_local(), local container mode, or in-process mode- real-time, serverless, async, or batch transform deployment
- train-to-inference or deploy from
ModelTrainer/TrainingJob - JumpStart deployment or
ModelBuilder.from_jumpstart_config(...) - optimization, quantization, compilation, sharding, or speculative decoding
BedrockModelBuilderor deployment to Amazon Bedrock- inference recommender, right sizing, or deployment recommendations
- inference pipelines, multi-container serving, or chained models
Read this when
- You need the v3 deployment flow built around
ModelBuilder. - You need a custom
InferenceSpecorSchemaBuilderfor request/response marshalling. - You need local testing without cloud calls, either in Docker or in-process.
- You need JumpStart, train-to-inference, optimization, or Bedrock serving.
- You need recommendation-driven deployment selection before creating an endpoint.
Do not read this when
- You need
ModelTrainersetup, training jobs, distributed training, or HPO; use../training/SKILL.md. - You need low-level
Endpoint,EndpointConfig,TransformJob, or direct resource chaining; use../core-resources/SKILL.md. - You need foundation-model customization or evaluation first; use
../model-customization/SKILL.md. - You need SageMaker Pipelines or workflow orchestration; use
../mlops/SKILL.md.
Short workflow
- Identify the source of the serving artifact: raw model object, trained job,
ModelTrainer, JumpStart config, customInferenceSpec, or fine-tuned model package. - Pick the transport contract early: define
SchemaBuilder(sample_input, sample_output)or a customInferenceSpec.load()/invoke()pair. If the runtime should serialize itself, choose the rightcontent_typeandaccept_typeup front. - Build with
ModelBuilder(...)orModelBuilder.from_jumpstart_config(...). If the source is aModelTrainerorTrainingJob, make sure training has completed before build. - Choose the deployment mode:
Mode.SAGEMAKER_ENDPOINTfor cloud servingMode.LOCAL_CONTAINERfor Docker-based local servingMode.IN_PROCESSfor pure Python local serving
- Use
build()beforedeploy()for normal serving flows. Usedeploy_local()only forLOCAL_CONTAINERorIN_PROCESS. - Route the deployment type:
- no
inference_configorServerlessInferenceConfig/AsyncInferenceConfig-> real-timeEndpoint BatchTransformInferenceConfig->TransformerResourceRequirements-> inference-component-based endpoint path
- no
- Invoke with
endpoint.invoke(body=..., content_type=..., accept=...)orlocal_endpoint.invoke(...). Keep transport examples self-contained and use placeholders for all real AWS identifiers. - For optimization, recommendations, or Bedrock, read the dedicated reference
before calling
optimize(),generate_deployment_recommendations(), orBedrockModelBuilder.deploy(). - If the request becomes a low-level endpoint or batch job task, hand it off to the sibling sub-skill instead of expanding this one.
Verified API surface
Use these signatures as the source of truth for runtime-safe guidance:
ModelBuilder(...)ModelBuilder.build(...)ModelBuilder.deploy(...)ModelBuilder.deploy_local(...)ModelBuilder.optimize(...)ModelBuilder.from_jumpstart_config(...)InferenceSpec.load(...)/InferenceSpec.invoke(...)SchemaBuilder(...)BedrockModelBuilder.deploy(...)
See the bundled references for the full verified signatures and examples.
Common guardrails
- Use v3 imports only. Do not introduce v2
Model,Predictor,Processor, orEstimatorpatterns except in a clearly labeled deprecated migration note. - Do not hardcode real account IDs, role ARNs, regions, bucket names, subnet IDs, security group IDs, or credentials.
- Remember that
ModelBuildermay resolve a role during construction if norole_arnis provided; without credentials, that can fail beforebuild()ordeploy()runs. - Prefer
endpoint.invoke()over deprecatedpredictor.predict()patterns. - If a user asks for
EndpointorTransformJobcreation directly, route to../core-resources/SKILL.md.
Reference map
references/modelbuilder-workflows.mdreferences/deployment-modes-and-inference-spec.mdreferences/optimization-bedrock-and-recommendations.mdreferences/troubleshooting.md
Handoff notes
- Keep detailed APIs, matrices, and failure recovery in the references.
- Keep this file router-like: classify the request, point to the right flow, and stop.
- When a deployment question crosses into training, model customization, or low-level resources, hand off to the sibling sub-skill instead of duplicating that logic here.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).