From 944cac03039582bf2df4f6f27c6e4e4f8d4cba3a Mon Sep 17 00:00:00 2001 From: Tom Aarsen Date: Tue, 12 Dec 2023 10:55:02 +0100 Subject: [PATCH] Wrap Literal import in try-except ImportError --- sentence_transformers/SentenceTransformer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sentence_transformers/SentenceTransformer.py b/sentence_transformers/SentenceTransformer.py index 355fadbdc..7a8d772a1 100644 --- a/sentence_transformers/SentenceTransformer.py +++ b/sentence_transformers/SentenceTransformer.py @@ -4,7 +4,11 @@ import shutil import stat from collections import OrderedDict -from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional, Literal +from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional +try: + from typing import Literal +except ImportError: + from typing_extensions import Literal import numpy as np from numpy import ndarray import transformers