1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, accelerate
6, attrs
7, bitsandbytes
8, bentoml
9, cattrs
10, click-option-group
11, datasets
12, deepmerge
13, hatch-fancy-pypi-readme
14, hatch-vcs
15, hatchling
16, inflection
17, mypy-extensions
18, orjson
19, peft
20, transformers
21, typing-extensions
22}:
23
24buildPythonPackage rec {
25 pname = "openllm-core";
26 version = "0.4.22";
27 pyproject = true;
28
29 disabled = pythonOlder "3.8";
30
31 src = fetchFromGitHub {
32 owner = "bentoml";
33 repo = "OpenLLM";
34 rev = "refs/tags/v${version}";
35 hash = "sha256-Hgwc4rneY0d7KZHuBIWRpndLksts5DTvaYuwZOO4sdI=";
36 };
37
38 sourceRoot = "source/openllm-core";
39
40 nativeBuildInputs = [
41 hatch-fancy-pypi-readme
42 hatch-vcs
43 hatchling
44 ];
45
46 propagatedBuildInputs = [
47 attrs
48 cattrs
49 # not listed in pyproject.toml, but required at runtime
50 click-option-group
51 deepmerge
52 inflection
53 mypy-extensions
54 orjson
55 typing-extensions
56 ];
57
58 passthru.optional-dependencies = {
59 vllm = [
60 # vllm
61 ];
62 bentoml = [
63 bentoml
64 ];
65 fine-tune = [
66 accelerate
67 bitsandbytes
68 datasets
69 peft
70 transformers
71 # trl
72 ] ++ transformers.optional-dependencies.torch
73 ++ transformers.optional-dependencies.tokenizers
74 ++ transformers.optional-dependencies.accelerate;
75 full = with passthru.optional-dependencies; ( vllm ++ bentoml ++ fine-tune );
76 };
77
78 # there is no tests
79 doCheck = false;
80
81 pythonImportsCheck = [ "openllm_core" ];
82
83 meta = with lib; {
84 description = "Core components for OpenLLM";
85 homepage = "https://github.com/bentoml/OpenLLM/tree/main/openllm-core";
86 changelog = "https://github.com/bentoml/OpenLLM/blob/${src.rev}/CHANGELOG.md";
87 license = licenses.asl20;
88 maintainers = with maintainers; [ natsukium ];
89 };
90}