Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pytorch version check #2544

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/install/backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ PyTorch backend
---------------

Export ``DGLBACKEND`` as ``pytorch`` to specify PyTorch backend. The required PyTorch
version is 1.1.0 or later. See `pytorch.org <https://pytorch.org>`_ for installation instructions.
version is 1.5.0 or later. See `pytorch.org <https://pytorch.org>`_ for installation instructions.

MXNet backend
-------------
Expand All @@ -44,5 +44,5 @@ instructions. In addition, DGL will set ``TF_FORCE_GPU_ALLOW_GROWTH`` to ``true`

.. code:: bash

pip install "tensorflow>=2.2.0rc1" # when using tensorflow cpu version
pip install "tensorflow>=2.2.0" # when using tensorflow cpu version

4 changes: 2 additions & 2 deletions python/dgl/backend/pytorch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from ...base import dgl_warning

if LooseVersion(th.__version__) < LooseVersion("1.5.0"):
dgl_warning("Detected an old version of PyTorch. Suggest using torch>=1.5.0 "
"for the best experience.")
raise Exception("Detected an old version of PyTorch. Please update torch>=1.5.0 "
"for the best experience.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested if this works for nightly build?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can handle the nightly version.

LooseVersion("1.7.1dev20210119") > LooseVersion("1.5") # True
LooseVersion("1.7.1dev20210119") > LooseVersion("1.7") # True
LooseVersion("1.7.1dev20210119") > LooseVersion("1.7.1") # True
LooseVersion("1.7.1dev20210119") > LooseVersion("1.8") # False


def data_type_dict():
return {'float16' : th.float16,
Expand Down