1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 poetry-core,
6 mkShell,
7 python3Packages,
8 gguf-py,
9}@inputs:
10
11let
12 llama-python-deps = with python3Packages; [
13 numpy
14 sentencepiece
15 transformers
16 protobuf
17 torchWithoutCuda
18 gguf-py
19 tqdm
20
21 # for scripts/compare-llama-bench.py
22 gitpython
23 tabulate
24
25 # for examples/pydantic-models-to-grammar-examples.py
26 docstring-parser
27 pydantic
28
29 ];
30
31 llama-python-test-deps = with python3Packages; [
32 # Server bench
33 matplotlib
34
35 # server tests
36 openai
37 pytest
38 prometheus-client
39 ];
40in
41
42buildPythonPackage ({
43 pname = "llama-scripts";
44 version = "0.0.0";
45 pyproject = true;
46
47 # NOTE: The files filtered out here are not visible in the build sandbox, neither
48 # do they affect the output hash. They can be modified without triggering a rebuild.
49 src = lib.cleanSourceWith {
50 filter =
51 name: type:
52 let
53 any = builtins.any (x: x);
54 baseName = builtins.baseNameOf name;
55 in
56 any [
57 (lib.hasSuffix ".py" name)
58 (baseName == "README.md")
59 (baseName == "pyproject.toml")
60 ];
61 src = lib.cleanSource ../../.;
62 };
63 nativeBuildInputs = [ poetry-core ];
64 nativeCheckInputs = llama-python-test-deps;
65 dependencies = llama-python-deps;
66})