mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
Literal use w/ python < 3.8 requires typing_extension, cach instead of check sys ver
This commit is contained in:
parent
dfaab97d20
commit
ada145b016
@ -2,7 +2,6 @@ import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
@ -22,9 +21,9 @@ try:
|
||||
except ImportError:
|
||||
_has_safetensors = False
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
try:
|
||||
from typing import Literal
|
||||
else:
|
||||
except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
from timm import __version__
|
||||
|
@ -27,7 +27,11 @@ import logging
|
||||
import math
|
||||
from collections import OrderedDict
|
||||
from functools import partial
|
||||
from typing import Any, Callable, Dict, Optional, Sequence, Set, Tuple, Type, Union, Literal, List
|
||||
from typing import Any, Callable, Dict, Optional, Sequence, Set, Tuple, Type, Union, List
|
||||
try:
|
||||
from typing import Literal
|
||||
except ImportError:
|
||||
from typing_extensions import Literal
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
|
Loading…
x
Reference in New Issue
Block a user