Quantise: apt-install cmake before building llama-quantize
Browse files- quantise_securecoder.py +12 -2
quantise_securecoder.py
CHANGED
|
@@ -71,7 +71,17 @@ def main() -> int:
|
|
| 71 |
|
| 72 |
src_path = Path(src)
|
| 73 |
|
| 74 |
-
# Pull llama.cpp's converter + quantiser
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
log.info("fetching llama.cpp ...")
|
| 76 |
llama_dir = work / "llama.cpp"
|
| 77 |
subprocess.run([
|
|
@@ -79,7 +89,7 @@ def main() -> int:
|
|
| 79 |
"https://github.com/ggml-org/llama.cpp", str(llama_dir),
|
| 80 |
], check=True)
|
| 81 |
subprocess.run(["pip", "install", "-q", "-r", str(llama_dir / "requirements" / "requirements-convert_hf_to_gguf.txt")],
|
| 82 |
-
check=
|
| 83 |
|
| 84 |
f16_dir = work / "gguf-f16"
|
| 85 |
f16_dir.mkdir(exist_ok=True)
|
|
|
|
| 71 |
|
| 72 |
src_path = Path(src)
|
| 73 |
|
| 74 |
+
# Pull llama.cpp's converter + quantiser. We need cmake + make to build
|
| 75 |
+
# llama-quantize; the container does not ship them, so apt-install them
|
| 76 |
+
# up front.
|
| 77 |
+
log.info("ensuring cmake / make are present ...")
|
| 78 |
+
try:
|
| 79 |
+
subprocess.run(["cmake", "--version"], check=True, stdout=subprocess.DEVNULL)
|
| 80 |
+
except Exception: # noqa: BLE001
|
| 81 |
+
log.info("installing cmake via apt ...")
|
| 82 |
+
subprocess.run(["apt-get", "update", "-qq"], check=True)
|
| 83 |
+
subprocess.run(["apt-get", "install", "-y", "-qq", "cmake", "build-essential"], check=True)
|
| 84 |
+
|
| 85 |
log.info("fetching llama.cpp ...")
|
| 86 |
llama_dir = work / "llama.cpp"
|
| 87 |
subprocess.run([
|
|
|
|
| 89 |
"https://github.com/ggml-org/llama.cpp", str(llama_dir),
|
| 90 |
], check=True)
|
| 91 |
subprocess.run(["pip", "install", "-q", "-r", str(llama_dir / "requirements" / "requirements-convert_hf_to_gguf.txt")],
|
| 92 |
+
check=True)
|
| 93 |
|
| 94 |
f16_dir = work / "gguf-f16"
|
| 95 |
f16_dir.mkdir(exist_ok=True)
|