界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

sagemaker-python-sdk

sagemaker-python-sdk

【效率与协作】Route SageMaker Python SDK v3 tasks to self-contained guidance for core resources, training, model customization, serving, MLOps, migration, and troubleshooting.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: sagemaker-python-sdk description: "Route SageMaker Python SDK v3 tasks to self-contained guidance for core resources, training, model customization, serving, MLOps, migration, and troubleshooting." metadata: disco-role: operating disable-model-invocation: true license: Apache 2.0

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 intentLoad this
Install/import smoke, v3-vs-v2 decision, or broad SDK selectionStay 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 lineagesub-skills/core-resources/SKILL.md
Train a model with ModelTrainer, local/distributed training, JumpStart training, HPO, AWS Batch training queues, or remote functionsub-skills/training/SKILL.md
Fine-tune/customize foundation models with SFT/DPO/RLVR/RLAIF/CPT/MultiTurnRL, run evaluations, recipes, data mixing, or notificationssub-skills/model-customization/SKILL.md
Deploy or serve with ModelBuilder, InferenceSpec, local/in-process/container mode, serverless/async/batch inference, JumpStart, optimization, Bedrock, or recommendationssub-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 executionsub-skills/mlops/SKILL.md
Convert old SDK code to v3references/migration-v2-to-v3.md, then route to the owning sub-skill
Debug install/import/region/role/credentials/optional depsreferences/troubleshooting.md

Intent-to-interface defaults

  • Train / fine-tune / managed training: sagemaker.train.ModelTrainer or the specialized customization trainers in the model-customization sub-skill.
  • Distributed training: ModelTrainer with Compute(instance_count=...) and a Torchrun, MPI, SMP, or custom DistributedConfig.
  • Hyperparameter tuning: sagemaker.train.tuner.HyperparameterTuner or sagemaker.core.resources.HyperParameterTuningJob for low-level control.
  • Deploy / host / endpoint inference: sagemaker.serve.ModelBuilder.
  • Endpoint invocation after deployment: Endpoint.invoke(...).
  • Processing / batch transform / resource CRUD: sagemaker.core.resources and helper classes such as ScriptProcessor or Transformer.
  • Pipelines / registry / monitoring / Feature Store: sagemaker.mlops.workflow and sagemaker.mlops.feature_store.
  • Container image URI: sagemaker.core.image_uris.retrieve(...).

Before writing code

  1. 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.
  2. Identify execution substrate: local-only object construction, Docker local mode, SageMaker cloud job/endpoint, HyperPod, AWS Batch, Bedrock, Feature Store, EMR, or a Pipeline.
  3. 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.
  4. Open exactly the sub-skill and references needed for the intent. Do not duplicate full workflows across sub-skills.
  5. Self-check generated code for banned v2 patterns and missing resource placeholders before returning.

Shared references and helpers

High-risk boundaries

  • sagemaker.serve and sagemaker.mlops may need AWS_REGION or AWS_DEFAULT_REGION set even for import in a fresh environment.
  • ModelTrainer and ModelBuilder can 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.

我的收藏