hf_text-generation-inference/flake.nix

136 lines
3.5 KiB
Nix
Raw Normal View History

{
inputs = {
crate2nix = {
url = "github:nix-community/crate2nix";
inputs.nixpkgs.follows = "tgi-nix/nixpkgs";
};
tgi-nix.url = "github:danieldk/tgi-nix";
nixpkgs.follows = "tgi-nix/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "tgi-nix/nixpkgs";
};
2024-08-12 10:09:16 -06:00
poetry2nix.url = "github:nix-community/poetry2nix";
2024-08-09 07:24:21 -06:00
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "tgi-nix/nixpkgs";
};
};
outputs =
{
self,
crate2nix,
naersk,
nixpkgs,
flake-utils,
2024-08-09 07:24:21 -06:00
rust-overlay,
tgi-nix,
2024-08-12 10:09:16 -06:00
poetry2nix,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
cargoNix = crate2nix.tools.${system}.appliedCargoNix {
name = "tgi";
src = ./.;
};
config = {
allowUnfree = true;
cudaSupport = true;
};
pkgs = import nixpkgs {
inherit config system;
2024-08-09 07:24:21 -06:00
overlays = [
rust-overlay.overlays.default
tgi-nix.overlay
];
};
naersk' = pkgs.callPackage naersk { };
router =
with pkgs;
naersk'.buildPackage {
name = "router";
src = ./.;
cargoBuildOptions =
x:
x
++ [
"-p"
"text-generation-router-v3"
];
nativeBuildInputs = [ pkg-config ];
buildInputs = [
openssl.dev
protobuf
];
doCheck = false;
};
2024-08-12 10:09:16 -06:00
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryEditablePackage;
text-generation-server = mkPoetryEditablePackage { editablePackageSources = ./server; };
in
{
defaultPackage = router;
devShells.default =
with pkgs;
mkShell {
buildInputs =
[
openssl.dev
pkg-config
2024-08-09 07:24:21 -06:00
(rust-bin.stable.latest.default.override {
extensions = [
"rust-analyzer"
"rust-src"
];
})
]
++ (with python3.pkgs; [
venvShellHook
pip
2024-08-13 02:49:18 -06:00
causal-conv1d
2024-08-12 10:09:16 -06:00
click
einops
2024-08-14 00:49:58 -06:00
exllamav2
fbgemm-gpu
2024-08-12 10:09:16 -06:00
flashinfer
flash-attn
flash-attn-layer-norm
flash-attn-rotary
grpc-interceptor
grpcio-reflection
grpcio-status
2024-08-12 10:09:16 -06:00
grpcio-tools
hf-transfer
loguru
2024-08-13 02:49:18 -06:00
mamba-ssm
marlin-kernels
opentelemetry-api
opentelemetry-exporter-otlp
opentelemetry-instrumentation-grpc
opentelemetry-semantic-conventions
peft
tokenizers
torch
transformers
vllm
cargoNix.workspaceMembers.text-generation-launcher.build
router
]);
venvDir = "./.venv";
postVenv = ''
unset SOURCE_DATE_EPOCH
'';
postShellHook = ''
unset SOURCE_DATE_EPOCH
'';
};
}
);
}