-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
compat.py
47 lines (36 loc) 路 871 Bytes
/
compat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# mypy: ignore-errors
import sys
if sys.version_info[:2] >= (3, 8): # Python 3.8+
from typing import Protocol, runtime_checkable, Literal
else:
from typing_extensions import Protocol, runtime_checkable, Literal # noqa: F401
try:
import langchain
has_langchain = True
except (ImportError, AttributeError):
langchain = None
has_langchain = False
try:
import minichain
has_minichain = True
except (ImportError, AttributeError):
minichain = None
has_minichain = False
try:
import torch
has_torch = True
except ImportError:
torch = None
has_torch = False
try:
import transformers
has_transformers = True
except ImportError:
transformers = None
has_transformers = False
try:
import accelerate
has_accelerate = True
except ImportError:
accelerate = None
has_accelerate = False