Skip to content

Commit 2e21e4c

Browse files
authored
Merge 58b5a59 into e7298b5
2 parents e7298b5 + 58b5a59 commit 2e21e4c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pytorch_lightning/utilities/apply_func.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@
2323

2424
from pytorch_lightning.utilities.exceptions import MisconfigurationException
2525
from pytorch_lightning.utilities.imports import _TORCHTEXT_AVAILABLE
26+
from pytorch_lightning.utilities.imports import _module_available
2627

2728
if _TORCHTEXT_AVAILABLE:
28-
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
2933
else:
3034
Batch = type(None)
3135

0 commit comments

Comments
 (0)