generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathflake.nix
More file actions
134 lines (118 loc) · 3.92 KB
/
flake.nix
File metadata and controls
134 lines (118 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
pyproject-nix.url = "github:pyproject-nix/pyproject.nix";
pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
flake-parts,
pyproject-nix,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } (
{ config, ... }:
{
systems = [
"x86_64-linux"
];
flake = {
lib = {
pyproject = pyproject-nix.lib.project.loadPyproject {
projectRoot = self;
};
};
};
perSystem =
{ pkgs, self', ... }@systemInputs:
let
python = pkgs.python3;
in
{
devShells.default = pkgs.mkShell {
# PATH-only packages:
packages =
with pkgs;
with python.pkgs;
with self'.packages;
[
llm-d-inference-sim
pdm
python
# choose either python-lsp-server or pyright:
basedpyright
# python-lsp-server
# pylsp-mypy
];
buildInputs =
with pkgs;
with python.pkgs;
[
numpy
torch
];
shellHook = ''
python -m venv .venv
source .venv/bin/activate
pdm sync -d --no-self
'';
};
packages = rec {
default = inference-perf;
inference-perf =
let
buildAttrs = self.lib.pyproject.renderers.buildPythonPackage {
inherit python;
};
in
python.pkgs.buildPythonPackage (buildAttrs // { });
llm-d-inference-sim = pkgs.buildGoModule rec {
pname = "llm-d-inference-sim";
version = "0.6.1";
src = pkgs.fetchFromGitHub {
owner = "llm-d";
repo = "llm-d-inference-sim";
tag = "v${version}";
hash = "sha256-KdA7dgdy1jGjRhrqXfkg4Z9V3SXPcKp1FnTtm+e5DSA=";
};
vendorHash = "sha256-MINH7J2ozTORFK/KgZvXBlwThYRISL1wlHebdZxvuvw=";
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
zeromq
libtokenizers
];
# several tests require networking.
doCheck = false;
meta = {
description = "A light weight vLLM simulator, for mocking out replicas";
homepage = "https://github.com/llm-d/llm-d-inference-sim";
license = with nixpkgs.lib.licenses; asl20;
mainProgram = "llm-d-inference-sim";
};
};
libtokenizers = pkgs.rustPlatform.buildRustPackage rec {
pname = "libtokenizers";
version = "1.22.1"; # keep same as llm-d-inference-sim's version
src = pkgs.fetchFromGitHub {
owner = "daulet";
repo = "tokenizers";
tag = "v${version}";
hash = "sha256-unGAXpD4GHWVFcXAwd0zU/u30wzH909tDcRYRPsSKwQ=";
};
cargoHash = "sha256-rY3YAcCbbx5CY6qu44Qz6UQhJlWVxAWdTaUSagHDn2o=";
meta = {
description = "Go bindings for Tiktoken & HuggingFace Tokenizer";
homepage = "https://github.com/daulet/tokenizers";
license = with nixpkgs.lib.licenses; mit;
};
};
};
};
}
);
}