1
0

python-scripts.nix 1.3 KB

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