Skip to content

Commit 3121649

Browse files
authored
Merge pull request #114 from olaviinha/master
Import Literal from typing_extensions if from typing fails
2 parents 2908a53 + 37afdf3 commit 3121649

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

taming/data/helper_types.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
from typing import Dict, Tuple, Literal, Optional, NamedTuple, Union
2-
1+
from typing import Dict, Tuple, Optional, NamedTuple, Union
32
from PIL.Image import Image as pil_image
43
from torch import Tensor
54

5+
try:
6+
from typing import Literal
7+
except ImportError:
8+
from typing_extensions import Literal
9+
610
Image = Union[Tensor, pil_image]
711
BoundingBox = Tuple[float, float, float, float] # x0, y0, w, h
812
CropMethodType = Literal['none', 'random', 'center', 'random-2d']

0 commit comments

Comments
 (0)