blob: fa60abf8505c94bd81e6fbfe9ff4390b72e6de44 (
plain)
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
|
{
lib,
buildPythonPackage,
fetchFromGitHub,
rustPlatform,
numpy,
triton,
torch,
}:
buildPythonPackage rec {
pname = "kbnf";
version = "0.4.2";
pyproject = true;
src = fetchFromGitHub {
owner = "Dan-wanna-M";
repo = "kbnf";
rev = "v${version}-python";
hash = "sha256-reefuqS0eExky9qtxBTqwxnZgK8AWFfkrN+VL/lFLyg=";
};
# Manually unarchived from tarball from pypi
postPatch = ''
cp ${./Cargo.lock} Cargo.lock
'';
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
};
build-system = [
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
dependencies = [
numpy
];
optional-dependencies = {
efficient_logits_mask = [
triton
];
torch = [
torch
];
};
pythonImportsCheck = [
"kbnf"
];
meta = {
description = "Fast constrained decoding engine based on context free grammar";
homepage = "https://pypi.org/project/kbnf/";
license = with lib.licenses; [
asl20
mit
];
maintainers = with lib.maintainers; [ BatteredBunny ];
};
}
|