NiCEtmtm commited on
Commit
1a91849
1 Parent(s): c54b978

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +12 -2
handler.py CHANGED
@@ -5,8 +5,18 @@ import subprocess
5
 
6
 
7
  # Manually install bitsandbytes
8
- subprocess.check_call([os.sys.executable, "-m", "pip", "install", "bitsandbytes==0.39.1"])
9
- subprocess.check_call([os.sys.executable, "-m", "pip", "install", "accelerate==0.20.0"])
 
 
 
 
 
 
 
 
 
 
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):