Skip to content

Commit 058c500

Browse files
authored
fix when torchtext not installed (#2402)
1 parent 861a73b commit 058c500

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pytorch_lightning/utilities/apply_func.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
TORCHTEXT_AVAILABLE = importlib.util.find_spec("torchtext") is not None
1010
if TORCHTEXT_AVAILABLE:
1111
from torchtext.data import Batch
12+
else:
13+
Batch = None
1214

1315

1416
def apply_to_collection(data: Any, dtype: Union[type, tuple], function: Callable, *args, **kwargs) -> Any:

0 commit comments

Comments
 (0)