diff --git a/README.md b/README.md index a09b844..967fb9a 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,99 @@ + +> [!NOTE] +> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 +> [English](./README.en.md) · [原始项目](https://github.com/aws/amazon-sagemaker-examples) · [上游 README](https://github.com/aws/amazon-sagemaker-examples/blob/HEAD/README.md) +> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。 + ![SageMaker](https://github.com/aws/amazon-sagemaker-examples/raw/main/_static/sagemaker-banner.png) -# :exclamation::fire: Announcing SageMaker-Core: A New Python SDK for Amazon SageMaker :fire::exclamation: +# :exclamation::fire: 宣布 SageMaker-Core:全新的 Amazon SageMaker Python SDK :fire::exclamation: -## Introduction -Today, Amazon SageMaker is excited to announce the release of SageMaker-Core, a new Python SDK that provides an object-oriented interface for interacting with SageMaker resources such as TrainingJob, Model, and Endpoint. This SDK introduces the resource chaining feature, allowing developers to pass resource objects as parameters, eliminating manual parameter specification and simplifying code management. SageMaker-Core abstracts low-level details like resource state transitions and polling logic, achieving full parity with SageMaker APIs. It also includes usability improvements such as auto code completion, comprehensive documentation, and type hints, enhancing the overall developer experience. +## 简介 +今日,Amazon SageMaker 激动地宣布发布 SageMaker-Core,这是一款全新的 Python SDK,为与 SageMaker 资源(如 TrainingJob、Model 和 Endpoint)交互提供面向对象(object-oriented)接口。该 SDK 引入了资源链式传递(resource chaining)特性,允许开发者将资源对象作为参数传递,从而免去手动指定参数,简化代码管理。SageMaker-Core 抽象了资源状态转换和轮询逻辑等底层细节,实现了与 SageMaker API 的完全对等。它还包含自动代码补全、完善文档和类型提示(type hints)等可用性改进,提升了整体开发者体验。 -## Use Case -SageMaker-Core is ideal for ML practitioners who seek full customization of AWS primitives for their ML workloads. SageMaker-Core is an improvement over Boto3, providing a more intuitive and efficient way to manage SageMaker resources. By providing an intuitive object-oriented interface and resource chaining, the SDK allows for seamless integration and management of SageMaker resources. This flexibility, combined with intelligent defaults enables developers to tailor their ML workloads according to their needs. Comprehensive documentation, and type hints help developers write code faster and with fewer errors without navigating complex API documentation. +## 使用场景 +SageMaker-Core 非常适合希望对 ML 工作负载中的 AWS 原语进行充分定制的 ML 从业者。相较于 Boto3,SageMaker-Core 提供了更直观、更高效的方式来管理 SageMaker 资源。通过提供直观的面向对象接口和资源链式传递,该 SDK 可实现 SageMaker 资源的无缝集成与管理。这种灵活性,结合智能默认值,使开发者能够根据自身需求定制 ML 工作负载。完善的文档和类型提示可帮助开发者更快地编写代码、减少错误,而无需翻阅复杂的 API 文档。 -## Call to Action -To learn more about SageMaker-Core, visit the [documentation](https://sagemaker-core.readthedocs.io) and [example notebooks](https://github.com/aws/amazon-sagemaker-examples/tree/default/sagemaker-core). Get started today by integrating SageMaker-Core into your machine learning workflows and experience the benefits of a streamlined and efficient development process. +## 行动号召 +要了解更多关于 SageMaker-Core 的信息,请访问 [文档](https://sagemaker-core.readthedocs.io) 和 [示例笔记本](https://github.com/aws/amazon-sagemaker-examples/tree/default/sagemaker-core). 立即开始将 SageMaker-Core 集成到您的机器学习工作流中,体验精简高效的开发流程带来的好处。 -# Amazon SageMaker Examples +# Amazon SageMaker 示例 -Example Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using Amazon SageMaker. +演示如何使用 Amazon SageMaker 构建、训练和部署机器学习模型的 Jupyter 示例笔记本。 -## :books: Read this before you proceed further +## :books: 继续之前请先阅读 -Amazon SageMaker examples are divided in two repositories: +Amazon SageMaker 示例分为两个代码库: -- [SageMaker example notebooks](https://github.com/aws/amazon-sagemaker-examples) is the official repository, containing examples that demonstrate the usage of Amazon SageMaker. This repository is entirely focussed on covering the breadth of features provided by SageMaker, and is maintained directly by the Amazon SageMaker team. +- [SageMaker 示例笔记本](https://github.com/aws/amazon-sagemaker-examples) 是官方代码库,包含演示 Amazon SageMaker 使用方法的示例。该代码库完全专注于覆盖 SageMaker 提供的各项功能的广度,并由 Amazon SageMaker 团队直接维护。 -- [Sagemaker Example Community repository](https://github.com/aws/amazon-sagemaker-examples-community) is another SageMaker repository which contains additional examples and reference solutions, beyond the examples showcased in the [official repository](https://github.com/aws/amazon-sagemaker-examples). This repository is maintained by community of engineers and solution architects at AWS. +- [Sagemaker 示例社区代码库](https://github.com/aws/amazon-sagemaker-examples-community) 是另一个 SageMaker 代码库,包含[官方代码库](https://github.com/aws/amazon-sagemaker-examples). 中展示示例之外的额外示例和参考解决方案。该代码库由 AWS 的工程师和解决方案架构师社区维护。 -## Planning to submit a PR to this repository? Read this first: +## 计划向本代码库提交 PR?请先阅读: -- This repository will only accept notebooks/examples which demonstrate a feature of SageMaker, not yet covered anywhere in this repository. PR submitters are requested to check this before submitting the PR to avoid getting it rejected. +- 本代码库仅接受演示 SageMaker 功能、且本代码库中尚未涵盖的笔记本/示例。建议 PR 提交者在提交 PR 前进行核实,以避免被拒绝。 -- If you still would like to contribute your example, please submit a PR to [Sagemaker Example Community repository](https://github.com/aws/amazon-sagemaker-examples-community) instead. +- 如果您仍希望贡献您的示例,请改为向 [Sagemaker 示例社区代码库](https://github.com/aws/amazon-sagemaker-examples-community) 提交 PR。 -## :hammer_and_wrench: Setup +## :hammer_and_wrench: 设置 -The quickest setup to run example notebooks includes: +运行示例笔记本最快捷的设置包括: -- An [AWS account](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-account.html) -- Proper [IAM User and Role](http://docs.aws.amazon.com/sagemaker/latest/dg/authentication-and-access-control.html) setup -- An [Amazon SageMaker Notebook Instance](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-setup-working-env.html) -- An [S3 bucket](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-config-permissions.html) +- [AWS 账户](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-account.html) +- 正确配置的 [IAM 用户和角色](http://docs.aws.amazon.com/sagemaker/latest/dg/authentication-and-access-control.html) +- [Amazon SageMaker 笔记本实例](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-setup-working-env.html) +- [S3 存储桶](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-config-permissions.html) -## :computer: Usage +## :computer: 用法 -These example notebooks are automatically loaded into SageMaker Notebook Instances. -They can be accessed by clicking on the `SageMaker Examples` tab in Jupyter or the SageMaker logo in JupyterLab. +这些示例笔记本会自动加载到 SageMaker 笔记本实例中。 +可通过在 Jupyter 中点击 `SageMaker Examples` 选项卡,或在 JupyterLab 中点击 SageMaker 徽标来访问它们。 -Although most examples utilize key Amazon SageMaker functionality like distributed, managed training or real-time hosted endpoints, these notebooks can be run outside of Amazon SageMaker Notebook Instances with minimal modification (updating IAM role definition and installing the necessary libraries). +尽管大多数示例使用了 Amazon SageMaker 的核心功能(如分布式托管训练或实时托管终端节点),这些笔记本也可以在 Amazon SageMaker 笔记本实例外运行,只需做少量修改(更新 IAM 角色定义并安装必要的库)。 -## :notebook: Example Notebook Categories +## :notebook: 示例笔记本分类 -### End-to-End ML Lifecycle +### 端到端 ML 生命周期 -These examples are a diverse collection of end-to-end notebooks that demonstrate how to build, train, and deploy machine learning models using Amazon SageMaker. These notebooks cover a wide range of machine learning tasks and use cases, providing you with a comprehensive understanding of the SageMaker workflow. Each notebook in this folder is self-contained and includes detailed documentation, code samples, and instructions for running the examples on SageMaker. Whether you're a beginner or an experienced practitioner, this folder offers a comprehensive collection of end-to-end notebooks that will help you leverage the power of Amazon SageMaker for a wide range of machine learning tasks and use cases. +这些示例是多样化的端到端笔记本集合,演示如何使用 Amazon SageMaker 构建、训练和部署机器学习模型。这些笔记本涵盖广泛的机器学习任务和用例,帮助您全面理解 SageMaker 工作流。该文件夹中的每个笔记本都是自包含的,并包含详细文档、代码示例以及在 SageMaker 上运行示例的说明。无论您是初学者还是有经验的从业者,该文件夹都提供了全面的端到端笔记本集合,帮助您利用 Amazon SageMaker 的强大能力应对广泛的机器学习任务和用例。 -### Prepare Data +### 准备数据 -The example notebooks within this folder showcase Sagemaker's data preparation capabilities. Data preparation in machine learning refers to the process of collecting, preprocessing, and organizing raw data to make it suitable for analysis and modeling. This step ensures that the data is in a format from which machine learning algorithms can effectively learn. Data preparation tasks may include handling missing values, removing outliers, scaling features, encoding categorical variables, assessing potential biases and taking steps to mitigate them, splitting data into training and testing sets, labeling, and other necessary transformations to optimize the quality and usability of the data for subsequent machine learning tasks. +该文件夹中的示例笔记本展示了 SageMaker 的数据准备能力。机器学习中的数据准备是指收集、预处理和整理原始数据,使其适合分析和建模的过程。此步骤确保数据格式能让机器学习算法有效学习。数据准备任务可能包括处理缺失值、移除异常值、缩放特征、编码分类变量、评估潜在偏差并采取措施减轻它们、将数据拆分为训练集和测试集、标注,以及其他必要的转换,以优化数据在后续机器学习任务中的质量和可用性。 -### Build and Train Models +### 构建和训练模型 -Amazon SageMaker Training is a fully managed machine learning (ML) service offered by SageMaker that helps you efficiently build and train a wide range of ML models at scale. The core of SageMaker jobs is the containerization of ML workloads and the capability of managing AWS compute resources. The SageMaker Training platform takes care of the heavy lifting associated with setting up and managing infrastructure for ML training workloads. With SageMaker Training, you can focus on building, developing, training, and fine-tuning your model. +Amazon SageMaker Training 是 SageMaker 提供的完全托管机器学习(ML)服务,帮助您高效地大规模构建和训练各类 ML 模型。SageMaker 作业的核心在于 ML 工作负载的容器化以及管理 AWS 计算资源的能力。SageMaker Training 平台负责 ML 训练工作负载相关基础设施的设置与管理的繁重工作。借助 SageMaker Training,您可以专注于构建、开发、训练和微调模型。 -### Deploy and Monitor +### 部署和监控 -With Amazon SageMaker, you can start getting predictions, or inferences, from your trained machine learning models. SageMaker provides a broad selection of ML infrastructure and model deployment options to help meet all your ML inference needs. With SageMaker Inference, you can scale your model deployment, manage models more effectively in production, and reduce operational burden. SageMaker provides you with various inference options, such as real-time endpoints for getting low latency inference, serverless endpoints for fully managed infrastructure and auto-scaling, and asynchronous endpoints for batches of requests. By leveraging the appropriate inference option for your use case, you can ensure efficient and model deployment and inference. +借助 Amazon SageMaker,您可以开始从已训练的机器学习模型获取预测或推理结果。SageMaker 提供广泛的 ML 基础设施和模型部署选项,以满足您的各类 ML 推理需求。通过 SageMaker Inference,您可以扩展模型部署规模、更有效地管理生产环境中的模型,并降低运维负担。SageMaker 为您提供多种推理选项,例如用于低延迟推理的实时终端节点(real-time endpoints)、提供完全托管基础设施和自动扩展的无服务器终端节点(serverless endpoints),以及用于批量请求的异步终端节点(asynchronous endpoints)。根据您的用例选择合适的推理选项,可确保高效的模型部署与推理。 -After you deploy a model into your production environment, use Amazon SageMaker model monitor to continuously monitor the quality of your machine learning models in real time. Amazon SageMaker model monitor enables you to set up an automated alert triggering system when there are deviations in the model quality, such as data drift and anomalies. Amazon CloudWatch Logs collects log files of monitoring the model status and notifies when the quality of your model hits certain thresholds that you preset. CloudWatch stores the log files to an Amazon S3 bucket you specify. Early and pro-active detection of model deviations through AWS model monitor products enables you to take prompt actions to maintain and improve the quality of your deployed model. +将模型部署到生产环境后,可使用 Amazon SageMaker model monitor 实时监控机器学习模型的质量。Amazon SageMaker model monitor 使您能够在模型质量出现偏差(如数据漂移和异常)时设置自动警报触发系统。Amazon CloudWatch Logs 收集监控模型状态的日志文件,并在模型质量达到您预设的阈值时发出通知。CloudWatch 将日志文件存储到您指定的 Amazon S3 存储桶中。通过 AWS model monitor 产品及早、主动地检测模型偏差,使您能够及时采取行动,维持并改进已部署模型的质量。 -### Generative AI +### 生成式 AI(Generative AI) -These examples showcases Amazon SageMaker's capabilities in the exciting field of generative artificial intelligence (AI). Generative AI models are designed to create new, synthetic data across various modalities, such as text, images, audio, and video, based on the patterns and relationships learned from training data. These examples provide detailed documentation, code samples, and instructions for running the generative AI models on SageMaker. And demonstrate how to preprocess data, train models, fine-tune hyperparameters, and deploy the trained models for inference. +这些示例展示了 Amazon SageMaker 在激动人心的生成式人工智能(AI)领域的强大能力。生成式 AI 模型旨在基于从训练数据中学到的模式与关系,创建跨文本、图像、音频、视频等多种模态的全新合成数据。这些示例提供了详细文档、代码示例以及在 SageMaker 上运行生成式 AI 模型的操作说明,并演示如何预处理数据、训练模型、微调超参数,以及部署训练好的模型用于推理。 -Whether you're interested in exploring the latest advancements in generative AI, or seeking to leverage these techniques for creative applications or content generation, this folder offers a comprehensive collection of examples that will help you unlock the power of SageMaker's generative AI capabilities and push the boundaries of what's possible with machine learning. +无论您是想探索生成式 AI 的最新进展,还是希望将这些技术用于创意应用或内容生成,本文件夹都提供了一套全面的示例,帮助您释放 SageMaker 生成式 AI 能力的潜力,并突破机器学习所能实现的边界。 -### ML Ops +### ML Ops(机器学习运维) -Amazon SageMaker supports features to implement machine learning models in production environments with continuous integration and deployment. MLOps accounts for the unique aspects of AI/ML projects in project management, CI/CD, and quality assurance, helping you improve delivery time, reduce defects, and make data science more productive. MLOps refers to a methodology that is built on applying DevOps practices to machine learning workloads. +Amazon SageMaker 支持多种功能,可在生产环境中通过持续集成与部署来落地机器学习模型。MLOps(机器学习运维)在项目管理和 CI/CD、质量保证等方面充分考虑 AI/ML 项目的独特需求,帮助您缩短交付周期、减少缺陷,并提升数据科学团队的生产力。MLOps 是一种将 DevOps 实践应用于机器学习工作负载的方法论。 -### Responsible AI +### 负责任 AI(Responsible AI) -Amazon SageMaker offers features to improve your machine learning (ML) models by detecting potential bias and helping to explain the predictions that your models make from your tabular, computer vision, natural processing, or time series datasets. It helps you identify various types of bias in pre-training data and in post-training that can emerge during model training or when the model is in production. You can also evaluate a language model for model quality and responsibility metrics using foundation model evaluations. +Amazon SageMaker 提供多种功能,可通过检测潜在偏见并帮助解释模型对表格、计算机视觉、自然处理或时间序列数据集的预测结果,从而改进您的机器学习(ML)模型。它可帮助您识别预训练数据和训练后阶段可能出现的各类偏见,这些偏见可能在模型训练期间或模型投入生产后出现。您还可以使用基础模型评估(foundation model evaluations)来评估语言模型的模型质量与负责任指标。 -Model governance is a framework that gives systematic visibility into machine learning (ML) model development, validation, and usage. Amazon SageMaker provides purpose-built ML governance tools for managing control access, activity tracking, and reporting across the ML lifecycle. Manage least-privilege permissions for ML practitioners using Amazon SageMaker Role Manager, create detailed model documentation using Amazon SageMaker Model Cards, and gain visibility into your models with centralized dashboards using Amazon SageMaker Model Dashboard. +模型治理(model governance)是一套框架,可对机器学习(ML)模型的开发、验证和使用提供系统性的可见性。Amazon SageMaker 提供专为 ML 治理打造的工具,用于在 ML 生命周期中管理访问控制、活动跟踪和报告。使用 Amazon SageMaker Role Manager 为 ML 从业者管理最小权限,使用 Amazon SageMaker Model Cards 创建详细的模型文档,并通过 Amazon SageMaker Model Dashboard 的集中式仪表板全面了解您的模型。 -## :balance_scale: License +## :balance_scale: 许可证 -This library is licensed under the [Apache 2.0 License](http://aws.amazon.com/apache2.0/). -For more details, please take a look at the [LICENSE](https://github.com/aws/amazon-sagemaker-examples/blob/master/LICENSE.txt) file. +本库依据 [Apache 2.0 License](http://aws.amazon.com/apache2.0/). +更多详情,请参阅 [LICENSE](https://github.com/aws/amazon-sagemaker-examples/blob/master/LICENSE.txt) file. -## :handshake: Contributing +## :handshake: 贡献 -Although we're extremely excited to receive contributions from the community, we're still working on the best mechanism to take in examples from external sources. Please bear with us in the short-term if pull requests take longer than expected or are closed. -Please read our [contributing guidelines](https://github.com/aws/amazon-sagemaker-examples/blob/default/CONTRIBUTING.md) -if you'd like to open an issue or submit a pull request. +尽管我们非常期待收到来自社区的贡献,但我们仍在完善接收外部来源示例的最佳机制。若拉取请求耗时超出预期或被关闭,还请短期内涵忍理解。 +如果您想提交 issue 或拉取请求,请阅读我们的[贡献指南](https://github.com/aws/amazon-sagemaker-examples/blob/default/CONTRIBUTING.md)