From 0d947cf3f928c1906ed9ae6c8a5475e10e09e08e Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 21 Jun 2023 17:49:07 +0200 Subject: [PATCH 1/7] docs: include external pages --- .../accelerators/ipu_advanced.rst | 144 ------------------ .../source-pytorch/accelerators/ipu_basic.rst | 72 --------- .../accelerators/ipu_intermediate.rst | 65 -------- docs/source-pytorch/common/index.rst | 4 +- docs/source-pytorch/common_usecases.rst | 2 +- docs/source-pytorch/conf.py | 5 + .../source-pytorch/extensions/accelerator.rst | 2 +- docs/source-pytorch/extensions/strategy.rst | 2 +- docs/source-pytorch/glossary/index.rst | 4 +- .../ipu.rst => integrations/ipu/index.rst} | 0 .../levels/advanced_level_19.rst | 4 +- 11 files changed, 14 insertions(+), 290 deletions(-) delete mode 100644 docs/source-pytorch/accelerators/ipu_advanced.rst delete mode 100644 docs/source-pytorch/accelerators/ipu_basic.rst delete mode 100644 docs/source-pytorch/accelerators/ipu_intermediate.rst rename docs/source-pytorch/{accelerators/ipu.rst => integrations/ipu/index.rst} (100%) diff --git a/docs/source-pytorch/accelerators/ipu_advanced.rst b/docs/source-pytorch/accelerators/ipu_advanced.rst deleted file mode 100644 index 98c1de58258f7..0000000000000 --- a/docs/source-pytorch/accelerators/ipu_advanced.rst +++ /dev/null @@ -1,144 +0,0 @@ -:orphan: - -.. _ipu_advanced: - -Accelerator: IPU training -========================= -**Audience:** Users looking to customize IPU training for massive models. - -.. warning:: This is an :ref:`experimental ` feature. - ----- - -Advanced IPU options --------------------- - -IPUs provide further optimizations to speed up training. By using the ``IPUStrategy`` we can set the ``device_iterations``, which controls the number of iterations run directly on the IPU devices before returning to the host. Increasing the number of on-device iterations will improve throughput, as there is less device to host communication required. - -.. note:: - - When using model parallelism, it is a hard requirement to increase the number of device iterations to ensure we fully saturate the devices via micro-batching. see :ref:`ipu-model-parallelism` for more information. - -.. code-block:: python - - import lightning.pytorch as pl - from lightning_graphcore import IPUStrategy - - model = MyLightningModule() - trainer = pl.Trainer(accelerator="ipu", devices=8, strategy=IPUStrategy(device_iterations=32)) - trainer.fit(model) - -Note that by default we return the last device iteration loss. You can override this by passing in your own ``poptorch.Options`` and setting the AnchorMode as described in the `PopTorch documentation `__. - -.. code-block:: python - - import poptorch - import lightning.pytorch as pl - from lightning_graphcore import IPUStrategy - - model = MyLightningModule() - inference_opts = poptorch.Options() - inference_opts.deviceIterations(32) - - training_opts = poptorch.Options() - training_opts.anchorMode(poptorch.AnchorMode.All) - training_opts.deviceIterations(32) - - trainer = Trainer( - accelerator="ipu", devices=8, strategy=IPUStrategy(inference_opts=inference_opts, training_opts=training_opts) - ) - trainer.fit(model) - -You can also override all options by passing the ``poptorch.Options`` to the plugin. See `PopTorch options documentation `__ for more information. - ----- - -.. _ipu-model-parallelism: - -Model parallelism ------------------ - -Due to the IPU architecture, larger models should be parallelized across IPUs by design. Currently PopTorch provides the capabilities via annotations as described in `parallel execution strategies `__. - -Below is an example using the block annotation in a LightningModule. - -.. note:: - - Currently, when using model parallelism we do not infer the number of IPUs required for you. This is done via the annotations themselves. If you specify 4 different IDs when defining Blocks, this means your model will be split onto 4 different IPUs. - - This is also mutually exclusive with the Trainer flag. In other words, if your model is split onto 2 IPUs and you set ``Trainer(accelerator="ipu", devices=4)`` this will require 8 IPUs in total: data parallelism will be used to replicate the two-IPU model 4 times. - - When pipelining the model you must also increase the `device_iterations` to ensure full data saturation of the devices data, i.e whilst one device in the model pipeline processes a batch of data, the other device can start on the next batch. For example if the model is split onto 4 IPUs, we require `device_iterations` to be at-least 4. - - -.. code-block:: python - - import lightning.pytorch as pl - import poptorch - - - class MyLightningModule(pl.LightningModule): - def __init__(self): - super().__init__() - # This will place layer1, layer2+layer3, layer4, softmax on different IPUs at runtime. - # BeginBlock will start a new id for all layers within this block - self.layer1 = poptorch.BeginBlock(torch.nn.Linear(5, 10), ipu_id=0) - - # This layer starts a new block, - # adding subsequent layers to this current block at runtime - # till the next block has been declared - self.layer2 = poptorch.BeginBlock(torch.nn.Linear(10, 5), ipu_id=1) - self.layer3 = torch.nn.Linear(5, 5) - - # Create new blocks - self.layer4 = poptorch.BeginBlock(torch.nn.Linear(5, 5), ipu_id=2) - self.softmax = poptorch.BeginBlock(torch.nn.Softmax(dim=1), ipu_id=3) - - ... - - - model = MyLightningModule() - trainer = pl.Trainer(accelerator="ipu", devices=8, strategy=IPUStrategy(device_iterations=20)) - trainer.fit(model) - - -You can also use the block context manager within the forward function, or any of the step functions. - -.. code-block:: python - - import lightning.pytorch as pl - import poptorch - - - class MyLightningModule(pl.LightningModule): - def __init__(self): - super().__init__() - self.layer1 = torch.nn.Linear(5, 10) - self.layer2 = torch.nn.Linear(10, 5) - self.layer3 = torch.nn.Linear(5, 5) - self.layer4 = torch.nn.Linear(5, 5) - - self.act = torch.nn.ReLU() - self.softmax = torch.nn.Softmax(dim=1) - - def forward(self, x): - with poptorch.Block(ipu_id=0): - x = self.act(self.layer1(x)) - - with poptorch.Block(ipu_id=1): - x = self.act(self.layer2(x)) - - with poptorch.Block(ipu_id=2): - x = self.act(self.layer3(x)) - x = self.act(self.layer4(x)) - - with poptorch.Block(ipu_id=3): - x = self.softmax(x) - return x - - ... - - - model = MyLightningModule() - trainer = pl.Trainer(accelerator="ipu", devices=8, strategy=IPUStrategy(device_iterations=20)) - trainer.fit(model) diff --git a/docs/source-pytorch/accelerators/ipu_basic.rst b/docs/source-pytorch/accelerators/ipu_basic.rst deleted file mode 100644 index 8381b2648c97e..0000000000000 --- a/docs/source-pytorch/accelerators/ipu_basic.rst +++ /dev/null @@ -1,72 +0,0 @@ -:orphan: - -.. _ipu_basic: - -Accelerator: IPU training -========================= -**Audience:** Users looking to save money and run large models faster using single or multiple IPU devices. - -.. warning:: This is an :ref:`experimental ` feature. - ----- - -What is an IPU? ---------------- - -The Graphcore `Intelligence Processing Unit (IPU) `__, built for Artificial Intelligence and Machine Learning, consists of many individual cores, called *tiles*, allowing highly parallel computation. Due to the high bandwidth between tiles, IPUs facilitate machine learning loads where parallelization is essential. Because computation is heavily parallelized, - -IPUs operate in a different way to conventional accelerators such as CPU/GPUs. IPUs do not require large batch sizes for maximum parallelization, can provide optimizations across the compiled graph and rely on model parallelism to fully utilize tiles for larger models. - -IPUs are used to build IPU-PODs, rack-based systems of IPU-Machines for larger workloads. See the `IPU Architecture `__ for more information. - -See the `Graphcore Glossary `__ for the definitions of other IPU-specific terminology. - ----- - -Run on IPU ----------- - -To enable PyTorch Lightning to utilize the IPU accelerator, simply provide ``accelerator="ipu"`` parameter to the Trainer class. - -To use multiple IPUs set the devices to a number that is a power of 2 (i.e: 2, 4, 8, 16, ...) - -.. code-block:: python - - # run on as many IPUs as available by default - trainer = Trainer(accelerator="auto", devices="auto", strategy="auto") - # equivalent to - trainer = Trainer() - - # run on one IPU - trainer = Trainer(accelerator="ipu", devices=1) - # run on multiple IPUs - trainer = Trainer(accelerator="ipu", devices=8) - # choose the number of devices automatically - trainer = Trainer(accelerator="ipu", devices="auto") - ----- - -How to access IPUs ------------------- - -To use IPUs you must have access to a system with IPU devices. To get access see `get started `__. - -You must ensure that the IPU system has enabled the PopART and Poplar packages from the SDK. Instructions are in the Get Started guide for your IPU system, on the Graphcore `documents portal `__. - ----- - -.. _known-limitations: - -Known limitations ------------------ - -Currently there are some known limitations that are being addressed in the near future to make the experience seamless when moving from different devices. - -Please see the `MNIST example `__ which displays most of the limitations and how to overcome them till they are resolved. - -* ``self.log`` is not supported in the ``training_step``, ``validation_step``, ``test_step`` or ``predict_step``. This is due to the step function being traced and sent to the IPU devices. -* Since the step functions are traced, branching logic or any form of primitive values are traced into constants. Be mindful as this could lead to errors in your custom code. -* Clipping gradients is not supported. -* It is not possible to use :class:`torch.utils.data.BatchSampler` in your dataloaders if you are using multiple IPUs. -* IPUs handle the data transfer to the device on the host, hence the hooks :meth:`~lightning.pytorch.core.hooks.ModelHooks.transfer_batch_to_device` and - :meth:`~lightning.pytorch.core.hooks.ModelHooks.on_after_batch_transfer` do not apply here and if you have overridden any of them, an exception will be raised. diff --git a/docs/source-pytorch/accelerators/ipu_intermediate.rst b/docs/source-pytorch/accelerators/ipu_intermediate.rst deleted file mode 100644 index 251004fd176d1..0000000000000 --- a/docs/source-pytorch/accelerators/ipu_intermediate.rst +++ /dev/null @@ -1,65 +0,0 @@ -:orphan: - -.. _ipu_intermediate: - -Accelerator: IPU training -========================= -**Audience:** IPU users looking to increase performance via mixed precision and analysis tools. - -.. warning:: This is an :ref:`experimental ` feature. - ----- - -Mixed precision & 16 bit precision ----------------------------------- - -Lightning also supports training in mixed precision with IPUs. -By default, IPU training will use 32-bit precision. To enable mixed precision, -set the precision flag. - -.. note:: - Currently there is no dynamic scaling of the loss with mixed precision training. - -.. code-block:: python - - import lightning.pytorch as pl - - model = MyLightningModule() - trainer = pl.Trainer(accelerator="ipu", devices=8, precision=16) - trainer.fit(model) - -You can also use pure 16-bit training, where the weights are also in 16-bit precision. - -.. code-block:: python - - import lightning.pytorch as pl - from lightning_graphcore import IPUStrategy - - model = MyLightningModule() - model = model.half() - trainer = pl.Trainer(accelerator="ipu", devices=8, precision=16) - trainer.fit(model) - ----- - -PopVision Graph Analyser ------------------------- - -.. figure:: ../_static/images/accelerator/ipus/profiler.png - :alt: PopVision Graph Analyser - :width: 500 - -Lightning supports integration with the `PopVision Graph Analyser Tool `__. This helps to look at utilization of IPU devices and provides helpful metrics during the lifecycle of your trainer. Once you have gained access, The PopVision Graph Analyser Tool can be downloaded via the `GraphCore download website `__. - -Lightning supports dumping all reports to a directory to open using the tool. - -.. code-block:: python - - import lightning.pytorch as pl - from lightning_graphcore import IPUStrategy - - model = MyLightningModule() - trainer = pl.Trainer(accelerator="ipu", devices=8, strategy=IPUStrategy(autoreport_dir="report_dir/")) - trainer.fit(model) - -This will dump all reports to ``report_dir/`` which can then be opened using the Graph Analyser Tool, see `Opening Reports `__. diff --git a/docs/source-pytorch/common/index.rst b/docs/source-pytorch/common/index.rst index b5f44f76a37dd..987a56e4548a0 100644 --- a/docs/source-pytorch/common/index.rst +++ b/docs/source-pytorch/common/index.rst @@ -17,7 +17,7 @@ ../advanced/model_parallel Train on single or multiple GPUs <../accelerators/gpu> Train on single or multiple HPUs <../integrations/hpu/index> - Train on single or multiple IPUs <../accelerators/ipu> + Train on single or multiple IPUs <../integrations/ipu/index> Train on single or multiple TPUs <../accelerators/tpu> Train on MPS <../accelerators/mps> Use a pretrained model <../advanced/pretrained> @@ -155,7 +155,7 @@ How-to Guides .. displayitem:: :header: Train on single or multiple IPUs :description: Train models faster with IPU accelerators - :button_link: ../accelerators/ipu.html + :button_link: ../integrations/ipu/index.html :col_css: col-md-4 :height: 180 diff --git a/docs/source-pytorch/common_usecases.rst b/docs/source-pytorch/common_usecases.rst index 263fb348116a8..0c15e2dc17854 100644 --- a/docs/source-pytorch/common_usecases.rst +++ b/docs/source-pytorch/common_usecases.rst @@ -130,7 +130,7 @@ Customize and extend Lightning for things like custom hardware or distributed st :header: Train on single or multiple IPUs :description: Train models faster with IPUs. :col_css: col-md-12 - :button_link: accelerators/ipu.html + :button_link: integrations/ipu/index.html :height: 100 .. displayitem:: diff --git a/docs/source-pytorch/conf.py b/docs/source-pytorch/conf.py index 754fa680e5ee1..a8bab35618bd2 100644 --- a/docs/source-pytorch/conf.py +++ b/docs/source-pytorch/conf.py @@ -110,6 +110,11 @@ def _transform_changelog(path_in: str, path_out: str) -> None: target_dir="docs/source-pytorch/integrations/hpu", checkout="tags/1.0.0", ) +assist_local.AssistantCLI.pull_docs_files( + gh_user_repo="Lightning-AI/lightning-Graphcore", + target_dir="docs/source-pytorch/integrations/ipu", + checkout="tags/0.1.0.rc3", +) # -- Project information ----------------------------------------------------- diff --git a/docs/source-pytorch/extensions/accelerator.rst b/docs/source-pytorch/extensions/accelerator.rst index 45f4b72500c38..0589d9850cea2 100644 --- a/docs/source-pytorch/extensions/accelerator.rst +++ b/docs/source-pytorch/extensions/accelerator.rst @@ -10,7 +10,7 @@ Currently there are accelerators for: - CPU - :doc:`GPU <../accelerators/gpu>` - :doc:`TPU <../accelerators/tpu>` -- :doc:`IPU <../accelerators/ipu>` +- :doc:`IPU <../integrations/ipu/index>` - :doc:`HPU <../integrations/hpu/index>` - :doc:`MPS <../accelerators/mps>` diff --git a/docs/source-pytorch/extensions/strategy.rst b/docs/source-pytorch/extensions/strategy.rst index 715d2e84d651b..3eb3e323060d1 100644 --- a/docs/source-pytorch/extensions/strategy.rst +++ b/docs/source-pytorch/extensions/strategy.rst @@ -89,7 +89,7 @@ The below table lists all relevant strategies available in Lightning with their - Strategy for training on a single HPU device. :doc:`Learn more. <../integrations/hpu/index>` * - ipu_strategy - ``IPUStrategy`` - - Plugin for training on IPU devices. :doc:`Learn more. <../accelerators/ipu>` + - Plugin for training on IPU devices. :doc:`Learn more. <../integrations/ipu/index>` * - xla - :class:`~lightning.pytorch.strategies.XLAStrategy` - Strategy for training on multiple TPU devices using the :func:`torch_xla.distributed.xla_multiprocessing.spawn` method. :doc:`Learn more. <../accelerators/tpu>` diff --git a/docs/source-pytorch/glossary/index.rst b/docs/source-pytorch/glossary/index.rst index 94a042b26a49c..cafe9f3c648dd 100644 --- a/docs/source-pytorch/glossary/index.rst +++ b/docs/source-pytorch/glossary/index.rst @@ -17,7 +17,7 @@ Half precision <../common/precision> HPU <../integrations/hpu/index> Inference <../deploy/production_intermediate> - IPU <../accelerators/ipu> + IPU <../integrations/ipu/index> Lightning CLI <../cli/lightning_cli> LightningDataModule <../data/datamodule> LightningModule <../common/lightning_module> @@ -154,7 +154,7 @@ Glossary :header: IPU :description: Graphcore Intelligence Processing Unit for faster training :col_css: col-md-12 - :button_link: ../accelerators/ipu.html + :button_link: ../integrations/ipu/index.html :height: 100 .. displayitem:: diff --git a/docs/source-pytorch/accelerators/ipu.rst b/docs/source-pytorch/integrations/ipu/index.rst similarity index 100% rename from docs/source-pytorch/accelerators/ipu.rst rename to docs/source-pytorch/integrations/ipu/index.rst diff --git a/docs/source-pytorch/levels/advanced_level_19.rst b/docs/source-pytorch/levels/advanced_level_19.rst index 4265b039b51f1..6cff234ae96dc 100644 --- a/docs/source-pytorch/levels/advanced_level_19.rst +++ b/docs/source-pytorch/levels/advanced_level_19.rst @@ -27,7 +27,7 @@ Explore Intelligence Processing Unit (IPU) for model scaling. :header: Train models on IPUs :description: Learn the basics of single and multi-IPU training. :col_css: col-md-4 - :button_link: ../accelerators/ipu_basic.html + :button_link: ../integrations/ipu/basic.html :height: 150 :tag: basic @@ -35,7 +35,7 @@ Explore Intelligence Processing Unit (IPU) for model scaling. :header: Optimize models training on IPUs :description: Tune model performance with mix-precision and the performance analyser. :col_css: col-md-4 - :button_link: ../accelerators/ipu_intermediate.html + :button_link: ../integrations/ipu/intermediate.html :height: 150 :tag: intermediate From 58b1b354d56217663dc838c78288db353bc13057 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:51:14 +0200 Subject: [PATCH 2/7] Apply suggestions from code review --- docs/source-pytorch/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source-pytorch/conf.py b/docs/source-pytorch/conf.py index b7d63d7826085..4e8ad8993440e 100644 --- a/docs/source-pytorch/conf.py +++ b/docs/source-pytorch/conf.py @@ -104,7 +104,7 @@ def _load_py_module(name: str, location: str) -> ModuleType: assist_local.AssistantCLI.pull_docs_files( gh_user_repo="Lightning-AI/lightning-Graphcore", target_dir="docs/source-pytorch/integrations/ipu", - checkout="tags/0.1.0.rc3", + checkout="tags/v0.1.0", ) if _FETCH_S3_ASSETS: From 65a67abfa1694d704dd7bba8b82ce92970b77ea3 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 3 Oct 2023 15:27:10 +0200 Subject: [PATCH 3/7] images --- .gitignore | 2 ++ docs/source-pytorch/accelerators/accelerator_prepare.rst | 2 -- docs/source-pytorch/conf.py | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fe3a13e9e0f6c..598ad521afa81 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,9 @@ docs/source-pytorch/notebooks docs/source-pytorch/_static/images/course_UvA-DL docs/source-pytorch/_static/images/lightning_examples docs/source-pytorch/_static/fetched-s3-assets +docs/source-pytorch/_static/images/ipu/ docs/source-pytorch/integrations/hpu +docs/source-pytorch/integrations/ipu docs/source-fabric/*/generated diff --git a/docs/source-pytorch/accelerators/accelerator_prepare.rst b/docs/source-pytorch/accelerators/accelerator_prepare.rst index 0647cbf95729f..59d0779cb3339 100644 --- a/docs/source-pytorch/accelerators/accelerator_prepare.rst +++ b/docs/source-pytorch/accelerators/accelerator_prepare.rst @@ -1,7 +1,5 @@ :orphan: -.. _gpu_prepare: - ######################################## Hardware agnostic training (preparation) ######################################## diff --git a/docs/source-pytorch/conf.py b/docs/source-pytorch/conf.py index 4e8ad8993440e..fb4553e9f7bdf 100644 --- a/docs/source-pytorch/conf.py +++ b/docs/source-pytorch/conf.py @@ -14,6 +14,7 @@ import glob import os import shutil +import urllib.request import warnings from importlib.util import module_from_spec, spec_from_file_location from types import ModuleType @@ -106,6 +107,12 @@ def _load_py_module(name: str, location: str) -> ModuleType: target_dir="docs/source-pytorch/integrations/ipu", checkout="tags/v0.1.0", ) +# the IPU also need one image +URL_RAW_DOCS_GRAPHCORE = "https://raw.githubusercontent.com/Lightning-AI/lightning-Graphcore/v0.1.0/docs/source" +for img in ["_static/images/ipu/profiler.png"]: + os.makedirs(os.path.dirname(os.path.join(_PATH_HERE, img)), exist_ok=True) + urllib.request.urlretrieve(f"{URL_RAW_DOCS_GRAPHCORE}/{img}", os.path.join(_PATH_HERE, img)) + if _FETCH_S3_ASSETS: fetch_external_assets( From 37e014d175c8500640425fe2bb1753d3332d4e71 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 3 Oct 2023 15:43:10 +0200 Subject: [PATCH 4/7] orphans --- .actions/assistant.py | 14 +++++++++++++- docs/source-pytorch/conf.py | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.actions/assistant.py b/.actions/assistant.py index 7ffef03b5ba86..52480cc78227e 100644 --- a/.actions/assistant.py +++ b/.actions/assistant.py @@ -442,6 +442,7 @@ def pull_docs_files( target_dir: str = "docs/source-pytorch/XXX", checkout: str = "tags/1.0.0", source_dir: str = "docs/source", + as_orphan: bool = False ) -> None: """Pull docs pages from external source and append to local docs.""" import zipfile @@ -473,7 +474,18 @@ def pull_docs_files( if os.path.isfile(new_rst): logging.warning(f"Page {new_rst} already exists in the local tree so it will be skipped.") continue - shutil.copy(rst, new_rst) + AssistantCLI._copy_rst(rst, new_rst, as_orphan=as_orphan) + + @staticmethod + def _copy_rst(rst_in, rst_out, as_orphan: bool = False): + """Copy RST page with optional inserting orphan statement.""" + with open(rst_in, encoding="utf-8") as fopen: + page = fopen.read() + if as_orphan and ":orphan:" not in page: + page = f":orphan:\n\n" + page + with open(rst_in, "w", encoding="utf-8") as fopen: + fopen.write(page) + if __name__ == "__main__": diff --git a/docs/source-pytorch/conf.py b/docs/source-pytorch/conf.py index fb4553e9f7bdf..457a19ecec911 100644 --- a/docs/source-pytorch/conf.py +++ b/docs/source-pytorch/conf.py @@ -106,6 +106,7 @@ def _load_py_module(name: str, location: str) -> ModuleType: gh_user_repo="Lightning-AI/lightning-Graphcore", target_dir="docs/source-pytorch/integrations/ipu", checkout="tags/v0.1.0", + as_orphan=True, # todo: this can be dropped after new IPU release ) # the IPU also need one image URL_RAW_DOCS_GRAPHCORE = "https://raw.githubusercontent.com/Lightning-AI/lightning-Graphcore/v0.1.0/docs/source" From 50f36127d129438fffeaed34fe77f4b45860637d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 13:44:28 +0000 Subject: [PATCH 5/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .actions/assistant.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.actions/assistant.py b/.actions/assistant.py index 52480cc78227e..929c08c3f3538 100644 --- a/.actions/assistant.py +++ b/.actions/assistant.py @@ -442,7 +442,7 @@ def pull_docs_files( target_dir: str = "docs/source-pytorch/XXX", checkout: str = "tags/1.0.0", source_dir: str = "docs/source", - as_orphan: bool = False + as_orphan: bool = False, ) -> None: """Pull docs pages from external source and append to local docs.""" import zipfile @@ -482,12 +482,11 @@ def _copy_rst(rst_in, rst_out, as_orphan: bool = False): with open(rst_in, encoding="utf-8") as fopen: page = fopen.read() if as_orphan and ":orphan:" not in page: - page = f":orphan:\n\n" + page + page = ":orphan:\n\n" + page with open(rst_in, "w", encoding="utf-8") as fopen: fopen.write(page) - if __name__ == "__main__": import jsonargparse From fe488caa1b8995e69a385daddb189dfb04ef9e25 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 3 Oct 2023 15:59:17 +0200 Subject: [PATCH 6/7] links --- docs/source-pytorch/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source-pytorch/conf.py b/docs/source-pytorch/conf.py index 457a19ecec911..98a691fb5472a 100644 --- a/docs/source-pytorch/conf.py +++ b/docs/source-pytorch/conf.py @@ -610,5 +610,7 @@ def package_list_from_file(file): # ignore the following relative links (false positive errors during linkcheck) linkcheck_ignore = [ r"installation.html$", + r"starter/installation.html$", r"^../common/trainer.html#trainer-flags$", + "https://deepgenerativemodels.github.io/assets/slides/cs236_lecture11.pdf" ] From 5bd5cb6eb1c5ea99e5796768b21156494f02454b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:01:04 +0000 Subject: [PATCH 7/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/source-pytorch/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source-pytorch/conf.py b/docs/source-pytorch/conf.py index 98a691fb5472a..1899fdb8d97ea 100644 --- a/docs/source-pytorch/conf.py +++ b/docs/source-pytorch/conf.py @@ -612,5 +612,5 @@ def package_list_from_file(file): r"installation.html$", r"starter/installation.html$", r"^../common/trainer.html#trainer-flags$", - "https://deepgenerativemodels.github.io/assets/slides/cs236_lecture11.pdf" + "https://deepgenerativemodels.github.io/assets/slides/cs236_lecture11.pdf", ]