forked from ggml-org/llama.cpp
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Nix flake * Nix: only add Accelerate framework on macOS * Nix: development shel, direnv and compatibility * Nix: use python packages supplied by withPackages * Nix: remove channel compatibility * Nix: fix ARM neon dotproduct on macOS --------- Co-authored-by: Pavol Rusnak <[email protected]>
- Loading branch information
1 parent
c9f670a
commit a292747
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,10 @@ models/* | |
|
||
/main | ||
/quantize | ||
/result | ||
|
||
arm_neon.h | ||
compile_commands.json | ||
|
||
.envrc | ||
.direnv/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
}; | ||
llama-python = pkgs.python310.withPackages (ps: with ps; [ | ||
torch | ||
numpy | ||
sentencepiece | ||
]); | ||
in | ||
{ | ||
packages.default = pkgs.stdenv.mkDerivation { | ||
name = "llama.cpp"; | ||
src = ./.; | ||
nativeBuildInputs = with pkgs; [ cmake ]; | ||
buildInputs = with pkgs; lib.optionals stdenv.isDarwin [ | ||
darwin.apple_sdk.frameworks.Accelerate | ||
]; | ||
cmakeFlags = with pkgs; lib.optionals (system == "aarch64-darwin") [ | ||
"-DCMAKE_C_FLAGS=-D__ARM_FEATURE_DOTPROD=1" | ||
]; | ||
installPhase = '' | ||
mkdir -p $out/bin | ||
mv llama $out/bin/llama | ||
mv quantize $out/bin/quantize | ||
echo "#!${llama-python}/bin/python" > $out/bin/convert-pth-to-ggml | ||
cat ${./convert-pth-to-ggml.py} >> $out/bin/convert-pth-to-ggml | ||
chmod +x $out/bin/convert-pth-to-ggml | ||
''; | ||
}; | ||
devShells.default = pkgs.mkShell { | ||
packages = with pkgs; [ | ||
cmake | ||
llama-python | ||
] ++ lib.optionals stdenv.isDarwin [ | ||
darwin.apple_sdk.frameworks.Accelerate | ||
]; | ||
}; | ||
} | ||
); | ||
} |