sagemaker-python-sdk
Route SageMaker Python SDK v3 tasks to self-contained guidance for core resources, training, model customization, serving, MLOps, migration, and troubleshooting.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sagemaker-python-sdk
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Route SageMaker Python SDK v3 tasks to self-contained guidance for core resources, training, model customization, serving, MLOps, migration, and troubleshooting.
- disable-model-invocation
- true
02 资源文件 7
- 参考文档references/api-signature-summary.md5.0 KB
- 参考文档references/migration-v2-to-v3.md5.4 KB
- 参考文档references/repo-provenance.md2.7 KB
- 参考文档references/repo-routing-metadata.json505 B
- 参考文档references/troubleshooting.md3.9 KB
- 参考文档references/v3-interface-selection.md4.9 KB
- 脚本scripts/check_sagemaker_v3_imports.py5.3 KB
03 SKILL.md 正文
SageMaker Python SDK v3 Repo Skill
Use this skill when the task involves the Amazon SageMaker Python SDK v3:
training, fine-tuning, deployment, inference, pipelines, Feature Store, model
registry, low-level SageMaker resources, image URI retrieval, or V2-to-V3
migration. The SDK is v3-first and modular: sagemaker-core,
sagemaker-train, sagemaker-serve, and sagemaker-mlops.
Mandatory v3 policy
- Default to SageMaker Python SDK v3 (
pip install sagemaker). - Use the SDK before raw
boto3, AWS CLI, or hand-written service requests unless the user explicitly asks for those lower-level interfaces. - Do not generate v2 imports such as estimator, model, predictor, processing, workflow, or framework-estimator modules except inside clearly labeled deprecated migration notes.
- Do not hardcode real account IDs, role ARNs, regions, buckets, subnets,
security groups, or credentials. Use
Session(),get_execution_role(),Session().default_bucket(), and placeholders. - If the user asks to run cloud jobs, stop to confirm region, AWS credentials, execution role, S3 staging/output paths, service quotas, and billable-resource cleanup before submission.
Quick route map
| User intent | Load this |
|---|---|
| Install/import smoke, v3-vs-v2 decision, or broad SDK selection | Stay in this root and read references/v3-interface-selection.md |
Retrieve framework image/model/script URIs, use Session, low-level jobs/resources, processing, transform, endpoints, or lineage |
sub-skills/core-resources/SKILL.md |
Train a model with ModelTrainer, local/distributed training, JumpStart training, HPO, AWS Batch training queues, or remote function |
sub-skills/training/SKILL.md |
| Fine-tune/customize foundation models with SFT/DPO/RLVR/RLAIF/CPT/MultiTurnRL, run evaluations, recipes, data mixing, or notifications | sub-skills/model-customization/SKILL.md |
Deploy or serve with ModelBuilder, InferenceSpec, local/in-process/container mode, serverless/async/batch inference, JumpStart, optimization, Bedrock, or recommendations |
sub-skills/serving/SKILL.md |
| Build SageMaker Pipelines, workflow steps, model registry flows, Feature Store orchestration, quality/Clarify checks, lineage/governance, triggers, retries, or local pipeline execution | sub-skills/mlops/SKILL.md |
| Convert old SDK code to v3 | references/migration-v2-to-v3.md, then route to the owning sub-skill |
| Debug install/import/region/role/credentials/optional deps | references/troubleshooting.md |
Intent-to-interface defaults
- Train / fine-tune / managed training:
sagemaker.train.ModelTraineror the specialized customization trainers in the model-customization sub-skill. - Distributed training:
ModelTrainerwithCompute(instance_count=...)and aTorchrun,MPI,SMP, or customDistributedConfig. - Hyperparameter tuning:
sagemaker.train.tuner.HyperparameterTunerorsagemaker.core.resources.HyperParameterTuningJobfor low-level control. - Deploy / host / endpoint inference:
sagemaker.serve.ModelBuilder. - Endpoint invocation after deployment:
Endpoint.invoke(...). - Processing / batch transform / resource CRUD:
sagemaker.core.resourcesand helper classes such asScriptProcessororTransformer. - Pipelines / registry / monitoring / Feature Store:
sagemaker.mlops.workflowandsagemaker.mlops.feature_store. - Container image URI:
sagemaker.core.image_uris.retrieve(...).
Before writing code
- Determine whether the user wants usage guidance, migration, or repository maintenance. For repository edits, still obey this repo's v3 default and run focused tests under the relevant package.
- Identify execution substrate: local-only object construction, Docker local mode, SageMaker cloud job/endpoint, HyperPod, AWS Batch, Bedrock, Feature Store, EMR, or a Pipeline.
- Confirm whether the task can be answered without cloud execution. Many
examples can be drafted with placeholders and
dry_run=True; do not submit billable jobs unless explicitly authorized. - Open exactly the sub-skill and references needed for the intent. Do not duplicate full workflows across sub-skills.
- Self-check generated code for banned v2 patterns and missing resource placeholders before returning.
Shared references and helpers
references/v3-interface-selection.md: package selection, install choices, and v3-first intent routing.references/migration-v2-to-v3.md: deprecated v2 pattern mappings and migration workflow.references/api-signature-summary.md: verified public signatures and import caveats for this checkout.references/troubleshooting.md: install/import/region/role/credentials, optional dependency, Docker, and cloud service failure recovery.scripts/check_sagemaker_v3_imports.py: safe import/version/CUDA probe for an installed SDK environment; it does not make cloud service calls.references/repo-provenance.md: source commit, versions, evidence paths, and refresh baseline.
High-risk boundaries
sagemaker.serveandsagemaker.mlopsmay needAWS_REGIONorAWS_DEFAULT_REGIONset even for import in a fresh environment.ModelTrainerandModelBuildercan try role discovery through STS when no explicit role is supplied; outside SageMaker-managed environments this can fail before any job is submitted.- Docker/local-container examples require Docker, images, local paths, and cleanup; in-process serving is the safer local path when it fits.
- Feature Store, Bedrock, SNS/EventBridge notifications, EMR, HyperPod, Batch, and SageMaker cloud jobs need AWS identity, IAM permissions, and service quotas; treat native runs as opt-in.
- Root and sub-skill runtime instructions must remain self-contained; do not tell future agents to reopen this source repository for examples.
Handoff after using this skill
Return the sub-skill(s) consulted, the v3 interfaces selected, any assumptions
about region/role/S3/compute, the validation path used (dry_run, local smoke,
or no-submit review), and any cloud/Docker/native checks intentionally skipped.
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).