From c6d5039cd7c05c9d1323b94844ca30ab593f21f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 9 Aug 2024 12:32:37 +0200 Subject: [PATCH] Add experimental flake (#2384) Add flake.nix --- flake.lock | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 73 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..bf06240f --- /dev/null +++ b/flake.lock @@ -0,0 +1,99 @@ +{ + "nodes": { + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1723099294, + "narHash": "sha256-kkijy6sXo/SOhFw7ZEfYHbj1FJHxoeetOVOn3qNHc5o=", + "owner": "danieldk", + "repo": "nixpkgs", + "rev": "45892b6ec142eaf300d777926983a433b5842c88", + "type": "github" + }, + "original": { + "owner": "danieldk", + "ref": "cudnn-9.3", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "tgi-nix", + "nixpkgs" + ], + "tgi-nix": "tgi-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "tgi-nix": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1723188417, + "narHash": "sha256-GXdFuRMU9N9W0CryUTJIWhJkGwQFHSR2EW5xR0ZyBjk=", + "owner": "danieldk", + "repo": "tgi-nix", + "rev": "491db7e234ecf79513ddb94da6ecc14167b9c0b3", + "type": "github" + }, + "original": { + "owner": "danieldk", + "repo": "tgi-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..c17950c1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,73 @@ +{ + inputs = { + tgi-nix.url = "github:danieldk/tgi-nix"; + nixpkgs.follows = "tgi-nix/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = + { + self, + nixpkgs, + flake-utils, + tgi-nix, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + config = { + allowUnfree = true; + cudaSupport = true; + }; + pkgs = import nixpkgs { + inherit config system; + overlays = [ tgi-nix.overlay ]; + }; + in + { + devShells.default = + with pkgs; + mkShell { + buildInputs = + [ + cargo + openssl.dev + pkg-config + ] + ++ (with python3.pkgs; [ + venvShellHook + pip + + einops + fbgemm-gpu + flash-attn + flash-attn-layer-norm + flash-attn-rotary + grpc-interceptor + grpcio-reflection + grpcio-status + hf-transfer + loguru + marlin-kernels + opentelemetry-api + opentelemetry-exporter-otlp + opentelemetry-instrumentation-grpc + opentelemetry-semantic-conventions + peft + tokenizers + torch + transformers + vllm + ]); + + venvDir = "./.venv"; + + postVenv = '' + unset SOURCE_DATE_EPOCH + ''; + postShellHook = '' + unset SOURCE_DATE_EPOCH + ''; + }; + } + ); +}