File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
pytorch_lightning/utilities Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 17
17
from copy import copy
18
18
from functools import partial
19
19
from typing import Any , Callable , Optional , Union
20
- from distutils .version import LooseVersion
21
20
22
21
import numpy as np
23
22
import torch
24
23
25
24
from pytorch_lightning .utilities .exceptions import MisconfigurationException
26
25
from pytorch_lightning .utilities .imports import _TORCHTEXT_AVAILABLE
26
+ from pytorch_lightning .utilities .imports import _module_available
27
27
28
28
if _TORCHTEXT_AVAILABLE :
29
- from torchtext import __version__ as torchtext_version
30
- if LooseVersion (torchtext_version ) < LooseVersion ('0.9.0a0+036df73' ):
31
- from torchtext .data import Batch
32
- else :
29
+ if _module_available ("torchtext.legacy" ):
33
30
from torchtext .legacy .data import Batch
31
+ else :
32
+ from torchtext .data import Batch
34
33
else :
35
34
Batch = type (None )
36
35
You can’t perform that action at this time.
0 commit comments