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

AttributeError on import in 8.0.14 when using PyTorch<1.6.0 (?) #615

Closed
lumi-tworthey opened this issue Mar 14, 2022 · 3 comments
Closed
Labels
bug Bugs and behaviour differing from documentation interop / pytorch PyTorch interoperability

Comments

@lumi-tworthey
Copy link

As of the v8.0.14, the following traceback is occurring at import time in a project that has PyTorch pinned to v1.4.0:

.venv/lib/python3.6/site-packages/thinc/util.py:34: in <module>
    has_torch_amp = not torch.cuda.amp.common.amp_definitely_not_available()
AttributeError: module 'torch.cuda' has no attribute 'amp'

It seems torch.cuda.amp did not exist in torch until version 1.6.0. The offending line (at util.py:34) is guarded by an except ImportError, but not AttributeError for the cases in which the installed torch version does not know about the module being accessed in the first place

    has_torch_amp = not torch.cuda.amp.common.amp_definitely_not_available()
@adrianeboyd
Copy link
Contributor

Hi, we're working on a fix in #610. Hopefully we'll have a new release very soon. In the meanwhile v8.0.13 should still be compatible with older versions of pytorch.

@adrianeboyd
Copy link
Contributor

As a note, the current recommended lower version for torch is v1.5.0, so there may be other issues with v1.4.0. (But if you've been using it without issues, then it may be totally fine. This was set a while ago and I'd have to track down the details.)

@svlandeg svlandeg added bug Bugs and behaviour differing from documentation interop / pytorch PyTorch interoperability labels Mar 15, 2022
@adrianeboyd
Copy link
Contributor

Please try upgrading to v8.0.15, which should hopefully resolve the AttributeError on import.

However, after reviewing the changes and running more thorough tests of all recent torch releases, we've revised the lower recommended torch version to v1.6.0, so I'm not sure whether you still might run into other errors with v1.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and behaviour differing from documentation interop / pytorch PyTorch interoperability
Projects
None yet
Development

No branches or pull requests

3 participants