ffreemt commited on
Commit
fae4857
1 Parent(s): dec88ff

Update overwrite libbitsandbytes_cpu.so with libbitsandbytes_cuda118.so lsb_release -a bitsandbytes device_map={'': 0} rich, check nvidia-smi with subproces.run

Browse files
Files changed (3) hide show
  1. .ruff.toml +2 -1
  2. app.py +5 -9
  3. run_cmd.py +15 -0
.ruff.toml CHANGED
@@ -12,6 +12,7 @@ select = ["F", "E", "W", "I001", "YTT", "D", "PLC"]
12
  # D101 Missing docstring in public class
13
  # `multi-line-summary-first-line` (D212)
14
  # `one-blank-line-before-class` (D203)
15
- extend-ignore = ["D103", "D101", "D212", "D203"]
 
16
 
17
  exclude = [".venv"]
 
12
  # D101 Missing docstring in public class
13
  # `multi-line-summary-first-line` (D212)
14
  # `one-blank-line-before-class` (D203)
15
+ # E402 Module level import not at top of file
16
+ extend-ignore = ["D103", "D101", "D212", "D203", "E402"]
17
 
18
  exclude = [".venv"]
app.py CHANGED
@@ -32,6 +32,11 @@ GenerationConfig {
32
  }
33
  """
34
  # pylint: disable=line-too-long, invalid-name, no-member, redefined-outer-name, missing-function-docstring, missing-class-docstring, broad-except,
 
 
 
 
 
35
  import gc
36
  import os
37
  import subprocess as sp
@@ -60,15 +65,6 @@ except Exception:
60
  logger.warning("Windows, cant run time.tzset()")
61
 
62
 
63
- def run_cmd(cmd):
64
- """Execute cmd."""
65
- logger.info(f"{cmd=}")
66
- ret = sp.run(cmd, capture_output=1, check=0, shell=1, encoding='utf8')
67
- if ret.stdout:
68
- rich.print(ret.stdout)
69
- if ret.stderr:
70
- rich.print("[red bold]" + ret.stdout)
71
-
72
  # /home/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/bitsandbytes
73
 
74
 
 
32
  }
33
  """
34
  # pylint: disable=line-too-long, invalid-name, no-member, redefined-outer-name, missing-function-docstring, missing-class-docstring, broad-except,
35
+ from run_cmd import run_cmd # noqa
36
+
37
+ # overwrite libbitsandbytes_cpu.so with libbitsandbytes_cuda118.so
38
+ run_cmd("cd /home/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/bitsandbytes; cp libbitsandbytes_cuda118.so libbitsandbytes_cpu.so") # noqa
39
+
40
  import gc
41
  import os
42
  import subprocess as sp
 
65
  logger.warning("Windows, cant run time.tzset()")
66
 
67
 
 
 
 
 
 
 
 
 
 
68
  # /home/user/.pyenv/versions/3.10.13/lib/python3.10/site-packages/bitsandbytes
69
 
70
 
run_cmd.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Run a command."""
2
+ import subprocess as sp
3
+
4
+ import rich
5
+ from loguru import logger
6
+
7
+
8
+ def run_cmd(cmd):
9
+ """Execute cmd."""
10
+ logger.info(f"{cmd=}")
11
+ ret = sp.run(cmd, capture_output=1, check=0, shell=1, encoding='utf8')
12
+ if ret.stdout:
13
+ rich.print(ret.stdout)
14
+ if ret.stderr:
15
+ rich.print("[red bold]" + ret.stdout)