Skip to content

Commit 628242c

Browse files
JeS24akihironitta
andauthored
[Docs] Grammatical fixes in compile.rst (#10208)
Co-authored-by: Akihiro Nitta <[email protected]>
1 parent a208789 commit 628242c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/source/advanced/compile.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,28 @@ The :meth:`torch.compile` method provides two important arguments to be aware of
5353
5454
torch.compile(model, dynamic=True)
5555
56-
With this, :pytorch:`PyTorch` will up-front attempt to generate a kernel that is as dynamic as possible to avoid recompilations when sizes change across mini-batches changes.
57-
Note that when :obj:`dynamic` is set to :obj:`False`, :pytorch:`PyTorch` will *never* generate dynamic kernels, and thus only works when graph sizes are guaranteed to never change (*e.g.*, in full-batch training on small graphs).
58-
By default, :obj:`dynamic` is set to :obj:`None` in :pytorch:`PyTorch` :obj:`>= 2.1.0`, and :pytorch:`PyTorch` will automatically detect if dynamism has occured.
56+
With this, :pytorch:`PyTorch` will up-front attempt to generate a kernel that is as dynamic as possible to avoid recompilations when sizes change across mini-batches.
57+
Note that when :obj:`dynamic` is set to :obj:`False`, :pytorch:`PyTorch` will *never* generate dynamic kernels, and thus only work when graph sizes are guaranteed to never change (*e.g.*, in full-batch training on small graphs).
58+
By default, :obj:`dynamic` is set to :obj:`None` in :pytorch:`PyTorch` :obj:`>= 2.1.0`, and :pytorch:`PyTorch` will automatically detect if dynamism has occurred.
5959
Note that support for dynamic shape tracing requires :pytorch:`PyTorch` :obj:`>= 2.1.0` to be installed.
6060

61-
* In order to maximize speedup, graphs breaks in the compiled model should be limited.
61+
* In order to maximize speedup, graph breaks in the compiled model should be limited.
6262
We can force compilation to raise an error upon the first graph break encountered by using the :obj:`fullgraph=True` argument:
6363

6464
.. code-block:: python
6565
6666
torch.compile(model, fullgraph=True)
6767
6868
It is generally a good practice to confirm that your written model does not contain any graph breaks.
69-
Importantly, there exists a few operations in :pyg:`PyG` that will currently lead to graph breaks (but workaround exists), *e.g.*:
69+
Importantly, there exist a few operations in :pyg:`PyG` that will currently lead to graph breaks (but workarounds exist), *e.g.*:
7070

7171
1. :meth:`~torch_geometric.nn.pool.global_mean_pool` (and other pooling operators) perform device synchronization in case the batch size :obj:`size` is not passed, leading to a graph break.
7272

7373
2. :meth:`~torch_geometric.utils.remove_self_loops` and :meth:`~torch_geometric.utils.add_remaining_self_loops` mask the given :obj:`edge_index`, leading to a device synchronization to compute its final output shape.
74-
As such, we recommend to augment your graph *before* inputting it into your GNN, *e.g.*, via the :class:`~torch_geometric.transforms.AddSelfLoops` or :class:`~torch_geometric.transforms.GCNNorm` transformations, and setting :obj:`add_self_loops=False`/:obj:`normalize=False` when initializing layers such as :class:`~torch_geometric.nn.conv.GCNConv`.
74+
As such, we recommend augmenting your graph *before* inputting it into your GNN, *e.g.*, via the :class:`~torch_geometric.transforms.AddSelfLoops` or :class:`~torch_geometric.transforms.GCNNorm` transformations, and setting :obj:`add_self_loops=False`/:obj:`normalize=False` when initializing layers such as :class:`~torch_geometric.nn.conv.GCNConv`.
7575

76-
Exampe Scripts
77-
--------------
76+
Example Scripts
77+
---------------
7878

7979
We have incorporated multiple examples in :obj:`examples/compile` that further show the practical usage of :meth:`torch.compile`:
8080

@@ -88,7 +88,7 @@ Benchmark
8888
---------
8989

9090
:meth:`torch.compile` works **fantastically well** for many :pyg:`PyG` models.
91-
**Overall, we observe runtime improvements of nearly up to 300%.**
91+
**Overall, we observe runtime improvements of up to 300%.**
9292

9393
Specifically, we benchmark :class:`~torch_geometric.nn.models.GCN`, :class:`~torch_geometric.nn.models.GraphSAGE` and :class:`~torch_geometric.nn.models.GIN` and compare runtimes obtained from traditional eager mode and :meth:`torch.compile`.
9494
We use a synthetic graph with 10,000 nodes and 200,000 edges, and a hidden feature dimensionality of 64.

0 commit comments

Comments
 (0)