diff --git a/_server.nix b/_server.nix new file mode 100644 index 00000000..bc11ba6b --- /dev/null +++ b/_server.nix @@ -0,0 +1,12 @@ +{ mkPoetryApplication, pkg-config, protobuf, openssl }: + +mkPoetryApplication { + # name = "text-generation-server"; + + projectDir = ./server; + + # nativeBuildInputs = [ pkg-config ]; + + # buildInputs = [ openssl.dev protobuf ]; + +} diff --git a/flake.lock b/flake.lock index 7889e7cf..47f14626 100644 --- a/flake.lock +++ b/flake.lock @@ -33,19 +33,96 @@ "type": "github" } }, - "nixpkgs": { + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1723099294, - "narHash": "sha256-kkijy6sXo/SOhFw7ZEfYHbj1FJHxoeetOVOn3qNHc5o=", - "owner": "danieldk", - "repo": "nixpkgs", - "rev": "45892b6ec142eaf300d777926983a433b5842c88", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { - "owner": "danieldk", - "ref": "cudnn-9.3", + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703863825, + "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1719763542, + "narHash": "sha256-mXkOj9sJ0f69Nkc2dGGOWtof9d1YNY8Le/Hia3RN+8Q=", + "owner": "NixOS", "repo": "nixpkgs", + "rev": "e6cdd8a11b26b4d60593733106042141756b54a3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1723418128, + "narHash": "sha256-k1pEqsnB6ikZyasXbtV6A9akPZMKlsyENPDUA6PXoJo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "129f579cbb5b4c1ad258fd96bdfb78eb14802727", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_2", + "nix-github-actions": "nix-github-actions", + "nixpkgs": "nixpkgs", + "systems": "systems_3", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1723343306, + "narHash": "sha256-/6sRkPq7/5weX2y0V8sQ29Sz35nt8kyj+BsFtkhgbJE=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "4a1c112ff0c67f496573dc345bd0b2247818fc29", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", "type": "github" } }, @@ -56,6 +133,7 @@ "tgi-nix", "nixpkgs" ], + "poetry2nix": "poetry2nix", "rust-overlay": "rust-overlay", "tgi-nix": "tgi-nix" } @@ -68,11 +146,11 @@ ] }, "locked": { - "lastModified": 1723170066, - "narHash": "sha256-SFkQfOA+8AIYJsPlQtxNP+z5jRLfz91z/aOrV94pPmw=", + "lastModified": 1723429325, + "narHash": "sha256-4x/32xTCd+xCwFoI/kKSiCr5LQA2ZlyTRYXKEni5HR8=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "fecfe4d7c96fea2982c7907997b387a6b52c1093", + "rev": "65e3dc0fe079fe8df087cd38f1fe6836a0373aad", "type": "github" }, "original": { @@ -96,17 +174,46 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, "tgi-nix": { "inputs": { "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1723234585, - "narHash": "sha256-HChJpNP155FPhHr9C5BtqllV8Uv/Ebg59HhMc/HhQrc=", + "lastModified": 1723450799, + "narHash": "sha256-cuT/ce7R2D5Lx6Ted4YS4y+WrAAOXQFAbzLsM1vtPo8=", "owner": "danieldk", "repo": "tgi-nix", - "rev": "15bd4a978d6c2c8b04b7afc335d137dbe41e73df", + "rev": "29f9b45bd613eced65c4a5241a00aa9346f63d90", "type": "github" }, "original": { @@ -114,6 +221,27 @@ "repo": "tgi-nix", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719749022, + "narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 761c4af8..1f842e8e 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ tgi-nix.url = "github:danieldk/tgi-nix"; nixpkgs.follows = "tgi-nix/nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; + poetry2nix.url = "github:nix-community/poetry2nix"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "tgi-nix/nixpkgs"; @@ -15,6 +16,7 @@ flake-utils, rust-overlay, tgi-nix, + poetry2nix, }: flake-utils.lib.eachDefaultSystem ( system: @@ -30,6 +32,11 @@ tgi-nix.overlay ]; }; + + inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryEditablePackage; + text-generation-server = mkPoetryEditablePackage { + editablePackageSources = ./server; + }; in { devShells.default = @@ -50,14 +57,17 @@ venvShellHook pip + click einops fbgemm-gpu + flashinfer flash-attn flash-attn-layer-norm flash-attn-rotary grpc-interceptor grpcio-reflection grpcio-status + grpcio-tools hf-transfer loguru marlin-kernels