[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-aws--sagemaker-python-sdk":3,"tool-aws--sagemaker-python-sdk":61},[4,18,26,36,44,52],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",141543,2,"2026-04-06T11:32:54",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107888,"2026-04-06T11:32:50",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":10,"last_commit_at":50,"category_tags":51,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":53,"name":54,"github_repo":55,"description_zh":56,"stars":57,"difficulty_score":10,"last_commit_at":58,"category_tags":59,"status":17},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[14,15,13,60],"视频",{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":77,"owner_twitter":76,"owner_website":78,"owner_url":79,"languages":80,"stars":99,"forks":100,"last_commit_at":101,"license":102,"difficulty_score":32,"env_os":103,"env_gpu":104,"env_ram":104,"env_deps":105,"category_tags":113,"github_topics":114,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":122,"updated_at":123,"faqs":124,"releases":153},4403,"aws\u002Fsagemaker-python-sdk","sagemaker-python-sdk","A library for training and deploying machine learning models on Amazon SageMaker","sagemaker-python-sdk 是一款专为亚马逊云科技（AWS）SageMaker 平台设计的开源 Python 库，旨在帮助开发者轻松完成机器学习模型的训练与部署。它有效解决了在云端构建 AI 工作流时面临的配置复杂、框架适配难以及代码冗余等问题，让用户无需深入底层基础设施细节即可高效开展工作。\n\n这款工具非常适合机器学习工程师、数据科学家以及希望将算法快速落地的研发人员使用。无论是利用主流的深度学习框架（如 PyTorch、Apache MXNet），还是调用 AWS 内置的高效算法，甚至是部署自定义的 Docker 容器算法，sagemaker-python-sdk 都能提供流畅的支持。\n\n其最新发布的 V3 版本带来了显著的技术升级：采用模块化架构，将核心功能拆分为独立的安装包，提升了灵活性与维护性；同时推出统一的 ModelTrainer 和 ModelBuilder 类，取代了以往繁琐的框架专用类，大幅简化了代码结构。通过面向对象的全新 API 设计，它不仅减少了样板代码，还提供了更直观的操作体验，让模型从训练到推理的全流程管理变得更加简洁有序。",".. image:: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fraw\u002Fmaster\u002Fbranding\u002Ficon\u002Fsagemaker-banner.png\n    :height: 100px\n    :alt: SageMaker\n\n====================\nSageMaker Python SDK\n====================\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fsagemaker.svg\n   :target: https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Fsagemaker\n   :alt: Latest Version\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fsagemaker.svg\n   :target: https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Fsagemaker\n   :alt: Supported Python Versions\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcode_style-black-000000.svg\n   :target: https:\u002F\u002Fgithub.com\u002Fpython\u002Fblack\n   :alt: Code style: black\n\n.. image:: https:\u002F\u002Freadthedocs.org\u002Fprojects\u002Fsagemaker\u002Fbadge\u002F?version=stable\n   :target: https:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002F\n   :alt: Documentation Status\n\n.. image:: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Factions\u002Fworkflows\u002Fcodebuild-ci-health.yml\u002Fbadge.svg\n    :target: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Factions\u002Fworkflows\u002Fcodebuild-ci-health.yml\n    :alt: CI Health\n\nSageMaker Python SDK is an open source library for training and deploying machine learning models on Amazon SageMaker.\n\nWith the SDK, you can train and deploy models using popular deep learning frameworks **Apache MXNet** and **PyTorch**.\nYou can also train and deploy models with **Amazon algorithms**,\nwhich are scalable implementations of core machine learning algorithms that are optimized for SageMaker and GPU training.\nIf you have **your own algorithms** built into SageMaker compatible Docker containers, you can train and host models using these as well.\n\nTo install SageMaker Python SDK, see `Installing SageMaker Python SDK \u003C#installing-the-sagemaker-python-sdk>`_.\n\n❗🔥 SageMaker V3 Release\n-------------------------\n\nVersion 3.0.0 represents a significant milestone in our product's evolution. This major release introduces a modernized architecture, enhanced performance, and powerful new features while maintaining our commitment to user experience and reliability.\n\n**Important: Please review these breaking changes before upgrading.**\n\n* Older interfaces such as Estimator, Model, Predictor and all their subclasses will not be supported in V3. \n* Please see our `V3 examples folder \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Ftree\u002Fmaster\u002Fv3-examples>`__ for example notebooks and usage patterns.\n\n\nMigrating to V3\n----------------\n\n**Upgrading to 3.x**\n\nTo upgrade to the latest version of SageMaker Python SDK 3.x:\n\n::\n\n    pip install --upgrade sagemaker\n\nIf you prefer to downgrade to the 2.x version:\n\n::\n\n    pip install sagemaker==2.*\n\nSee `SageMaker V2 Examples \u003C#sagemaker-v2-examples>`__ for V2 documentation and examples.\n\n**Key Benefits of 3.x**\n\n* **Modular Architecture**: Separate PyPI packages for core, training, and serving capabilities\n\n  * `sagemaker-core \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-core\u002F>`__\n  * `sagemaker-train \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-train\u002F>`__\n  * `sagemaker-serve \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-serve\u002F>`__\n  * `sagemaker-mlops \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-mlops\u002F>`__\n\n* **Unified Training & Inference**: Single classes (ModelTrainer, ModelBuilder) replace multiple framework-specific classes\n* **Object-Oriented API**: Structured interface with auto-generated configs aligned with AWS APIs\n* **Simplified Workflows**: Reduced boilerplate and more intuitive interfaces\n\n**Training Experience**\n\nV3 introduces the unified ModelTrainer class to reduce complexity of initial setup and deployment for model training. This replaces the V2 Estimator class and framework-specific classes (PyTorchEstimator, SKLearnEstimator, etc.).\n\nThis example shows how to train a model using a custom training container with training data from S3.\n\n*SageMaker Python SDK 2.x:*\n\n.. code:: python\n\n    from sagemaker.estimator import Estimator\n    estimator = Estimator(\n        image_uri=\"my-training-image\",\n        role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\",\n        instance_count=1,\n        instance_type=\"ml.m5.xlarge\",\n        output_path=\"s3:\u002F\u002Fmy-bucket\u002Foutput\"\n    )\n    estimator.fit({\"training\": \"s3:\u002F\u002Fmy-bucket\u002Ftrain\"})\n\n*SageMaker Python SDK 3.x:*\n\n.. code:: python\n\n    from sagemaker.train import ModelTrainer\n    from sagemaker.train.configs import InputData\n\n    trainer = ModelTrainer(\n        training_image=\"my-training-image\",\n        role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\"\n    )\n\n    train_data = InputData(\n        channel_name=\"training\",\n        data_source=\"s3:\u002F\u002Fmy-bucket\u002Ftrain\"\n    )\n\n    trainer.train(input_data_config=[train_data])\n\n**See more examples:** `SageMaker V3 Examples \u003C#sagemaker-v3-examples>`__\n\n**Inference Experience**\n\nV3 introduces the unified ModelBuilder class for model deployment and inference. This replaces the V2 Model class and framework-specific classes (PyTorchModel, TensorFlowModel, SKLearnModel, XGBoostModel, etc.).\n\nThis example shows how to deploy a trained model for real-time inference.\n\n*SageMaker Python SDK 2.x:*\n\n.. code:: python\n\n    from sagemaker.model import Model\n    from sagemaker.predictor import Predictor\n    model = Model(\n        image_uri=\"my-inference-image\",\n        model_data=\"s3:\u002F\u002Fmy-bucket\u002Fmodel.tar.gz\",\n        role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\"\n    )\n    predictor = model.deploy(\n        initial_instance_count=1,\n        instance_type=\"ml.m5.xlarge\"\n    )\n    result = predictor.predict(data)\n\n*SageMaker Python SDK 3.x:*\n\n.. code:: python\n\n    from sagemaker.serve import ModelBuilder\n    model_builder = ModelBuilder(\n        model=\"my-model\",\n        model_path=\"s3:\u002F\u002Fmy-bucket\u002Fmodel.tar.gz\"\n    )\n    endpoint = model_builder.build()\n    result = endpoint.invoke(...)\n\n**See more examples:** `SageMaker V3 Examples \u003C#sagemaker-v3-examples>`__\n\nSageMaker V3 Examples\n---------------------\n\n**Training Examples**\n\n#. `Custom Distributed Training Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Fcustom-distributed-training-example.ipynb>`__\n#. `Distributed Local Training Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Fdistributed-local-training-example.ipynb>`__\n#. `Hyperparameter Training Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Fhyperparameter-training-example.ipynb>`__\n#. `JumpStart Training Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Fjumpstart-training-example.ipynb>`__\n#. `Local Training Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Flocal-training-example.ipynb>`__\n\n**Inference Examples**\n\n#. `HuggingFace Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Fhuggingface-example.ipynb>`__\n#. `In-Process Mode Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Fin-process-mode-example.ipynb>`__\n#. `Inference Spec Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Finference-spec-example.ipynb>`__\n#. `JumpStart E2E Training Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Fjumpstart-e2e-training-example.ipynb>`__\n#. `JumpStart Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Fjumpstart-example.ipynb>`__\n#. `Local Mode Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Flocal-mode-example.ipynb>`__\n#. `Optimize Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Foptimize-example.ipynb>`__\n#. `Train Inference E2E Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Ftrain-inference-e2e-example.ipynb>`__\n\n**ML Ops Examples**\n\n#. `V3 Hyperparameter Tuning Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-hyperparameter-tuning-example\u002Fv3-hyperparameter-tuning-example.ipynb>`__\n#. `V3 Hyperparameter Tuning Pipeline \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-hyperparameter-tuning-example\u002Fv3-hyperparameter-tuning-pipeline.ipynb>`__\n#. `V3 Model Registry Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-model-registry-example\u002Fv3-model-registry-example.ipynb>`__\n#. `V3 PyTorch Processing Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-processing-job-pytorch\u002Fv3-pytorch-processing-example.ipynb>`__\n#. `V3 Pipeline Train Create Registry \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-pipeline-train-create-registry.ipynb>`__\n#. `V3 Processing Job Sklearn \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-processing-job-sklearn.ipynb>`__\n#. `V3 SageMaker Clarify \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-sagemaker-clarify.ipynb>`__\n#. `V3 Transform Job Example \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-transform-job-example.ipynb>`__\n\n**Looking for V2 Examples?** See `SageMaker V2 Examples \u003C#sagemaker-v2-examples>`__ below.\n\n\n\n\nInstalling the SageMaker Python SDK\n-----------------------------------\n\nThe SageMaker Python SDK is built to PyPI and the latest version of the SageMaker Python SDK can be installed with pip as follows\n::\n\n    pip install sagemaker==\u003CLatest version from pyPI from https:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker\u002F>\n\nYou can install from source by cloning this repository and running a pip install command in the root directory of the repository:\n\n::\n\n    git clone https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk.git\n    cd sagemaker-python-sdk\n    pip install .\n\nSupported Operating Systems\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSageMaker Python SDK supports Unix\u002FLinux and Mac.\n\nSupported Python Versions\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSageMaker Python SDK is tested on:\n\n- Python 3.9\n- Python 3.10\n- Python 3.11\n- Python 3.12\n\nTelemetry\n~~~~~~~~~~~~~~~\n\nThe ``sagemaker`` library has telemetry enabled to help us better understand user needs, diagnose issues, and deliver new features. This telemetry tracks the usage of various SageMaker functions.\n\nIf you prefer to opt out of telemetry, you can easily do so by setting the ``TelemetryOptOut`` parameter to ``true`` in the SDK defaults configuration. For detailed instructions, please visit `Configuring and using defaults with the SageMaker Python SDK \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#configuring-and-using-defaults-with-the-sagemaker-python-sdk>`__.\n\nAWS Permissions\n~~~~~~~~~~~~~~~\n\nAs a managed service, Amazon SageMaker performs operations on your behalf on the AWS hardware that is managed by Amazon SageMaker.\nAmazon SageMaker can perform only operations that the user permits.\nYou can read more about which permissions are necessary in the `AWS Documentation \u003Chttps:\u002F\u002Fdocs.aws.amazon.com\u002Fsagemaker\u002Flatest\u002Fdg\u002Fsagemaker-roles.html>`__.\n\nThe SageMaker Python SDK should not require any additional permissions aside from what is required for using SageMaker.\nHowever, if you are using an IAM role with a path in it, you should grant permission for ``iam:GetRole``.\n\nLicensing\n~~~~~~~~~\nSageMaker Python SDK is licensed under the Apache 2.0 License. It is copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. The license is available at:\nhttp:\u002F\u002Faws.amazon.com\u002Fapache2.0\u002F\n\nRunning tests\n~~~~~~~~~~~~~\n\nSageMaker Python SDK has unit tests and integration tests.\n\nYou can install the libraries needed to run the tests by running :code:`pip install --upgrade .[test]` or, for Zsh users: :code:`pip install --upgrade .\\[test\\]`\n\n**Unit tests**\n\nWe run unit tests with tox, which is a program that lets you run unit tests for multiple Python versions, and also make sure the\ncode fits our style guidelines. We run tox with `all of our supported Python versions \u003C#supported-python-versions>`_, so to run unit tests\nwith the same configuration we do, you need to have interpreters for those Python versions installed.\n\nTo run the unit tests with tox, run:\n\n::\n\n    tox tests\u002Funit\n\n**Integration tests**\n\nTo run the integration tests, the following prerequisites must be met\n\n1. AWS account credentials are available in the environment for the boto3 client to use.\n2. The AWS account has an IAM role named :code:`SageMakerRole`.\n   It should have the AmazonSageMakerFullAccess policy attached as well as a policy with `the necessary permissions to use Elastic Inference \u003Chttps:\u002F\u002Fdocs.aws.amazon.com\u002Fsagemaker\u002Flatest\u002Fdg\u002Fei-setup.html>`__.\n3. To run remote_function tests, dummy ecr repo should be created. It can be created by running -\n    :code:`aws ecr create-repository --repository-name remote-function-dummy-container`\n\nWe recommend selectively running just those integration tests you'd like to run. You can filter by individual test function names with:\n\n::\n\n    tox -- -k 'test_i_care_about'\n\n\nYou can also run all of the integration tests by running the following command, which runs them in sequence, which may take a while:\n\n::\n\n    tox -- tests\u002Finteg\n\n\nYou can also run them in parallel:\n\n::\n\n    tox -- -n auto tests\u002Finteg\n\n\nGit Hooks\n~~~~~~~~~\n\nto enable all git hooks in the .githooks directory, run these commands in the repository directory:\n\n::\n\n    find .git\u002Fhooks -type l -exec rm {} \\;\n    find .githooks -type f -exec ln -sf ..\u002F..\u002F{} .git\u002Fhooks\u002F \\;\n\nTo enable an individual git hook, simply move it from the .githooks\u002F directory to the .git\u002Fhooks\u002F directory.\n\nBuilding Sphinx docs\n~~~~~~~~~~~~~~~~~~~~\n\nSetup a Python environment, and install the dependencies listed in ``doc\u002Frequirements.txt``:\n\n::\n\n    # conda\n    conda create -n sagemaker python=3.12\n    conda activate sagemaker\n    conda install sphinx=5.1.1 sphinx_rtd_theme=0.5.0\n\n    # pip\n    pip install -r doc\u002Frequirements.txt\n\n\nClone\u002Ffork the repo, and install your local version:\n\n::\n\n    pip install --upgrade .\n\nThen ``cd`` into the ``sagemaker-python-sdk\u002Fdoc`` directory and run:\n\n::\n\n    make html\n\nYou can edit the templates for any of the pages in the docs by editing the .rst files in the ``doc`` directory and then running ``make html`` again.\n\nPreview the site with a Python web server:\n\n::\n\n    cd _build\u002Fhtml\n    python -m http.server 8000\n\nView the website by visiting http:\u002F\u002Flocalhost:8000\n\nSageMaker SparkML Serving\n-------------------------\n\nWith SageMaker SparkML Serving, you can now perform predictions against a SparkML Model in SageMaker.\nIn order to host a SparkML model in SageMaker, it should be serialized with ``MLeap`` library.\n\nFor more information on MLeap, see https:\u002F\u002Fgithub.com\u002Fcombust\u002Fmleap .\n\nSupported major version of Spark: 3.3 (MLeap version - 0.20.0)\n\nHere is an example on how to create an instance of  ``SparkMLModel`` class and use ``deploy()`` method to create an\nendpoint which can be used to perform prediction against your trained SparkML Model.\n\n.. code:: python\n\n    sparkml_model = SparkMLModel(model_data='s3:\u002F\u002Fpath\u002Fto\u002Fmodel.tar.gz', env={'SAGEMAKER_SPARKML_SCHEMA': schema})\n    model_name = 'sparkml-model'\n    endpoint_name = 'sparkml-endpoint'\n    predictor = sparkml_model.deploy(initial_instance_count=1, instance_type='ml.c4.xlarge', endpoint_name=endpoint_name)\n\nOnce the model is deployed, we can invoke the endpoint with a ``CSV`` payload like this:\n\n.. code:: python\n\n    payload = 'field_1,field_2,field_3,field_4,field_5'\n    predictor.predict(payload)\n\n\nFor more information about the different ``content-type`` and ``Accept`` formats as well as the structure of the\n``schema`` that SageMaker SparkML Serving recognizes, please see `SageMaker SparkML Serving Container`_.\n\n.. _SageMaker SparkML Serving Container: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-sparkml-serving-container\n\n\nSageMaker V2 Examples\n---------------------\n\n#. `Using the SageMaker Python SDK \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html>`__\n#. `Using MXNet \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_mxnet.html>`__\n#. `Using TensorFlow \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_tf.html>`__\n#. `Using Chainer \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_chainer.html>`__\n#. `Using PyTorch \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_pytorch.html>`__\n#. `Using Scikit-learn \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_sklearn.html>`__\n#. `Using XGBoost \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_xgboost.html>`__\n#. `SageMaker Reinforcement Learning Estimators \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_rl.html>`__\n#. `SageMaker SparkML Serving \u003C#sagemaker-sparkml-serving>`__\n#. `Amazon SageMaker Built-in Algorithm Estimators \u003Csrc\u002Fsagemaker\u002Famazon\u002FREADME.rst>`__\n#. `Using SageMaker AlgorithmEstimators \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#using-sagemaker-algorithmestimators>`__\n#. `Consuming SageMaker Model Packages \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#consuming-sagemaker-model-packages>`__\n#. `BYO Docker Containers with SageMaker Estimators \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#byo-docker-containers-with-sagemaker-estimators>`__\n#. `SageMaker Automatic Model Tuning \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#sagemaker-automatic-model-tuning>`__\n#. `SageMaker Batch Transform \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#sagemaker-batch-transform>`__\n#. `Secure Training and Inference with VPC \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#secure-training-and-inference-with-vpc>`__\n#. `BYO Model \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#byo-model>`__\n#. `Inference Pipelines \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#inference-pipelines>`__\n#. `Amazon SageMaker Operators in Apache Airflow \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_workflow.html>`__\n#. `SageMaker Autopilot \u003Csrc\u002Fsagemaker\u002Fautoml\u002FREADME.rst>`__\n#. `Model Monitoring \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Famazon_sagemaker_model_monitoring.html>`__\n#. `SageMaker Debugger \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Famazon_sagemaker_debugger.html>`__\n#. `SageMaker Processing \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Famazon_sagemaker_processing.html>`__\n\n🚀 Model Fine-Tuning Support Now Available in V3\n-------------------------------------------------\n\nWe're excited to announce model fine-tuning capabilities in SageMaker Python SDK V3!\n\n**What's New**\n\nFour new trainer classes for fine-tuning foundation models:\n\n* SFTTrainer - Supervised fine-tuning\n* DPOTrainer - Direct preference optimization  \n* RLAIFTrainer - RL from AI feedback\n* RLVRTrainer - RL from verifiable rewards\n\n**Quick Example**\n\n.. code:: python\n\n    from sagemaker.train import SFTTrainer\n    from sagemaker.train.common import TrainingType\n\n    trainer = SFTTrainer(\n        model=\"meta-llama\u002FLlama-2-7b-hf\",\n        training_type=TrainingType.LORA,\n        model_package_group_name=\"my-models\",\n        training_dataset=\"s3:\u002F\u002Fbucket\u002Ftrain.jsonl\"\n    )\n\n    training_job = trainer.train()\n\n**Key Features**\n\n* ✨ LoRA & full fine-tuning  \n* 📊 MLflow integration with real-time metrics  \n* 🚀 Deploy to SageMaker or Bedrock  \n* 📈 Built-in evaluation (11 benchmarks)  \n* ☁️ Serverless training  \n\n**Get Started**\n\n.. code:: python\n\n    pip install sagemaker>=3.1.0\n\n`📓 Example notebooks \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Ftree\u002Fmaster\u002Fv3-examples\u002Fmodel-customization-examples>`__",".. image:: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fraw\u002Fmaster\u002Fbranding\u002Ficon\u002Fsagemaker-banner.png\n    :height: 100px\n    :alt: SageMaker\n\n====================\nSageMaker Python SDK\n====================\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fsagemaker.svg\n   :target: https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Fsagemaker\n   :alt: 最新版本\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fsagemaker.svg\n   :target: https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Fsagemaker\n   :alt: 支持的 Python 版本\n\n.. image:: https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcode_style-black-000000.svg\n   :target: https:\u002F\u002Fgithub.com\u002Fpython\u002Fblack\n   :alt: 代码风格：black\n\n.. image:: https:\u002F\u002Freadthedocs.org\u002Fprojects\u002Fsagemaker\u002Fbadge\u002F?version=stable\n   :target: https:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002F\n   :alt: 文档状态\n\n.. image:: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Factions\u002Fworkflows\u002Fcodebuild-ci-health.yml\u002Fbadge.svg\n    :target: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Factions\u002Fworkflows\u002Fcodebuild-ci-health.yml\n    :alt: CI 健康状况\n\nSageMaker Python SDK 是一个开源库，用于在 Amazon SageMaker 上训练和部署机器学习模型。\n\n借助该 SDK，您可以使用流行的深度学习框架 **Apache MXNet** 和 **PyTorch** 来训练和部署模型。\n您还可以使用 **Amazon 算法** 训练和部署模型，\n这些算法是核心机器学习算法的可扩展实现，专为 SageMaker 和 GPU 训练进行了优化。\n如果您拥有构建在与 SageMaker 兼容的 Docker 容器中的 **自定义算法**，也可以使用它们来训练和托管模型。\n\n要安装 SageMaker Python SDK，请参阅 `安装 SageMaker Python SDK \u003C#installing-the-sagemaker-python-sdk>`_。\n\n❗🔥 SageMaker V3 发布\n-------------------------\n\n版本 3.0.0 是我们产品发展的一个重要里程碑。此次重大发布引入了现代化架构、性能提升以及强大的新功能，同时继续致力于提供卓越的用户体验和可靠性。\n\n**重要提示：请在升级前查看这些破坏性更改。**\n\n* 较旧的接口，如 Estimator、Model、Predictor 及其所有子类，在 V3 中将不再支持。\n* 请参阅我们的 `V3 示例文件夹 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Ftree\u002Fmaster\u002Fv3-examples>`__，以获取示例笔记本和使用模式。\n\n\n迁移到 V3\n----------------\n\n**升级到 3.x**\n\n要升级到最新版本的 SageMaker Python SDK 3.x：\n\n::\n\n    pip install --upgrade sagemaker\n\n如果您希望降级到 2.x 版本：\n\n::\n\n    pip install sagemaker==2.*\n\n请参阅 `SageMaker V2 示例 \u003C#sagemaker-v2-examples>`__ 以获取 V2 的文档和示例。\n\n**3.x 的主要优势**\n\n* **模块化架构**：核心、训练和推理功能分别由独立的 PyPI 包提供\n\n  * `sagemaker-core \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-core\u002F>`__\n  * `sagemaker-train \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-train\u002F>`__\n  * `sagemaker-serve \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-serve\u002F>`__\n  * `sagemaker-mlops \u003Chttps:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-mlops\u002F>`__\n\n* **统一的训练与推理**：单个类（ModelTrainer、ModelBuilder）取代了多个框架特定的类\n* **面向对象的 API**：结构化的接口，自动生成与 AWS API 对齐的配置\n* **简化的工作流程**：减少了样板代码，界面更加直观\n\n**训练体验**\n\nV3 引入了统一的 ModelTrainer 类，以降低模型训练初始设置和部署的复杂性。这取代了 V2 中的 Estimator 类以及框架特定的类（PyTorchEstimator、SKLearnEstimator 等）。\n\n此示例展示了如何使用自定义训练容器，并从 S3 获取训练数据来训练模型。\n\n*SageMaker Python SDK 2.x：*\n\n.. code:: python\n\n    from sagemaker.estimator import Estimator\n    estimator = Estimator(\n        image_uri=\"my-training-image\",\n        role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\",\n        instance_count=1,\n        instance_type=\"ml.m5.xlarge\",\n        output_path=\"s3:\u002F\u002Fmy-bucket\u002Foutput\"\n    )\n    estimator.fit({\"training\": \"s3:\u002F\u002Fmy-bucket\u002Ftrain\"})\n\n*SageMaker Python SDK 3.x：*\n\n.. code:: python\n\n    from sagemaker.train import ModelTrainer\n    from sagemaker.train.configs import InputData\n\n    trainer = ModelTrainer(\n        training_image=\"my-training-image\",\n        role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\"\n    )\n\n    train_data = InputData(\n        channel_name=\"training\",\n        data_source=\"s3:\u002F\u002Fmy-bucket\u002Ftrain\"\n    )\n\n    trainer.train(input_data_config=[train_data])\n\n**更多示例：** `SageMaker V3 示例 \u003C#sagemaker-v3-examples>`__\n\n**推理体验**\n\nV3 引入了统一的 ModelBuilder 类，用于模型部署和推理。这取代了 V2 中的 Model 类以及框架特定的类（PyTorchModel、TensorFlowModel、SKLearnModel、XGBoostModel 等）。\n\n此示例展示了如何部署一个已训练好的模型以进行实时推理。\n\n*SageMaker Python SDK 2.x：*\n\n.. code:: python\n\n    from sagemaker.model import Model\n    from sagemaker.predictor import Predictor\n    model = Model(\n        image_uri=\"my-inference-image\",\n        model_data=\"s3:\u002F\u002Fmy-bucket\u002Fmodel.tar.gz\",\n        role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\"\n    )\n    predictor = model.deploy(\n        initial_instance_count=1,\n        instance_type=\"ml.m5.xlarge\"\n    )\n    result = predictor.predict(data)\n\n*SageMaker Python SDK 3.x：*\n\n.. code:: python\n\n    from sagemaker.serve import ModelBuilder\n    model_builder = ModelBuilder(\n        model=\"my-model\",\n        model_path=\"s3:\u002F\u002Fmy-bucket\u002Fmodel.tar.gz\"\n    )\n    endpoint = model_builder.build()\n    result = endpoint.invoke(...)\n\n**更多示例：** `SageMaker V3 示例 \u003C#sagemaker-v3-examples>`__\n\nSageMaker V3 示例\n---------------------\n\n**训练示例**\n\n#. `自定义分布式训练示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Fcustom-distributed-training-example.ipynb>`__\n#. `分布式本地训练示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Fdistributed-local-training-example.ipynb>`__\n#. `超参数训练示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Fhyperparameter-training-example.ipynb>`__\n#. `JumpStart 训练示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Fjumpstart-training-example.ipynb>`__\n#. `本地训练示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Ftraining-examples\u002Flocal-training-example.ipynb>`__\n\n**推理示例**\n\n#. `HuggingFace 示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Fhuggingface-example.ipynb>`__\n#. `进程内模式示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Fin-process-mode-example.ipynb>`__\n#. `推理规范示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Finference-spec-example.ipynb>`__\n#. `JumpStart 端到端训练示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Fjumpstart-e2e-training-example.ipynb>`__\n#. `JumpStart 示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Fjumpstart-example.ipynb>`__\n#. `本地模式示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Flocal-mode-example.ipynb>`__\n#. `优化示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Foptimize-example.ipynb>`__\n#. `训练与推理端到端示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Finference-examples\u002Ftrain-inference-e2e-example.ipynb>`__\n\n**ML 操作示例**\n\n#. `V3 超参数调优示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-hyperparameter-tuning-example\u002Fv3-hyperparameter-tuning-example.ipynb>`__\n#. `V3 超参数调优流水线 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-hyperparameter-tuning-example\u002Fv3-hyperparameter-tuning-pipeline.ipynb>`__\n#. `V3 模型注册表示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-model-registry-example\u002Fv3-model-registry-example.ipynb>`__\n#. `V3 PyTorch 处理示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-processing-job-pytorch\u002Fv3-pytorch-processing-example.ipynb>`__\n#. `V3 流水线训练并创建注册表 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-pipeline-train-create-registry.ipynb>`__\n#. `V3 Sklearn 处理作业 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-processing-job-sklearn.ipynb>`__\n#. `V3 SageMaker Clarify \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-sagemaker-clarify.ipynb>`__\n#. `V3 转换作业示例 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fblob\u002Fmaster\u002Fv3-examples\u002Fml-ops-examples\u002Fv3-transform-job-example.ipynb>`__\n\n**寻找 V2 示例？** 请参阅下方的 `SageMaker V2 示例 \u003C#sagemaker-v2-examples>`__。\n\n\n\n安装 SageMaker Python SDK\n-------------------------\n\nSageMaker Python SDK 已发布到 PyPI，您可以通过以下 pip 命令安装最新版本：\n::\n\n    pip install sagemaker==\u003C来自 https:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker\u002F 的最新版本>\n\n您也可以通过克隆此仓库并在仓库根目录下运行 pip 安装命令来从源代码安装：\n\n::\n\n    git clone https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk.git\n    cd sagemaker-python-sdk\n    pip install .\n\n支持的操作系统\n~~~~~~~~~~~~~~~~\n\nSageMaker Python SDK 支持 Unix\u002FLinux 和 Mac。\n\n支持的 Python 版本\n~~~~~~~~~~~~~~~~~~~\n\nSageMaker Python SDK 已在以下 Python 版本上进行测试：\n\n- Python 3.9\n- Python 3.10\n- Python 3.11\n- Python 3.12\n\n遥测\n~~~~~~\n\n`sagemaker` 库启用了遥测功能，以帮助我们更好地了解用户需求、诊断问题并推出新功能。该遥测会跟踪各种 SageMaker 功能的使用情况。\n\n如果您希望选择退出遥测，只需在 SDK 默认配置中将 `TelemetryOptOut` 参数设置为 `true` 即可。有关详细说明，请访问 `使用 SageMaker Python SDK 配置和使用默认值 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#configuring-and-using-defaults-with-the-sagemaker-python-sdk>`__。\n\nAWS 权限\n~~~~~~~~\n\n作为一项托管服务，Amazon SageMaker 会在由 Amazon SageMaker 管理的 AWS 硬件上代表您执行操作。\nAmazon SageMaker 只能执行用户允许的操作。\n有关所需权限的更多信息，请参阅 `AWS 文档 \u003Chttps:\u002F\u002Fdocs.aws.amazon.com\u002Fsagemaker\u002Flatest\u002Fdg\u002Fsagemaker-roles.html>`__。\n\n除了使用 SageMaker 所需的权限外，SageMaker Python SDK 不应需要任何额外的权限。\n但是，如果您使用的是带有路径的 IAM 角色，则应授予 `iam:GetRole` 权限。\n\n许可\n~~~~~\nSageMaker Python SDK 采用 Apache 2.0 许可证授权。版权归 Amazon.com, Inc. 或其关联公司所有。保留所有权利。许可证可在以下网址获取：\nhttp:\u002F\u002Faws.amazon.com\u002Fapache2.0\u002F\n\n运行测试\n~~~~~~~~\n\nSageMaker Python SDK 包含单元测试和集成测试。\n\n您可以运行 :code:`pip install --upgrade .[test]` 或对于 Zsh 用户：:code:`pip install --upgrade .\\[test\\]` 来安装运行测试所需的库。\n\n**单元测试**\n\n我们使用 tox 运行单元测试，tox 是一个可以针对多个 Python 版本运行单元测试，并确保代码符合我们的编码规范的工具。我们使用 `所有支持的 Python 版本 \u003C#supported-python-versions>`__ 运行 tox，因此要以与我们相同的配置运行单元测试，您需要安装这些 Python 版本的解释器。\n\n要使用 tox 运行单元测试，运行以下命令：\n\n::\n\n    tox tests\u002Funit\n\n**集成测试**\n\n要运行集成测试，必须满足以下先决条件：\n\n1. 环境中已提供 AWS 账户凭证，以便 boto3 客户端使用。\n2. AWS 账户拥有名为 :code:`SageMakerRole` 的 IAM 角色。\n   该角色应附加 AmazonSageMakerFullAccess 策略，以及具有 `使用 Elastic Inference 所需权限 \u003Chttps:\u002F\u002Fdocs.aws.amazon.com\u002Fsagemaker\u002Flatest\u002Fdg\u002Fei-setup.html>`__ 的策略。\n3. 要运行 remote_function 测试，需要创建一个 dummy ecr 仓库。可以通过运行以下命令创建：\n    :code:`aws ecr create-repository --repository-name remote-function-dummy-container`\n\n我们建议您有选择地运行自己感兴趣的集成测试。您可以通过单个测试函数名称进行筛选：\n\n::\n\n    tox -- -k 'test_i_care_about'\n\n\n您也可以运行所有集成测试，只需运行以下命令即可，该命令会按顺序运行所有测试，可能需要一些时间：\n\n::\n\n    tox -- tests\u002Finteg\n\n\n您还可以并行运行它们：\n\n::\n\n    tox -- -n auto tests\u002Finteg\n\n\nGit 钩子\n~~~~~~~~\n\n要在 .githooks 目录中启用所有 Git 钩子，请在仓库目录中运行以下命令：\n\n::\n\n    find .git\u002Fhooks -type l -exec rm {} \\;\n    find .githooks -type f -exec ln -sf ..\u002F..\u002F{} .git\u002Fhooks\u002F \\;\n\n要启用单个 Git 钩子，只需将其从 .githooks\u002F 目录移动到 .git\u002Fhooks\u002F 目录即可。\n\n构建 Sphinx 文档\n~~~~~~~~~~~~~~~~~~~~\n\n设置 Python 环境，并安装 ``doc\u002Frequirements.txt`` 中列出的依赖项：\n\n::\n\n    # conda\n    conda create -n sagemaker python=3.12\n    conda activate sagemaker\n    conda install sphinx=5.1.1 sphinx_rtd_theme=0.5.0\n\n    # pip\n    pip install -r doc\u002Frequirements.txt\n\n\n克隆或分叉仓库，并安装本地版本：\n\n::\n\n    pip install --upgrade .\n\n然后进入 ``sagemaker-python-sdk\u002Fdoc`` 目录并运行：\n\n::\n\n    make html\n\n您可以通过编辑 ``doc`` 目录中的 .rst 文件来修改文档中任何页面的模板，然后再次运行 ``make html``。\n\n使用 Python Web 服务器预览站点：\n\n::\n\n    cd _build\u002Fhtml\n    python -m http.server 8000\n\n访问 http:\u002F\u002Flocalhost:8000 即可查看网站。\n\nSageMaker SparkML 服务\n-------------------------\n\n借助 SageMaker SparkML 服务，您现在可以在 SageMaker 中对 SparkML 模型进行预测。要在 SageMaker 中托管 SparkML 模型，该模型应使用 ``MLeap`` 库进行序列化。\n\n有关 MLeap 的更多信息，请参阅 https:\u002F\u002Fgithub.com\u002Fcombust\u002Fmleap 。\n\n支持的主要 Spark 版本：3.3（MLeap 版本 - 0.20.0）\n\n以下是如何创建 ``SparkMLModel`` 类的实例，并使用 ``deploy()`` 方法创建端点的示例，该端点可用于对您训练好的 SparkML 模型进行预测。\n\n.. code:: python\n\n    sparkml_model = SparkMLModel(model_data='s3:\u002F\u002Fpath\u002Fto\u002Fmodel.tar.gz', env={'SAGEMAKER_SPARKML_SCHEMA': schema})\n    model_name = 'sparkml-model'\n    endpoint_name = 'sparkml-endpoint'\n    predictor = sparkml_model.deploy(initial_instance_count=1, instance_type='ml.c4.xlarge', endpoint_name=endpoint_name)\n\n模型部署完成后，我们可以使用如下格式的 ``CSV`` 负载调用端点：\n\n.. code:: python\n\n    payload = 'field_1,field_2,field_3,field_4,field_5'\n    predictor.predict(payload)\n\n\n有关不同 ``content-type`` 和 ``Accept`` 格式以及 SageMaker SparkML 服务所识别的 ``schema`` 结构的更多信息，请参阅 `SageMaker SparkML 服务容器`_。\n\n.. _SageMaker SparkML 服务容器: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-sparkml-serving-container\n\n\nSageMaker V2 示例\n---------------------\n\n#. 使用 SageMaker Python SDK \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html>\n#. 使用 MXNet \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_mxnet.html>\n#. 使用 TensorFlow \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_tf.html>\n#. 使用 Chainer \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_chainer.html>\n#. 使用 PyTorch \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_pytorch.html>\n#. 使用 Scikit-learn \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_sklearn.html>\n#. 使用 XGBoost \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_xgboost.html>\n#. SageMaker 强化学习估算器 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_rl.html>\n#. SageMaker SparkML 服务 \u003C#sagemaker-sparkml-serving>\n#. Amazon SageMaker 内置算法估算器 \u003Csrc\u002Fsagemaker\u002Famazon\u002FREADME.rst>\n#. 使用 SageMaker 算法估算器 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#using-sagemaker-algorithmestimators>\n#. 消费 SageMaker 模型包 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#consuming-sagemaker-model-packages>\n#. 使用 SageMaker 估算器的 BYO Docker 容器 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#byo-docker-containers-with-sagemaker-estimators>\n#. SageMaker 自动模型调优 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#sagemaker-automatic-model-tuning>\n#. SageMaker 批量转换 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#sagemaker-batch-transform>\n#. 使用 VPC 进行安全的训练和推理 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#secure-training-and-inference-with-vpc>\n#. BYO 模型 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#byo-model>\n#. 推理管道 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Foverview.html#inference-pipelines>\n#. Apache Airflow 中的 Amazon SageMaker 操作符 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Fusing_workflow.html>\n#. SageMaker 自动驾驶 \u003Csrc\u002Fsagemaker\u002Fautoml\u002FREADME.rst>\n#. 模型监控 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Famazon_sagemaker_model_monitoring.html>\n#. SageMaker 调试器 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Famazon_sagemaker_debugger.html>\n#. SageMaker 处理 \u003Chttps:\u002F\u002Fsagemaker.readthedocs.io\u002Fen\u002Fstable\u002Famazon_sagemaker_processing.html>\n\n🚀 V3 现已支持模型微调\n-------------------------------------------------\n\n我们很高兴地宣布，SageMaker Python SDK V3 现已支持模型微调功能！\n\n**新增内容**\n\n四个用于微调基础模型的新训练器类：\n\n* SFTTrainer - 监督式微调\n* DPOTrainer - 直接偏好优化\n* RLAIFTrainer - 基于人工智能反馈的强化学习\n* RLVRTrainer - 基于可验证奖励的强化学习\n\n**快速示例**\n\n.. code:: python\n\n    from sagemaker.train import SFTTrainer\n    from sagemaker.train.common import TrainingType\n\n    trainer = SFTTrainer(\n        model=\"meta-llama\u002FLlama-2-7b-hf\",\n        training_type=TrainingType.LORA,\n        model_package_group_name=\"my-models\",\n        training_dataset=\"s3:\u002F\u002Fbucket\u002Ftrain.jsonl\"\n    )\n\n    training_job = trainer.train()\n\n**主要特性**\n\n* ✨ LoRA 和全量微调  \n* 📊 MLflow 集成，提供实时指标  \n* 🚀 可部署至 SageMaker 或 Bedrock  \n* 📈 内置评估（11 个基准测试）  \n* ☁️ 无服务器训练  \n\n**开始使用**\n\n.. code:: python\n\n    pip install sagemaker>=3.1.0\n\n`📓 示例笔记本 \u003Chttps:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Ftree\u002Fmaster\u002Fv3-examples\u002Fmodel-customization-examples>`__","# SageMaker Python SDK 快速上手指南\n\nSageMaker Python SDK 是一个开源库，用于在 Amazon SageMaker 上训练和部署机器学习模型。最新版本（V3）引入了现代化的架构，通过统一的 `ModelTrainer` 和 `ModelBuilder` 类简化了工作流。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**：支持 Unix\u002FLinux 和 macOS。\n- **Python 版本**：支持 Python 3.9, 3.10, 3.11, 3.12。\n\n### 前置依赖\n- **AWS 凭证**：确保已配置 AWS CLI 或设置了环境变量 (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION`)。\n- **IAM 权限**：运行代码的用户角色需要具备 SageMaker 相关操作权限（如 `sagemaker:CreateTrainingJob`, `sagemaker:CreateEndpoint` 等）。如果使用带路径的 IAM 角色，还需授予 `iam:GetRole` 权限。\n\n## 安装步骤\n\n推荐使用 pip 进行安装。国内开发者若遇到下载速度慢的问题，可使用清华或阿里云镜像源加速。\n\n### 方式一：使用 PyPI 安装（推荐）\n\n**标准安装：**\n```bash\npip install sagemaker\n```\n\n**使用国内镜像源加速安装：**\n```bash\npip install sagemaker -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n```\n\n> **注意**：当前主要版本为 V3。如需使用旧版 V2 接口，请指定版本：`pip install sagemaker==2.*`。\n\n### 方式二：从源码安装\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk.git\ncd sagemaker-python-sdk\npip install .\n```\n\n## 基本使用\n\nSageMaker Python SDK V3 提供了更简洁的面向对象 API。以下是训练和推理的最简示例。\n\n### 1. 模型训练 (Training)\n\nV3 使用统一的 `ModelTrainer` 类替代了旧版的 `Estimator` 及其框架特定子类。\n\n```python\nfrom sagemaker.train import ModelTrainer\nfrom sagemaker.train.configs import InputData\n\n# 初始化训练器\ntrainer = ModelTrainer(\n    training_image=\"my-training-image\",  # 替换为你的训练容器镜像 URI\n    role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\"  # 替换为你的 IAM 角色 ARN\n)\n\n# 配置输入数据\ntrain_data = InputData(\n    channel_name=\"training\",\n    data_source=\"s3:\u002F\u002Fmy-bucket\u002Ftrain\"  # 替换为你的 S3 训练数据路径\n)\n\n# 启动训练任务\ntrainer.train(input_data_config=[train_data])\n```\n\n### 2. 模型部署与推理 (Inference)\n\nV3 使用统一的 `ModelBuilder` 类替代了旧版的 `Model` 及其框架特定子类。\n\n```python\nfrom sagemaker.serve import ModelBuilder\n\n# 初始化模型构建器\nmodel_builder = ModelBuilder(\n    model=\"my-model\",  # 替换为你的模型名称或标识\n    model_path=\"s3:\u002F\u002Fmy-bucket\u002Fmodel.tar.gz\"  # 替换为你的模型文件 S3 路径\n)\n\n# 构建并部署端点\nendpoint = model_builder.build()\n\n# 调用端点进行推理\n# result = endpoint.invoke(...) \n# 请根据实际模型输入格式传递数据\n```\n\n> **提示**：更多高级用法（如分布式训练、超参数调优、JumpStart 集成等）请参考官方 [V3 示例仓库](https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Ftree\u002Fmaster\u002Fv3-examples)。","某电商公司的算法团队正急需将基于 PyTorch 的推荐模型从本地实验环境迁移至云端，以应对大促期间海量的用户行为数据训练需求。\n\n### 没有 sagemaker-python-sdk 时\n- **环境配置繁琐**：工程师需手动编写复杂的 Dockerfile 来构建包含特定版本 PyTorch 和依赖库的训练镜像，排查兼容性问题耗时数天。\n- **代码耦合度高**：调用 SageMaker API 需要大量样板代码来管理 IAM 角色、S3 数据路径及实例类型，导致核心算法逻辑被基础设施代码淹没。\n- **框架切换困难**：若尝试从 PyTorch 切换到 MXNet 或使用亚马逊内置算法，必须重写整套训练启动脚本，复用性极差。\n- **调试周期漫长**：缺乏统一的接口抽象，每次调整超参数或实例规格都需修改多处底层配置，极易引发人为错误。\n\n### 使用 sagemaker-python-sdk 后\n- **开箱即用框架**：直接利用 SDK 内置的 PyTorch 估算器（Estimator），自动处理容器构建与依赖注入，几分钟内即可启动分布式训练任务。\n- **逻辑清晰简洁**：通过统一的 `ModelTrainer` 类封装底层细节，开发者只需关注数据输入与模型定义，代码量减少约 70%。\n- **无缝切换后端**：仅需更改几行参数即可在自定义算法、开源框架与亚马逊优化算法之间灵活切换，无需重构业务代码。\n- **工作流标准化**：借助模块化架构统一管理训练与服务部署配置，显著降低了多环境下的维护成本与出错概率。\n\nsagemaker-python-sdk 通过高度抽象的接口屏蔽了云基础设施的复杂性，让算法工程师能专注于模型创新而非运维琐事。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Faws_sagemaker-python-sdk_67aceade.png","aws","Amazon Web Services","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Faws_84ebd8ed.png","",null,"open-source-github@amazon.com","https:\u002F\u002Famazon.com\u002Faws","https:\u002F\u002Fgithub.com\u002Faws",[81,85,89,93,96],{"name":82,"color":83,"percentage":84},"Python","#3572A5",92.8,{"name":86,"color":87,"percentage":88},"Jupyter Notebook","#DA5B0B",7.2,{"name":90,"color":91,"percentage":92},"Batchfile","#C1F12E",0,{"name":94,"color":95,"percentage":92},"Makefile","#427819",{"name":97,"color":98,"percentage":92},"Shell","#89e051",2237,1236,"2026-04-04T09:48:16","Apache-2.0","Linux, macOS","未说明",{"notes":106,"python":107,"dependencies":108},"该工具是用于在 Amazon SageMaker 上训练和部署模型的 SDK，本身不直接在本地运行重型模型，因此无具体本地 GPU\u002F内存硬性要求（取决于调用的云端实例类型）。注意 V3 版本已重构架构，不再支持 V2 中的 Estimator、Model 等旧类，需使用 ModelTrainer 和 ModelBuilder 等新接口。若使用包含路径的 IAM 角色，需授予 iam:GetRole 权限。可通过配置关闭遥测数据收集。","3.9, 3.10, 3.11, 3.12",[109,110,111,112],"sagemaker-core (V3 架构核心)","sagemaker-train (V3 训练模块)","sagemaker-serve (V3 推理模块)","sagemaker-mlops (V3 MLOps 模块)",[14,15],[72,115,116,117,118,119,120,121],"mxnet","tensorflow","machine-learning","python","pytorch","sagemaker","huggingface","2026-03-27T02:49:30.150509","2026-04-06T20:57:15.066710",[125,130,135,140,145,149],{"id":126,"question_zh":127,"answer_zh":128,"source_url":129},20026,"如何解决 sagemaker-python-sdk 与 NumPy 2.0+ 版本的依赖冲突？","该问题已在 sagemaker-python-sdk v2.254.0 版本中修复，该版本正式添加了对 NumPy 2.0 的支持。如果您遇到依赖地狱（dependency hell），请将 SDK 升级到 v2.254.0 或更高版本：`pip install --upgrade sagemaker`。升级后，SDK 将兼容 NumPy >= 2.0.0 的环境。","https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fissues\u002F4882",{"id":131,"question_zh":132,"answer_zh":133,"source_url":134},20027,"如何在 AWS Lambda 中使用 SageMaker Python SDK 而不超过解压大小限制（262MB）？","由于 SageMaker SDK 包体积较大，直接打包会导致超过 AWS Lambda 262MB 的解压限制。官方目前将此反馈列入待办事项，暂无内置精简方案。建议的变通方法包括：1. 尽量使用 boto3 替代 SDK，虽然部分高级功能（如 Feature Store 的 ingest 批量处理）可能缺失，但 boto3 体积更小且功能日益完善；2. 如果必须使用 SDK 特定功能，考虑将重型逻辑移至 EC2 或 Lambda 调用的 SageMaker Processing Job，而不是在 Lambda 内部运行完整 SDK。","https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fissues\u002F1200",{"id":136,"question_zh":137,"answer_zh":138,"source_url":139},20028,"在 SageMaker Notebook 实例（GPU 型）上运行 TensorFlow 时无法检测到 GPU 怎么办？","默认预装的 TensorFlow 版本可能未正确配置 GPU 支持。解决方案是通过 Conda 手动安装或升级 tensorflow-gpu 包，并重启 Notebook 内核。执行命令：`!conda install tensorflow-gpu`（或在终端运行 `conda install tensorflow-gpu`）。安装完成后重启实例，再次运行 `tf.config.experimental.list_physical_devices('GPU')` 即可看到 GPU 设备。注意不要在使用非 Elastic Inference 实例时误选 `*amazonei*` 内核。","https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fissues\u002F476",{"id":141,"question_zh":142,"answer_zh":143,"source_url":144},20029,"部署模型时因资源限制报错，修改 instance_type 后为何仍然失败？","当首次部署因 `ResourceLimitExceeded`（资源限额超额）失败后，SageMaker 可能仍保留了部分失败的端点创建状态或锁定了相关资源名称。如果直接更改 `instance_type` 再次运行 `.deploy()`，可能会因为前一次失败的残留状态导致同样的错误。解决方法是：先显式删除之前尝试创建的端点（Endpoint）或预测器对象，确保资源完全释放，然后再使用新的 `instance_type` 重新执行部署代码。例如：`pca_predictor.delete_endpoint()` 或在控制台手动删除失败的端点后再重试。","https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fissues\u002F987",{"id":146,"question_zh":147,"answer_zh":148,"source_url":134},20030,"SageMaker SDK 相比 boto3 有哪些独特优势，值得在 Lambda 中克服体积限制去使用？","SageMaker SDK 提供了比 boto3 更高级的封装和便捷功能，特别是在数据处理和流水线管理方面。例如，在使用 Feature Store 时，SDK 提供 `ingest()` 方法，可以直接传入 pandas DataFrame，并支持设置 `max_workers` 和 `max_processes` 进行多线程\u002F多进程大数据处理；而 boto3 仅仅提供底层的 `put_record` 接口，需要手动构建记录列表，缺乏批量处理的便利性。如果您的场景强依赖这些高级抽象功能，才值得尝试优化 Lambda 包大小来使用 SDK。",{"id":150,"question_zh":151,"answer_zh":152,"source_url":139},20031,"如何确认 SageMaker Notebook 中的 TensorFlow 代码是否真正使用了 GPU 进行训练？","可以通过以下两种方式确认：1. 代码检查：运行 `tf.config.experimental.list_physical_devices('GPU')`，如果返回包含 'GPU' 的列表（如 `[PhysicalDevice(name='\u002Fphysical_device:GPU:0', device_type='GPU')]`），说明环境已识别到 GPU。2. 日志观察：在创建 Session 时配置 `log_device_placement=True`（即 `tf.Session(config=tf.ConfigProto(log_device_placement=True))`），查看日志输出中算子是否被放置在 `\u002Fdevice:GPU:0` 上。如果识别到 GPU 但训练依然极慢，需检查是否因数据加载瓶颈或未正确使用 GPU 加速算子导致。",[154,159,164,169,174,179,184,189,194,199,204,209,214,219,224,229,234,239,244,249],{"id":155,"version":156,"summary_zh":157,"released_at":158},118060,"v3.7.1","### 功能\n- **遥测**：向 `ScriptProcessor` 和 `FrameworkProcessor` 添加了遥测发射器，通过遥测归因模块实现对处理作业的 SDK 使用情况跟踪（在遥测常量中新增了 `PROCESSING` 功能枚举）\n\n### 修复\n- **ModelBuilder**：修复了 ModelBuilder 的 LoRA 部署路径中 `accept_eula` 的处理逻辑——此前该参数被硬编码为 `True`，现在会尊重用户提供的值，并在未显式设置为 `True` 时抛出 `ValueError` 异常。\n- **Evaluate**：修复了 Evaluator 中 Lambda 处理程序名称的推导逻辑——将处理程序名称硬编码为 `lambda_function.lambda_handler`，而非从源文件名推导，从而避免了当源文件名非默认值时导致的调用失败问题。\n\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fcompare\u002Fv3.7.0...v3.7.1","2026-04-01T03:15:05",{"id":160,"version":161,"summary_zh":162,"released_at":163},118061,"v3.7.0","### 修复\n- **ModelBuilder**: 将 Nova 托管配置与 AGI SageMaker 推理同步\n- **Evaluate**: 移除 GPT 开源模型评估限制\n\n### 功能\n- **AWS Batch**: 增加对配额管理作业提交和作业优先级更新的支持\n- **AWS Batch**: 扩展 list_jobs_by_share，支持通过 quota_share_name 进行查询\n- **Evaluate**: 支持为 BaseEvaluator 使用 IAM 角色\n- **Telemetry**: 添加遥测归因模块，用于追踪 SDK 的使用来源\n- **MLflow**: 提供指标可视化、增强的等待界面以及评估作业链接\n\n### 杂项\n- 更新 SDK，使其在 v3.x 中使用最新的 LMIv22 镜像\n- 更新迁移指南\n- AWS Batch 集成测试资源现以测试运行名称唯一命名","2026-03-25T23:58:42",{"id":165,"version":166,"summary_zh":167,"released_at":168},118062,"v3.6.0","### 修复\n- **HyperparameterTuner**: 在 HyperparameterTuner 作业中包含 sm_drivers 渠道\n- **Pipeline**: 修复训练步骤依赖关系的处理，以确保管道能够成功创建\n- **ModelBuilder**: 修复从 LORA 微调作业部署时的 bug\n\n### 功能\n- **特征处理器**: 将特征处理器迁移到 v3 版本\n- **Jumpstart**: 为 JumpStart 添加 EUSC 区域配置","2026-03-20T03:11:08",{"id":170,"version":171,"summary_zh":172,"released_at":173},118063,"v2.257.1","### 错误修复\n* 修复 pytest 和 setuptools 兼容性导致的测试失败问题 (#5574)\n\n### 依赖更新\n* 将 protobuf 版本约束放宽至 \u003C7.0 (#5573)\n\n### 功能增强\n* 为特征存储添加遥测功能 (#5557)\n* 添加 VERL（通用强化学习）支持 (#5498)\n","2026-03-05T21:10:43",{"id":175,"version":176,"summary_zh":177,"released_at":178},118064,"v3.5.0","### 功能特性\n- **特征存储 v3**：全新版本的特征存储功能\n- **按共享标识列出批量作业**：新增支持按共享标识筛选并列出批量作业\n- **模型自定义训练器的停止条件**：为模型自定义训练器增加了停止条件支持\n- **EMRStep 智能输出**：增强了 EMR 步骤的输出处理能力，支持智能输出功能\n- **转换 AMI 版本支持**：在 SageMaker 转换作业中新增了指定 AMI 版本的功能\n\n### 功能优化\n- **推理管道笔记本示例**：新增演示推理管道使用方法的示例笔记本\n- **迁移文档**：新增迁移相关文档\n\n### 问题修复\n- **模型自定义相关缺陷**：修复了模型自定义功能中的多个问题\n- **移除默认停止条件**：移除了 MC 训练器的默认停止条件，以避免冲突\n- **实例组参数处理**：修复了在设置了 instance_groups 时，默认 instance_type 和 instance_count 被错误应用的问题\n- **JumpStart 替代配置解析**：解决了 JumpStart 模型的替代配置解析问题\n- **推理处理器命名更新**：将推理处理器标识从 'inf2' 更新为 'neuronx'\n- **HuggingFace Neuronx PyTorch 版本**：修正了 HuggingFace Neuronx 的 PyTorch 版本\n- **许可证添加**：为 sagemaker-mlops 和 sagemaker-serve 包添加了许可证","2026-03-03T06:50:22",{"id":180,"version":181,"summary_zh":182,"released_at":183},118065,"v3.4.1","### 修复\n- **管道**：修正管道创建中 Tag 类的使用 (#5526)\n- **ModelTrainer**：在超参数中支持 PipelineVariables (#5519)\n- **HyperparameterTuner**：包含 ModelTrainer 内部通道 (#5516)\n- **实验**：在非 Eureka GA 区域中，不对管道应用默认实验配置 (#5500)\n\n### 功能\n- **JumpStart**：新增对 ISO 区域的支持 (#5505)\n- **JumpStart**：新增版本 1.4 和 1.5 (#5538)\n\n### 杂项\n- 为 JumpStart 搜索功能添加了单元测试和集成测试 (#5544)\n- 从 CodeQL 工作流中移除 java-kotlin (#5517)","2026-02-11T03:31:12",{"id":185,"version":186,"summary_zh":187,"released_at":188},118066,"v2.257.0","## v2.257.0（2026-02-03）\n\n### 功能\n* 更新 DJL 0.36.0 版本的镜像 URI","2026-02-03T22:26:34",{"id":190,"version":191,"summary_zh":192,"released_at":193},118067,"v3.4.0","### 功能特性\n  - feat: 为 SageMaker Pipelines 添加 EMR-Serverless 步骤\n\n### Bug 修复及其他变更\n  - 在 ModelTrainer 中添加 Nova 配方训练支持\n  - 添加 Partner-app 身份提供商\n  - 默认为远程函数添加 SageMaker 依赖项 V3","2026-01-23T00:33:48",{"id":195,"version":196,"summary_zh":197,"released_at":198},118068,"v2.256.1","### 错误修复及其他更改\n* 修复远程函数的错误","2026-01-21T23:53:55",{"id":200,"version":201,"summary_zh":202,"released_at":203},118069,"v3.3.1","### 错误修复及其他更改\n * ProcessingJob 修复 - 在创建作业时移除 Processor 中的标签\n * 遥测更新\n * sagemaker-mlops 错误修复 - 将源代码中的 `dependencies` 参数更正为 `requirements`\n * aws_batch 错误修复 - 移除实验配置参数，因为该 Estimator 已弃用。\n\n","2026-01-13T04:33:21",{"id":205,"version":206,"summary_zh":207,"released_at":208},118070,"v2.256.0","### Features\r\n  - Image for Numpy 2.0 support with XGBoost\r\n\r\n### Bug fixes and Other Changes\r\n  - Bug fix for Triton Model server for inference\r\n  - Removal of hmac key parameter for remote function\r\n  - Bug fixes for input validation for local mode and resource management for iterators","2026-01-09T00:25:43",{"id":210,"version":211,"summary_zh":212,"released_at":213},118071,"v3.3.0","### Features\r\n  - AWS_Batch: queueing of training jobs with ModelTrainer\r\n\r\n### Bug fixes and Other Changes\r\n  - Fixes for model registry with ModelBuilder","2025-12-20T05:40:54",{"id":215,"version":216,"summary_zh":217,"released_at":218},118072,"v3.2.0","### Features\r\n  - Evaluator handshake with trainer\r\n  - Datasets Format validation\r\n\r\n### Bug fixes and Other Changes\r\n  - Add xgboost 3.0-5 to release\r\n  - Fix get_child_process_ids parsing issue","2025-12-20T05:38:55",{"id":220,"version":221,"summary_zh":222,"released_at":223},118073,"v3.1.1","### Bug fixes and Other Changes\r\n - Fine-tuning SDK: \r\n    - Add validation to bedrock reward models\r\n    - Hyperparameter issue fixes, Add validation s3 output path\r\n    - Fix the recipe selection for multiple recipe scenario\r\n    - Train wait() timeout exception handling\r\n    - Update example notebooks to reflect recent code changes","2025-12-11T20:13:10",{"id":225,"version":226,"summary_zh":227,"released_at":228},118074,"v3.1.0","# Model Fine-Tuning Support in SageMaker Python SDK V3\r\n\r\nWe’re excited to introduce comprehensive model fine-tuning capabilities in the SageMaker Python SDK V3, bringing state-of-the-art fine-tuning techniques to production ML workflows. Fine-tune foundation models with enterprise features including automated experiment tracking, serverless infrastructure, and integrated evaluation—all with just a few lines of code.\r\n\r\n## What's New\r\n\r\nThe SageMaker Python SDK V3 now includes four specialized Fine-Tuning Trainers for different fine-tuning techniques. Each trainer is optimized for specific use cases, following established research and industry best practices:\r\n\r\n### SFTTrainer  -  Supervised Fine-Tuning\r\n\r\nFine-tune models with labeled instruction-response pairs for task-specific adaptation.\r\n\r\n```python\r\nfrom sagemaker.train import SFTTrainer\r\nfrom sagemaker.train.common import TrainingType\r\n\r\ntrainer = SFTTrainer(\r\n    model=\"meta-llama\u002FLlama-2-7b-hf\",\r\n    training_type=TrainingType.LORA,\r\n    model_package_group_name=\"my-fine-tuned-models\",\r\n    training_dataset=\"s3:\u002F\u002Fbucket\u002Ftrain.jsonl\"\r\n)\r\n\r\ntraining_job = trainer.train()\r\n```\r\n\r\n### DPOTrainer - Direct Preference Optimization\r\n\r\nAlign models with human preferences using the DPO algorithm. Unlike traditional RLHF, DPO eliminates the need for a separate reward model, simplifying the alignment pipeline while achieving comparable results. Use cases : Preference alignment, safety tuning, style adaptation.\r\n\r\n```python\r\nfrom sagemaker.train import DPOTrainer\r\n\r\ntrainer = DPOTrainer(\r\n    model=\"meta-llama\u002FLlama-2-7b-hf\",\r\n    training_type=TrainingType.LORA,\r\n    model_package_group_name=\"my-dpo-models\",\r\n    training_dataset=\"s3:\u002F\u002Fbucket\u002Fpreference_data.jsonl\"\r\n)\r\n\r\ntraining_job = trainer.train()\r\n```\r\n\r\n### RLAIFTrainer - Reinforcement Learning from AI Feedback\r\n\r\nLeverage AI-generated feedback as reward signals using Amazon Bedrock models. RLAIF offers a scalable alternative to human feedback while maintaining quality.\r\n\r\n```python\r\nfrom sagemaker.train import RLAIFTrainer\r\n\r\ntrainer = RLAIFTrainer(\r\n    model=\"meta-llama\u002FLlama-2-7b-hf\",\r\n    training_type=TrainingType.LORA,\r\n    model_package_group_name=\"my-rlaif-models\",\r\n    reward_model_id=\"anthropic.claude-3-5-haiku-20241022-v1:0\",\r\n    reward_prompt=\"Builtin.Helpfulness\",\r\n    training_dataset=\"s3:\u002F\u002Fbucket\u002Frlaif_data.jsonl\"\r\n)\r\n\r\ntraining_job = trainer.train()\r\n```\r\n\r\n### RLVRTrainer - Reinforcement Learning from Verifiable Rewards\r\n\r\nTrain with custom, programmatic reward functions for domain-specific optimization. \r\n\r\n```python\r\nfrom sagemaker.train import RLVRTrainer\r\n\r\ntrainer = RLVRTrainer(\r\n    model=\"meta-llama\u002FLlama-2-7b-hf\",\r\n    training_type=TrainingType.LORA,\r\n    model_package_group_name=\"my-rlvr-models\",\r\n    custom_reward_function=\"arn:aws:sagemaker:region:account:hub-content\u002F...\u002Fevaluator\u002F1.0\",\r\n    training_dataset=\"s3:\u002F\u002Fbucket\u002Frlvr_data.jsonl\"\r\n)\r\n\r\ntraining_job = trainer.train()\r\n```\r\n\r\n## Key Features\r\n\r\nParameter-Efficient Fine-Tuning\r\n* LoRA (Low-Rank Adaptation): Default, memory-efficient approach\r\n* Full Fine-Tuning: Train all model parameters, for maximum performance\r\n\r\n### Built-in MLflow Integration\r\n\r\nAutomatic experiment tracking with intelligent defaults:\r\n* Auto-resolves MLflow tracking servers\r\n* Domain-aware server selection\r\n* Automatic experiment and run management\r\n* Provides ongoing visibility into performance and loss metrics during training\r\n\r\n### Dynamic Hyperparameter Management\r\n\r\nDiscover and customize training hyperparameters with built-in validation:\r\n\r\n```python\r\n# View available hyperparameters\r\ntrainer.hyperparameters.get_info()\r\n\r\n# Customize training\r\ntrainer.hyperparameters.learning_rate = 0.0001\r\ntrainer.hyperparameters.max_epochs = 3\r\ntrainer.hyperparameters.lora_alpha = 32\r\n```\r\n\r\n### Continued Fine-Tuning\r\n\r\nBuild on previously fine-tuned models for iterative improvement:\r\n\r\n```python\r\nfrom sagemaker.core.resources import ModelPackage\r\n\r\n# Use a previously fine-tuned model\r\nbase_model = ModelPackage.get(\r\n    model_package_name=\"arn:aws:sagemaker:region:account:model-package\u002F...\"\r\n)\r\n\r\ntrainer = SFTTrainer(\r\n    model=base_model,  # Continue from fine-tuned model\r\n    training_type=TrainingType.LORA,\r\n    model_package_group_name=\"my-models-v2\"\r\n)\r\n```\r\n\r\n### Flexible Dataset Support\r\n\r\nMultiple input formats with automatic validation:\r\n* S3 URIs: s3:\u002F\u002Fbucket\u002Fpath\u002Fdata.jsonl\r\n* SageMaker AI Registry Dataset ARNs\r\n* DataSet objects with validation\r\n\r\n### Serverless Training\r\n\r\nNo infrastructure management required—just specify your model and data:\r\n* Automatic compute provisioning \r\n* Managed training infrastructure\r\n* Pay only for training time\r\n\r\n### Enterprise-Ready\r\n\r\nProduction-ready security features:\r\n* VPC support for secure training\r\n* KMS encryption for outputs\r\n* IAM role management\r\n* EULA acceptance for gated models\r\n\r\n## Model Evaluation\r\n\r\nComprehensive evaluation framework with three evaluator types:\r\n* BenchMarkEvaluator: Stand","2025-12-03T23:50:38",{"id":230,"version":231,"summary_zh":232,"released_at":233},118075,"v2.255.0","## What's Changed\r\n- Extracts reward Lambda ARN from Nova recipes\r\n- Passes it as training job hyperparameter\r\n- Added LLMFT recipe support with standardized recipe handling\r\n- Enhanced recipe validation and multi-model type compatibility","2025-12-03T20:46:05",{"id":235,"version":236,"summary_zh":237,"released_at":238},118076,"v3.0.1","## What's Changed\r\n* Update pyproject.toml and prepare for v3.0.1 release by @zhaoqizqwang in https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fpull\u002F5329\r\n\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fcompare\u002Fv3.0.0...v3.0.1\r\n\r\n## Note\r\nThis release is created retroactively for code deployed on Thu Nov 20 2025\r\nAll changes listed below are already live in production.","2025-12-03T18:37:50",{"id":240,"version":241,"summary_zh":242,"released_at":243},118077,"v3.0.0","❗🔥 SageMaker V3 Release\r\nVersion 3.0.0 represents a significant milestone in our product's evolution. This major release introduces a modernized architecture, enhanced performance, and powerful new features while maintaining our commitment to user experience and reliability.\r\n\r\nImportant: Please review these breaking changes before upgrading.\r\n\r\nOlder interfaces such as Estimator, Model, Predictor and all their subclasses will not be supported in V3.\r\n\r\nPlease see our [V3 examples folder](https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Ftree\u002Fmaster\u002Fv3-examples) for example notebooks and usage patterns.\r\n\r\nMigrating to V3\r\nUpgrading to 3.x\r\nTo upgrade to the latest version of SageMaker Python SDK 3.x:\r\n\r\n```python\r\npip install --upgrade sagemaker\r\n```\r\n\r\nIf you prefer to downgrade to the 2.x version:\r\n\r\n```python\r\npip install sagemaker==2.*\r\n```\r\n\r\n\r\nSee [SageMaker V2 Examples](vscode-webview:\u002F\u002F094cfn4d2kfo8v2gnkat0e7pd3ojr81sctgm80mdoh9in8sm07u9\u002Findex.html?id=2cfff35f-7ac7-4e3b-b8de-eece3b622f66&parentId=6&origin=1cb6fd43-185c-40eb-b4ed-beb1fdbe934e&swVersion=4&extensionId=amazonwebservices.amazon-q-vscode&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app&purpose=webviewView#sagemaker-v2-examples) for V2 documentation and examples.\r\n\r\nKey Benefits of 3.x\r\n\r\nModular Architecture: Separate PyPI packages for core, training, and serving capabilities\r\n\r\n- [sagemaker-core](https:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-core\u002F)\r\n- [sagemaker-train](https:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-train\u002F)\r\n- [sagemaker-serve](https:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-serve\u002F)\r\n- [sagemaker-mlops](https:\u002F\u002Fpypi.org\u002Fproject\u002Fsagemaker-mlops\u002F)\r\n\r\nUnified Training & Inference: Single classes (ModelTrainer, ModelBuilder) replace multiple framework-specific classes\r\n\r\nObject-Oriented API: Structured interface with auto-generated configs aligned with AWS APIs\r\n\r\nSimplified Workflows: Reduced boilerplate and more intuitive interfaces\r\n\r\nTraining Experience\r\nV3 introduces the unified ModelTrainer class to reduce complexity of initial setup and deployment for model training. This replaces the V2 Estimator class and framework-specific classes (PyTorchEstimator, SKLearnEstimator, etc.).\r\n\r\nThis example shows how to train a model using a custom training container with training data from S3.\r\n\r\nSageMaker Python SDK 2.x:\r\n\r\n```python\r\nfrom sagemaker.estimator import Estimator\r\nestimator = Estimator(\r\n    image_uri=\"my-training-image\",\r\n    role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\",\r\n    instance_count=1,\r\n    instance_type=\"ml.m5.xlarge\",\r\n    output_path=\"s3:\u002F\u002Fmy-bucket\u002Foutput\"\r\n)\r\nestimator.fit({\"training\": \"s3:\u002F\u002Fmy-bucket\u002Ftrain\"})\r\n```\r\n\r\nSageMaker Python SDK 3.x:\r\n\r\n```python\r\nfrom sagemaker.train import ModelTrainer\r\nfrom sagemaker.train.configs import InputData\r\n\r\ntrainer = ModelTrainer(\r\n    training_image=\"my-training-image\",\r\n    role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\"\r\n)\r\n\r\ntrain_data = InputData(\r\n    channel_name=\"training\",\r\n    data_source=\"s3:\u002F\u002Fmy-bucket\u002Ftrain\"\r\n)\r\n\r\ntrainer.train(input_data_config=[train_data])\r\n```\r\n\r\nSee more examples: [SageMaker V3 Examples](vscode-webview:\u002F\u002F094cfn4d2kfo8v2gnkat0e7pd3ojr81sctgm80mdoh9in8sm07u9\u002Findex.html?id=2cfff35f-7ac7-4e3b-b8de-eece3b622f66&parentId=6&origin=1cb6fd43-185c-40eb-b4ed-beb1fdbe934e&swVersion=4&extensionId=amazonwebservices.amazon-q-vscode&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app&purpose=webviewView#sagemaker-v3-examples)\r\n\r\nInference Experience\r\nV3 introduces the unified ModelBuilder class for model deployment and inference. This replaces the V2 Model class and framework-specific classes (PyTorchModel, TensorFlowModel, SKLearnModel, XGBoostModel, etc.).\r\n\r\nThis example shows how to deploy a trained model for real-time inference.\r\n\r\nSageMaker Python SDK 2.x:\r\n\r\n```python\r\nfrom sagemaker.model import Model\r\nfrom sagemaker.predictor import Predictor\r\nmodel = Model(\r\n    image_uri=\"my-inference-image\",\r\n    model_data=\"s3:\u002F\u002Fmy-bucket\u002Fmodel.tar.gz\",\r\n    role=\"arn:aws:iam::123456789012:role\u002FSageMakerRole\"\r\n)\r\npredictor = model.deploy(\r\n    initial_instance_count=1,\r\n    instance_type=\"ml.m5.xlarge\"\r\n)\r\nresult = predictor.predict(data)\r\n```\r\n\r\nSageMaker Python SDK 3.x:\r\n\r\n```python\r\nfrom sagemaker.serve import ModelBuilder\r\nmodel_builder = ModelBuilder(\r\n    model=\"my-model\",\r\n    model_path=\"s3:\u002F\u002Fmy-bucket\u002Fmodel.tar.gz\"\r\n)\r\nendpoint = model_builder.build()\r\nresult = endpoint.invoke(...)\r\n```\r\n\r\nSee more examples: [SageMaker V3 Examples](vscode-webview:\u002F\u002F094cfn4d2kfo8v2gnkat0e7pd3ojr81sctgm80mdoh9in8sm07u9\u002Findex.html?id=2cfff35f-7ac7-4e3b-b8de-eece3b622f66&parentId=6&origin=1cb6fd43-185c-40eb-b4ed-beb1fdbe934e&swVersion=4&extensionId=amazonwebservices.amazon-q-vscode&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app&purpose=webviewView#sagemaker-v3-examples)\r\n\r","2025-12-03T18:11:07",{"id":245,"version":246,"summary_zh":247,"released_at":248},118078,"v2.254.1","### Bug Fixes and Other Changes\n\n * update get_execution_role to directly return the ExecutionRoleArn if it presents in the resource metadata file\n * [hf] HF PT Training DLCs","2025-10-31T02:54:28",{"id":250,"version":251,"summary_zh":252,"released_at":253},118079,"v2.254.0","### Features\n\n * Triton v25.09 DLC\n\n### Bug Fixes and Other Changes\n\n * Add Numpy 2.0 support\n * add HF Optimum Neuron DLCs\n * [Hugging Face][Pytorch] Inference DLC 4.51.3\n * [hf] HF Inference TGI","2025-10-29T15:23:11"]