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