Update handler.py
Browse files- handler.py +12 -2
handler.py
CHANGED
@@ -5,8 +5,18 @@ import subprocess
|
|
5 |
|
6 |
|
7 |
# Manually install bitsandbytes
|
8 |
-
|
9 |
-
subprocess.check_call([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
class ModelHandler:
|
12 |
def __init__(self):
|
|
|
5 |
|
6 |
|
7 |
# Manually install bitsandbytes
|
8 |
+
def install(package):
|
9 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
|
10 |
+
|
11 |
+
try:
|
12 |
+
import bitsandbytes
|
13 |
+
except ImportError:
|
14 |
+
install("bitsandbytes==0.39.1")
|
15 |
+
|
16 |
+
try:
|
17 |
+
import accelerate
|
18 |
+
except ImportError:
|
19 |
+
install("accelerate==0.20.0")
|
20 |
|
21 |
class ModelHandler:
|
22 |
def __init__(self):
|