data07_09.yaml 4.9 KB
Newer Older
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
1
- en: DataLoader2 Tutorial
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
2
  id: totrans-0
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
3 4 5
  prefs:
  - PREF_H1
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
6
  zh: DataLoader2教程
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
7
- en: 原文:[https://pytorch.org/data/beta/dlv2_tutorial.html](https://pytorch.org/data/beta/dlv2_tutorial.html)
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
8
  id: totrans-1
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
9 10 11
  prefs:
  - PREF_BQ
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
12
  zh: 原文:[https://pytorch.org/data/beta/dlv2_tutorial.html](https://pytorch.org/data/beta/dlv2_tutorial.html)
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
13 14 15
- en: This is the tutorial for users to create a `DataPipe` graph and load data via
    `DataLoader2` with different backend systems (`ReadingService`). An usage example
    can be found in [this colab notebook](https://colab.research.google.com/drive/1eSvp-eUDYPj0Sd0X_Mv9s9VkE8RNDg1u).
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
16
  id: totrans-2
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
17 18
  prefs: []
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
19
  zh: 这是用户创建`DataPipe`图并通过不同后端系统(`ReadingService`)加载数据的教程。可以在[此colab笔记本](https://colab.research.google.com/drive/1eSvp-eUDYPj0Sd0X_Mv9s9VkE8RNDg1u)中找到一个使用示例。
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
20
- en: DataPipe[](#datapipe "Permalink to this heading")
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
21
  id: totrans-3
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
22 23 24
  prefs:
  - PREF_H2
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
25
  zh: DataPipe
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
26 27 28
- en: 'Please refer to [DataPipe Tutorial](dp_tutorial.html) for more details. Here
    are the most important caveats necessary: to make sure the data pipeline has different
    order per epoch and data shards are mutually exclusive and collectively exhaustive:'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
29
  id: totrans-4
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
30 31
  prefs: []
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
32
  zh: 有关更多详细信息,请参阅[DataPipe教程](dp_tutorial.html)。以下是必要的最重要注意事项:确保数据管道每个时期具有不同的顺序,并且数据分片是互斥且完全穷尽的。
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
33 34 35
- en: Place `sharding_filter` or `sharding_round_robin_dispatch` as early as possible
    in the pipeline to avoid repeating expensive operations in worker/distributed
    processes.
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
36
  id: totrans-5
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
37 38 39
  prefs:
  - PREF_UL
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
40
  zh: 尽早在管道中放置`sharding_filter`或`sharding_round_robin_dispatch`,以避免在工作/分布式进程中重复昂贵的操作。
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
41 42 43 44
- en: Add a `shuffle` DataPipe before sharding to achieve inter-shard shuffling. `ReadingService`
    will handle synchronization of those `shuffle` operations to ensure the order
    of data are the same before sharding so that all shards are mutually exclusive
    and collectively exhaustive.
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
45
  id: totrans-6
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
46 47 48
  prefs:
  - PREF_UL
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
49
  zh: 在分片之前添加一个`shuffle` DataPipe以实现分片间的洗牌。`ReadingService`将处理这些`shuffle`操作的同步,以确保在分片之前数据的顺序相同,以使所有分片互斥且完全穷尽。
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
50
- en: 'Here is an example of a `DataPipe` graph:'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
51
  id: totrans-7
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
52 53
  prefs: []
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
54
  zh: 以下是一个`DataPipe`图的示例:
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
55
- en: '[PRE0]'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
56
  id: totrans-8
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
57 58
  prefs: []
  type: TYPE_PRE
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
59
  zh: '[PRE0]'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
60
- en: Multiprocessing[](#multiprocessing "Permalink to this heading")
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
61
  id: totrans-9
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
62 63 64
  prefs:
  - PREF_H2
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
65
  zh: 多进程
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
66 67
- en: '`MultiProcessingReadingService` handles multiprocessing sharding at the point
    of `sharding_filter` and synchronizes the seeds across worker processes.'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
68
  id: totrans-10
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
69 70
  prefs: []
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
71
  zh: '`MultiProcessingReadingService` 在`sharding_filter`点处理多进程分片,并在工作进程之间同步种子。'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
72
- en: '[PRE1]'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
73
  id: totrans-11
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
74 75
  prefs: []
  type: TYPE_PRE
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
76
  zh: '[PRE1]'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
77
- en: Distributed[](#distributed "Permalink to this heading")
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
78
  id: totrans-12
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
79 80 81
  prefs:
  - PREF_H2
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
82
  zh: 分布式
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
83 84 85 86 87
- en: '`DistributedReadingService` handles distributed sharding at the point of `sharding_filter`
    and synchronizes the seeds across distributed processes. And, in order to balance
    the data shards across distributed nodes, a `fullsync` `DataPipe` will be attached
    to the `DataPipe` graph to align the number of batches across distributed ranks.
    This would prevent hanging issue caused by uneven shards in distributed training.'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
88
  id: totrans-13
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
89 90
  prefs: []
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
91 92
  zh: '`DistributedReadingService` 在`sharding_filter`点处理分布式分片,并在分布式进程之间同步种子。为了平衡分布式节点之间的数据分片,将在`DataPipe`图中附加一个`fullsync`
    `DataPipe`,以使分布式排名之间的批次数量保持一致。这将防止分布式训练中由不均匀分片引起的挂起问题。'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
93
- en: '[PRE2]'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
94
  id: totrans-14
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
95 96
  prefs: []
  type: TYPE_PRE
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
97 98 99 100
  zh: '[PRE2]'
- en: Multiprocessing + Distributed[](#multiprocessing-distributed "Permalink to this
    heading")
  id: totrans-15
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
101 102 103
  prefs:
  - PREF_H2
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
104
  zh: 多进程+分布式
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
105 106
- en: '`SequentialReadingService` can be used to combine both `ReadingServices` together
    to achieve multiprocessing and distributed training at the same time.'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
107
  id: totrans-16
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
108 109
  prefs: []
  type: TYPE_NORMAL
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
110
  zh: '`SequentialReadingService`可用于将两个`ReadingServices`组合在一起,以同时实现多进程和分布式训练。'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
111
- en: '[PRE3]'
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
112
  id: totrans-17
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
113 114
  prefs: []
  type: TYPE_PRE
绝不原创的飞龙's avatar
绝不原创的飞龙 已提交
115
  zh: '[PRE3]'