Avoid clearing the whole build directory
Browse files- bench-TriLMs.py +8 -4
bench-TriLMs.py
CHANGED
@@ -41,15 +41,19 @@ def gather_models(sizes: Sequence[str] = MODEL_SIZES):
|
|
41 |
|
42 |
def build_llama_cpp(options: Sequence[str]):
|
43 |
logger.info("Building llama.cpp")
|
44 |
-
os.chdir(LLAMA_CPP_PATH)
|
45 |
builddir = LLAMA_CPP_PATH / "build"
|
46 |
if builddir.exists():
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
50 |
os.chdir(builddir)
|
51 |
os.system(shlex.join(("cmake", "..", *options)))
|
52 |
os.system(f"make -j{os.cpu_count()} llama-bench llama-quantize test-backend-ops")
|
|
|
53 |
|
54 |
|
55 |
def quantize(types: Sequence[str] = ALL_TYPES, sizes: Sequence[str] = MODEL_SIZES):
|
|
|
41 |
|
42 |
def build_llama_cpp(options: Sequence[str]):
|
43 |
logger.info("Building llama.cpp")
|
|
|
44 |
builddir = LLAMA_CPP_PATH / "build"
|
45 |
if builddir.exists():
|
46 |
+
# Clear previous config
|
47 |
+
cmake_cache = builddir / "CMakeCache.txt"
|
48 |
+
cmake_files = builddir / "CMakeFiles"
|
49 |
+
logger.info("Removing %s and %s", cmake_cache, cmake_files)
|
50 |
+
os.system(shlex.join(("rm", "-rf", str(cmake_cache), str(cmake_files))))
|
51 |
+
builddir.mkdir(exist_ok=True)
|
52 |
+
old_cwd = os.path.curdir
|
53 |
os.chdir(builddir)
|
54 |
os.system(shlex.join(("cmake", "..", *options)))
|
55 |
os.system(f"make -j{os.cpu_count()} llama-bench llama-quantize test-backend-ops")
|
56 |
+
os.chdir(old_cwd)
|
57 |
|
58 |
|
59 |
def quantize(types: Sequence[str] = ALL_TYPES, sizes: Sequence[str] = MODEL_SIZES):
|