Skip to content

Commit

Permalink
Add PyTorch 2.3 installation guide (#9257)
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s committed Apr 30, 2024
1 parent 845c5cf commit 36bc925
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 40 deletions.
6 changes: 3 additions & 3 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ runs:
python -c "import torch; print('CUDA:', torch.version.cuda)"
shell: bash

- name: Install pyg-lib # pyg-lib is currently not available on Windows.
if: ${{ inputs.torch-version != 'nightly' && inputs.torch-version != '2.3.0' && runner.os != 'Windows' }}
- name: Install pyg-lib
if: ${{ inputs.torch-version != 'nightly' }}
run: |
pip uninstall -y pyg-lib
pip install --no-index pyg-lib -f https://data.pyg.org/whl/nightly/torch-${{ inputs.torch-version }}+${{ inputs.cuda-version }}.html
Expand All @@ -74,7 +74,7 @@ runs:
shell: bash

- name: Install extension packages
if: ${{ inputs.full_install == 'true' && inputs.torch-version != 'nightly' && inputs.torch-version != '2.3.0' && runner.os != 'macOS' }}
if: ${{ inputs.full_install == 'true' && inputs.torch-version != 'nightly' }}
run: |
pip install scipy
pip install --no-index --upgrade torch-scatter torch-sparse torch-cluster torch-spline-conv -f https://data.pyg.org/whl/torch-${{ inputs.torch-version }}+${{ inputs.cuda-version }}.html
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,12 @@ We recommend to start with a minimal installation, and install additional depend

For ease of installation of these extensions, we provide `pip` wheels for all major OS/PyTorch/CUDA combinations, see [here](https://data.pyg.org/whl).

#### PyTorch 2.2
#### PyTorch 2.3

To install the binaries for PyTorch 2.2.0, simply run
To install the binaries for PyTorch 2.3.0, simply run

```
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.2.0+${CUDA}.html
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.3.0+${CUDA}.html
```

where `${CUDA}` should be replaced by either `cpu`, `cu118`, or `cu121` depending on your PyTorch installation.
Expand All @@ -387,12 +387,12 @@ where `${CUDA}` should be replaced by either `cpu`, `cu118`, or `cu121` dependin
| **Windows** ||||
| **macOS** || | |

#### PyTorch 2.1
#### PyTorch 2.2

To install the binaries for PyTorch 2.1.0, simply run
To install the binaries for PyTorch 2.2.0, simply run

```
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.1.0+${CUDA}.html
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.2.0+${CUDA}.html
```

where `${CUDA}` should be replaced by either `cpu`, `cu118`, or `cu121` depending on your PyTorch installation.
Expand All @@ -403,7 +403,7 @@ where `${CUDA}` should be replaced by either `cpu`, `cu118`, or `cu121` dependin
| **Windows** ||||
| **macOS** || | |

**Note:** Binaries of older versions are also provided for PyTorch 1.4.0, PyTorch 1.5.0, PyTorch 1.6.0, PyTorch 1.7.0/1.7.1, PyTorch 1.8.0/1.8.1, PyTorch 1.9.0, PyTorch 1.10.0/1.10.1/1.10.2, PyTorch 1.11.0, PyTorch 1.12.0/1.12.1, PyTorch 1.13.0/1.13.1, and PyTorch 2.0.0 (following the same procedure).
**Note:** Binaries of older versions are also provided for PyTorch 1.4.0, PyTorch 1.5.0, PyTorch 1.6.0, PyTorch 1.7.0/1.7.1, PyTorch 1.8.0/1.8.1, PyTorch 1.9.0, PyTorch 1.10.0/1.10.1/1.10.2, PyTorch 1.11.0, PyTorch 1.12.0/1.12.1, PyTorch 1.13.0/1.13.1, PyTorch 2.0.0/2.0.1, and PyTorch 2.1.0/2.1.1/2.1.2 (following the same procedure).
**For older versions, you might need to explicitly specify the latest supported version number** or install via `pip install --no-index` in order to prevent a manual installation from source.
You can look up the latest supported version number [here](https://data.pyg.org/whl).

Expand Down
15 changes: 8 additions & 7 deletions docs/source/install/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ For ease of installation of these extensions, we provide :obj:`pip` wheels for t
Wheels are currently not available for M1/M2/M3 macs.
Please install the extension packages `from source <installation.html#installation-from-source>`__.

#. Ensure that at least :pytorch:`PyTorch` 1.11.0 is installed:
#. Ensure that at least :pytorch:`PyTorch` 1.13.0 is installed:

.. code-block:: none
python -c "import torch; print(torch.__version__)"
>>> 2.2.0
>>> 2.3.0
#. Find the CUDA version :pytorch:`PyTorch` was installed with:

Expand All @@ -89,24 +89,25 @@ For ease of installation of these extensions, we provide :obj:`pip` wheels for t
where :obj:`${TORCH}` and :obj:`${CUDA}` should be replaced by the specific :pytorch:`PyTorch` and CUDA versions, respectively:

* :pytorch:`PyTorch` 2.3: :obj:`${TORCH}=2.3.0` and :obj:`${CUDA}=cpu|cu118|cu121`
* :pytorch:`PyTorch` 2.2: :obj:`${TORCH}=2.2.0` and :obj:`${CUDA}=cpu|cu118|cu121`
* :pytorch:`PyTorch` 2.1: :obj:`${TORCH}=2.1.0` and :obj:`${CUDA}=cpu|cu118|cu121`
* :pytorch:`PyTorch` 2.0: :obj:`${TORCH}=2.0.0` and :obj:`${CUDA}=cpu|cu117|cu118`
* :pytorch:`PyTorch` 1.13: :obj:`${TORCH}=1.13.0` and :obj:`${CUDA}=cpu|cu116|cu117`

For example, for :pytorch:`PyTorch` 2.2.* and CUDA 12.1, type:
For example, for :pytorch:`PyTorch` 2.3.* and CUDA 12.1, type:

.. code-block:: none
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.2.0+cu121.html
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.3.0+cu121.html
For example, for :pytorch:`PyTorch` 2.1.* and CUDA 11.8, type:
For example, for :pytorch:`PyTorch` 2.2.* and CUDA 11.8, type:

.. code-block:: none
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.1.0+cu118.html
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.2.0+cu118.html
**Note:** Binaries of older versions are also provided for :pytorch:`PyTorch` 1.4.0, 1.5.0, 1.6.0, 1.7.0/1.7.1, 1.8.0/1.8.1, 1.9.0, 1.10.0/1.10.1/1.10.2, 1.11.0, 1.12.0/1.12.1, 1.13.0/1.13.1, and 2.0.0 (following the same procedure).
**Note:** Binaries of older versions are also provided for :pytorch:`PyTorch` 1.4.0, 1.5.0, 1.6.0, 1.7.0/1.7.1, 1.8.0/1.8.1, 1.9.0, 1.10.0/1.10.1/1.10.2, 1.11.0, 1.12.0/1.12.1, 1.13.0/1.13.1, 2.0.0/2.0.1, and 2.1.0/2.1.1/2.1.2 (following the same procedure).
**For older versions, you need to explicitly specify the latest supported version number** or install via :obj:`pip install --no-index` in order to prevent a manual installation from source.
You can look up the latest supported version number `here <https://data.pyg.org/whl>`__.

Expand Down
17 changes: 2 additions & 15 deletions docs/source/install/quick-start.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@

<script>
var torchList = [
['torch-2.3.0', 'PyTorch 2.3.*'],
['torch-2.2.0', 'PyTorch 2.2.*'],
['torch-2.1.0', 'PyTorch 2.1.*'],
['torch-2.0.0', 'PyTorch 2.0.*'],
];

var osList = [
Expand All @@ -92,7 +92,6 @@
];

var cudaList = [
['cu117', '11.7'],
['cu118', '11.8'],
['cu121', '12.1'],
['cpu', 'CPU'],
Expand All @@ -113,23 +112,11 @@
$("#command pre").text('# macOS binaries do not support CUDA');
}

else if (torch == "torch-2.0.0" && cuda == "cu121") {
$("#command pre").text('# PyTorch 2.0.* binaries do not support CUDA 12.1');
}

else if (torch == "torch-2.2.0" && cuda == "cu117") {
$("#command pre").text('# PyTorch 2.2.* binaries do not support CUDA 11.7');
}

else if (torch == "torch-2.1.0" && cuda == "cu117") {
$("#command pre").text('# PyTorch 2.1.* binaries do not support CUDA 11.7');
}

else if (package == "conda") {
$("#command pre").text('conda install pyg -c pyg');
}

else if (os == "windows" || os == "mac") {
else if ((os == "windows" || os == "mac") && (torch == "torch-2.1.0" || torch == "torch-2.2.0")) {
$("#command pre").text(`pip install torch_geometric\n\n# Optional dependencies:\npip install torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/${$("#command").attr("torch")}+${$("#command").attr("cuda")}.html`);
}

Expand Down
8 changes: 4 additions & 4 deletions torch_geometric/datasets/qm9.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,16 @@ def download(self) -> None:

def process(self) -> None:
try:
import rdkit
from rdkit import Chem, RDLogger
from rdkit.Chem.rdchem import BondType as BT
from rdkit.Chem.rdchem import HybridizationType
RDLogger.DisableLog('rdApp.*')
RDLogger.DisableLog('rdApp.*') # type: ignore
WITH_RDKIT = True

except ImportError:
rdkit = None
WITH_RDKIT = False

if rdkit is None:
if not WITH_RDKIT:
print(("Using a pre-processed version of the dataset. Please "
"install 'rdkit' to alternatively process the raw data."),
file=sys.stderr)
Expand Down
8 changes: 4 additions & 4 deletions torch_geometric/utils/smiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def from_smiles(smiles: str, with_hydrogen: bool = False,

from torch_geometric.data import Data

RDLogger.DisableLog('rdApp.*')
RDLogger.DisableLog('rdApp.*') # type: ignore

mol = Chem.MolFromSmiles(smiles)

Expand All @@ -105,7 +105,7 @@ def from_smiles(smiles: str, with_hydrogen: bool = False,
Chem.Kekulize(mol)

xs: List[List[int]] = []
for atom in mol.GetAtoms():
for atom in mol.GetAtoms(): # type: ignore
row: List[int] = []
row.append(x_map['atomic_num'].index(atom.GetAtomicNum()))
row.append(x_map['chirality'].index(str(atom.GetChiralTag())))
Expand All @@ -122,7 +122,7 @@ def from_smiles(smiles: str, with_hydrogen: bool = False,
x = torch.tensor(xs, dtype=torch.long).view(-1, 9)

edge_indices, edge_attrs = [], []
for bond in mol.GetBonds():
for bond in mol.GetBonds(): # type: ignore
i = bond.GetBeginAtomIdx()
j = bond.GetEndAtomIdx()

Expand Down Expand Up @@ -172,7 +172,7 @@ def to_smiles(data: 'torch_geometric.data.Data',
data.x[i, 5])])
atom.SetHybridization(Chem.rdchem.HybridizationType.values[int(
data.x[i, 6])])
atom.SetIsAromatic(int(data.x[i, 7]))
atom.SetIsAromatic(bool(data.x[i, 7]))
mol.AddAtom(atom)

edges = [tuple(i) for i in data.edge_index.t().tolist()]
Expand Down

0 comments on commit 36bc925

Please sign in to comment.