summaryrefslogtreecommitdiff
path: root/llama.cpp/.devops/nix/python-scripts.nix
diff options
context:
space:
mode:
Diffstat (limited to 'llama.cpp/.devops/nix/python-scripts.nix')
-rw-r--r--llama.cpp/.devops/nix/python-scripts.nix66
1 files changed, 66 insertions, 0 deletions
diff --git a/llama.cpp/.devops/nix/python-scripts.nix b/llama.cpp/.devops/nix/python-scripts.nix
new file mode 100644
index 0000000..56ea182
--- /dev/null
+++ b/llama.cpp/.devops/nix/python-scripts.nix
@@ -0,0 +1,66 @@
+{
+ lib,
+ stdenv,
+ buildPythonPackage,
+ poetry-core,
+ mkShell,
+ python3Packages,
+ gguf-py,
+}@inputs:
+
+let
+ llama-python-deps = with python3Packages; [
+ numpy
+ sentencepiece
+ transformers
+ protobuf
+ torchWithoutCuda
+ gguf-py
+ tqdm
+
+ # for scripts/compare-llama-bench.py
+ gitpython
+ tabulate
+
+ # for examples/pydantic-models-to-grammar-examples.py
+ docstring-parser
+ pydantic
+
+ ];
+
+ llama-python-test-deps = with python3Packages; [
+ # Server bench
+ matplotlib
+
+ # server tests
+ openai
+ pytest
+ prometheus-client
+ ];
+in
+
+buildPythonPackage ({
+ pname = "llama-scripts";
+ version = "0.0.0";
+ pyproject = true;
+
+ # NOTE: The files filtered out here are not visible in the build sandbox, neither
+ # do they affect the output hash. They can be modified without triggering a rebuild.
+ src = lib.cleanSourceWith {
+ filter =
+ name: type:
+ let
+ any = builtins.any (x: x);
+ baseName = builtins.baseNameOf name;
+ in
+ any [
+ (lib.hasSuffix ".py" name)
+ (baseName == "README.md")
+ (baseName == "pyproject.toml")
+ ];
+ src = lib.cleanSource ../../.;
+ };
+ nativeBuildInputs = [ poetry-core ];
+ nativeCheckInputs = llama-python-test-deps;
+ dependencies = llama-python-deps;
+})