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 importing torchtext batch #6365

Merged
merged 6 commits into from
Mar 5, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
.
Borda committed Mar 5, 2021
commit cbc192b1281de69da505a5da6ce5a9558b8d049d
2 changes: 1 addition & 1 deletion pytorch_lightning/utilities/apply_func.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_AVAILABLE

if _TORCHTEXT_AVAILABLE:
if _compare_version("torch", operator.ge, "0.9.0"):
if _compare_version("torchtext", operator.ge, "0.9.0"):
from torchtext.legacy.data import Batch
else:
from torchtext.data import Batch
2 changes: 1 addition & 1 deletion tests/helpers/imports.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from pytorch_lightning.utilities.imports import _compare_version

if _compare_version("torch", operator.ge, "0.9.0"):
if _compare_version("torchtext", operator.ge, "0.9.0"):
from torchtext.legacy.data import Batch, Dataset, Example, Field, Iterator, LabelField # noqa: F401
else:
from torchtext.data import Batch, Dataset, Example, Field, Iterator, LabelField # noqa: F401