We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e7298b5 + 58b5a59 commit 2e21e4cCopy full SHA for 2e21e4c
pytorch_lightning/utilities/apply_func.py
@@ -23,9 +23,13 @@
23
24
from pytorch_lightning.utilities.exceptions import MisconfigurationException
25
from pytorch_lightning.utilities.imports import _TORCHTEXT_AVAILABLE
26
+from pytorch_lightning.utilities.imports import _module_available
27
28
if _TORCHTEXT_AVAILABLE:
- from torchtext.data import Batch
29
+ if _module_available("torchtext.legacy.data"):
30
+ from torchtext.legacy.data import Batch
31
+ else:
32
+ from torchtext.data import Batch
33
else:
34
Batch = type(None)
35
0 commit comments