• 教程 >
  • 分布式和并行训练教程
快捷方式

分布式和并行训练教程

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

分布式训练是一种模型训练范例,涉及将训练工作负载分散到多个工作节点上,从而显着提高训练速度和模型准确性。虽然分布式训练可用于任何类型的 ML 模型训练,但对于大型模型和计算密集型任务(如深度学习)使用它最有益。

您可以通过几种方式在 PyTorch 中执行分布式训练,每种方法在某些用例中都有其优势

分布式概述中阅读有关这些选项的更多信息。

学习 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

学习 FSDP

FSDP 入门

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

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

在本教程中,您将学习如何使用 FSDP 微调 HuggingFace (HF) T5 模型以进行文本摘要。

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

学习张量并行 (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
将分布式数据并行与分布式 RPC 框架相结合

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

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

自定义扩展

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

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

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

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

获取针对初学者和高级开发者的深入教程

查看教程

资源

查找开发资源并获得问题解答

查看资源