目录

分布式和并行训练教程

创建时间:2022年10月04日 | 最后更新时间:2024年10月31日 | 最后验证时间:2024年11月05日

分布式训练是一种模型训练范式,它通过将训练任务分配到多个工作节点上,从而显著提高训练速度和模型准确性。虽然分布式训练可以用于任何类型的机器学习模型训练,但它在训练大型模型和计算密集型任务(如深度学习)时尤为有益。

你可以通过几种方式在 PyTorch 中进行分布式训练,每种方法在特定用例中都有其优势:

阅读更多关于这些选项的信息,请参阅 分布式概述

学习DDP

DDP 入门视频教程

一个逐步视频系列,介绍如何开始使用 DistributedDataParallel 并进阶到更复杂的主题

https://pytorch.org/tutorials/beginner/ddp_series_intro.html?utm_source=distr_landing&utm_medium=ddp_series_intro
使用分布式数据并行开始

本教程提供一个简短而温和的 PyTorch 分布式数据并行介绍。

https://pytorch.org/tutorials/intermediate/ddp_tutorial.html?utm_source=distr_landing&utm_medium=intermediate_ddp_tutorial
使用Join上下文管理器进行输入不均衡的分布式训练

本教程介绍了 Join 上下文管理器,并演示了其在分布式数据并行中的使用。

https://pytorch.org/tutorials/advanced/generic_join.html?utm_source=distr_landing&utm_medium=generic_join

学习FSDP

使用 FSDP 入门

本教程演示了如何在MNIST数据集上使用FSDP进行分布式训练。

https://pytorch.org/tutorials/intermediate/FSDP_tutorial.html?utm_source=distr_landing&utm_medium=FSDP_getting_started
FSDP 高级

在这个教程中,你将学习如何使用 FSDP 对 HuggingFace(HF)的 T5 模型进行微调,以实现文本摘要任务。

https://pytorch.org/tutorials/intermediate/FSDP_advanced_tutorial.html?utm_source=distr_landing&utm_medium=FSDP_advanced

学习张量并行(TP)

使用张量并行(TP)进行大规模 Transformer 模型训练

本教程演示了如何使用张量并行和完全分片数据并行,在数百到数千块 GPU 上训练一个大型类似 Transformer 的模型。

https://pytorch.org/tutorials/intermediate/TP_tutorial.html

学习DeviceMesh

使用DeviceMesh入门

在这个教程中,你将了解 DeviceMesh 以及它如何帮助进行分布式训练。

https://pytorch.org/tutorials/recipes/distributed_device_mesh.html?highlight=devicemesh

学习RPC

开始使用分布式 RPC 框架

本教程演示了如何开始使用基于 RPC 的分布式训练。

https://pytorch.org/tutorials/intermediate/rpc_tutorial.html?utm_source=distr_landing&utm_medium=rpc_getting_started
使用分布式 RPC 框架实现参数服务器

本教程将引导您通过一个简单的示例,使用 PyTorch 的分布式 RPC 框架实现参数服务器。

https://pytorch.org/tutorials/intermediate/rpc_param_server_tutorial.html?utm_source=distr_landing&utm_medium=rpc_param_server_tutorial
使用异步执行实现批量RPC处理

在这个教程中,你将使用 @rpc.functions.async_execution 装饰器构建批量处理的 RPC 应用程序。

https://pytorch.org/tutorials/intermediate/rpc_async_execution.html?utm_source=distr_landing&utm_medium=rpc_async_execution
将分布式数据并行与分布式 RPC 框架结合使用

在这个教程中,你将学习如何将分布式数据并行与分布式模型并行结合起来。

https://pytorch.org/tutorials/advanced/rpc_ddp_tutorial.html?utm_source=distr_landing&utm_medium=rpc_plus_ddp

自定义扩展

使用 Cpp 扩展自定义进程组后端

在这个教程中,你将学习如何实现一个自定义 ProcessGroup 后端,并将其插件到PyTorch分布式包中使用 cpp扩展。

https://pytorch.org/tutorials/intermediate/process_group_cpp_extension_tutorial.html?utm_source=distr_landing&utm_medium=custom_extensions_cpp

文档

访问 PyTorch 的全面开发人员文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并解答您的问题

查看资源