Skip to content

Commit

Permalink
[xdoctest] reformat example code with google style cleanup_20231102 c…
Browse files Browse the repository at this point in the history
…ommit d144f5c (#58617)
  • Loading branch information
megemini authored Nov 3, 2023
1 parent 5cb08af commit 5dc7e01
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
31 changes: 18 additions & 13 deletions python/paddle/distributed/fleet/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,10 +1240,10 @@ def _set_fea_eval(self, record_candidate_size, fea_eval=True):
Examples:
.. code-block:: python
import paddle
paddle.enable_static()
dataset = paddle.distributed.InMemoryDataset()
dataset._set_fea_eval(1000000, True)
>>> import paddle
>>> paddle.enable_static()
>>> dataset = paddle.distributed.InMemoryDataset()
>>> dataset._set_fea_eval(1000000, True)
"""
if fea_eval:
Expand Down Expand Up @@ -1299,11 +1299,10 @@ class QueueDataset(DatasetBase):
QueueDataset, it will process data streamly.
Examples:
.. code-block:: python
.. code-block:: python
import paddle
dataset = paddle.distributed.QueueDataset()
>>> import paddle
>>> dataset = paddle.distributed.QueueDataset()
"""

Expand Down Expand Up @@ -1510,6 +1509,7 @@ def end_pass(self, need_save_delta):
"""
End Pass
Notify BoxPS that current pass ended
Examples:
.. code-block:: python
Expand All @@ -1523,6 +1523,7 @@ def wait_preload_done(self):
"""
Wait async preload done
Wait Until Feed Pass Done
Examples:
.. code-block:: python
Expand All @@ -1539,6 +1540,7 @@ def wait_preload_done(self):
def load_into_memory(self):
"""
Load next pass into memory and notify boxps to fetch its emb from SSD
Examples:
.. code-block:: python
Expand All @@ -1555,6 +1557,7 @@ def load_into_memory(self):
def preload_into_memory(self):
"""
Begin async preload next pass while current pass may be training
Examples:
.. code-block:: python
Expand Down Expand Up @@ -1588,11 +1591,13 @@ def slots_shuffle(self, slots):
slots(list[string]): the set of slots(string) to do slots shuffle.
Examples:
import paddle
dataset = paddle.distributed.fleet.BoxPSDataset()
dataset.set_merge_by_lineid()
#suppose there is a slot 0
dataset.slots_shuffle(['0'])
.. code-block:: python
>>> import paddle
>>> dataset = paddle.distributed.fleet.BoxPSDataset()
>>> dataset._set_merge_by_lineid()
>>> #suppose there is a slot 0
>>> dataset.slots_shuffle(['0'])
"""
slots_set = set(slots)
self.boxps.slots_shuffle(slots_set)
Expand Down
10 changes: 5 additions & 5 deletions python/paddle/distributed/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,13 +857,13 @@ def pg_timeout(self):
Its value is equal to the value of the environment variable ``PADDLE_PG_TIMEOUT`` . The default value is 30 minutes.
Examples:
.. code-block:: python
.. code-block:: python
# execute this command in terminal: export PADDLE_PG_TIMEOUT=1800000
import paddle.distributed as dist
>>> # execute this command in terminal: export PADDLE_PG_TIMEOUT=1800000
>>> import paddle.distributed as dist
env = dist.ParallelEnv()
# the pg_timeout of process group 1800000
>>> env = dist.ParallelEnv()
>>> # the pg_timeout of process group 1800000
"""
return self._pg_timeout

Expand Down

0 comments on commit 5dc7e01

Please sign in to comment.