Skip to content

Commit f090d8d

Browse files
signalpillarVolodymyr Vitvitskyi
authored andcommitted
flake : build llama.cpp on Intel with nix (ggml-org#2795)
Problem ------- `nix build` fails with missing `Accelerate.h`. Changes ------- - Fix build of the llama.cpp with nix for Intel: add the same SDK frameworks as for ARM - Add `quantize` app to the output of nix flake - Extend nix devShell with llama-python so we can use convertScript Testing ------- Testing the steps with nix: 1. `nix build` Get the model and then 2. `nix develop` and then `python convert.py models/llama-2-7b.ggmlv3.q4_0.bin` 3. `nix run llama.cpp#quantize -- open_llama_7b/ggml-model-f16.gguf ./models/ggml-model-q4_0.bin 2` 4. `nix run llama.cpp#llama -- -m models/ggml-model-q4_0.bin -p "What is nix?" -n 400 --temp 0.8 -e -t 8` Co-authored-by: Volodymyr Vitvitskyi <[email protected]>
1 parent 958e2b4 commit f090d8d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

flake.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
CoreGraphics
2222
CoreVideo
2323
]
24+
else if isDarwin then
25+
with pkgs.darwin.apple_sdk.frameworks; [
26+
Accelerate
27+
CoreGraphics
28+
CoreVideo
29+
]
2430
else
2531
with pkgs; [ openblas ]
2632
);
@@ -80,8 +86,13 @@
8086
type = "app";
8187
program = "${self.packages.${system}.default}/bin/llama";
8288
};
89+
apps.quantize = {
90+
type = "app";
91+
program = "${self.packages.${system}.default}/bin/quantize";
92+
};
8393
apps.default = self.apps.${system}.llama;
8494
devShells.default = pkgs.mkShell {
95+
buildInputs = [ llama-python ];
8596
packages = nativeBuildInputs ++ osSpecific;
8697
};
8798
});

0 commit comments

Comments
 (0)