评价此页

分布式 (Distributed)#

分布式训练是一种模型训练范式,它将训练工作负载分散到多个工作节点上,从而显著提高训练速度和模型精度。虽然分布式训练可用于任何类型的机器学习模型训练,但它对于大型模型和深度学习等计算密集型任务最为有效。

在 PyTorch 中有几种执行分布式训练的方法,每种方法在特定的使用场景下都有其优势:

阅读分布式概述 (Distributed Overview)以了解有关这些选项的更多信息。

学习 DDP#

DDP 入门视频教程

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

https://pytorch.ac.cn/tutorials/beginner/ddp_series_intro.html?utm_source=distr_landing&utm_medium=ddp_series_intro
分布式数据并行入门

本教程提供了关于 PyTorch DistributedDataParallel 的简短且易懂的介绍。

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

本教程介绍了 Join 上下文管理器,并演示了其在 DistributedDataParallel 中的使用。

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

学习 FSDP2#

FSDP2 入门

本教程演示了如何使用 FSDP2 在 Transformer 模型上执行分布式训练

https://pytorch.ac.cn/tutorials/intermediate/FSDP_tutorial.html?utm_source=distr_landing&utm_medium=FSDP_getting_started

学习张量并行 (TP)#

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

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

https://pytorch.ac.cn/tutorials/intermediate/TP_tutorial.html

学习 DeviceMesh#

DeviceMesh 入门

在本教程中,您将了解 DeviceMesh 以及它如何助力分布式训练。

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

学习 RPC#

分布式 RPC 框架入门

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

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

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

https://pytorch.ac.cn/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.ac.cn/tutorials/intermediate/rpc_async_execution.html?utm_source=distr_landing&utm_medium=rpc_async_execution
结合 Distributed DataParallel 和分布式 RPC 框架

在本教程中,您将学习如何将分布式数据并行与分布式模型并行相结合。

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

学习 Monarch#

使用 Monarch 进行交互式分布式应用程序

学习如何使用 Monarch 的 Actor 框架

https://docs.pytorch.ac.cn/tutorials/intermediate/monarch_distributed_tutorial.html

自定义扩展#

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

在本教程中,您将学习如何实现一个自定义的 ProcessGroup 后端,并使用 C++ 扩展将其插入到 PyTorch 分布式包中。

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