2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, hatch-fancy-pypi-readme
|
|
|
|
, hatch-vcs
|
|
|
|
, hatchling
|
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
|
|
|
, pythonRelaxDepsHook
|
|
|
|
, accelerate
|
|
|
|
, bentoml
|
|
|
|
, bitsandbytes
|
2024-01-02 11:29:13 +00:00
|
|
|
, build
|
2023-10-09 19:29:22 +00:00
|
|
|
, click
|
2024-01-02 11:29:13 +00:00
|
|
|
, ctranslate2
|
2023-10-09 19:29:22 +00:00
|
|
|
, datasets
|
|
|
|
, docker
|
|
|
|
, einops
|
2023-11-16 04:20:00 +00:00
|
|
|
, ghapi
|
2024-01-02 11:29:13 +00:00
|
|
|
, huggingface-hub
|
2023-10-09 19:29:22 +00:00
|
|
|
, hypothesis
|
|
|
|
, ipython
|
|
|
|
, jupyter
|
|
|
|
, jupytext
|
|
|
|
, nbformat
|
|
|
|
, notebook
|
|
|
|
, openai
|
|
|
|
, openllm-client
|
|
|
|
, openllm-core
|
|
|
|
, optimum
|
|
|
|
, peft
|
|
|
|
, pytest-mock
|
|
|
|
, pytest-randomly
|
|
|
|
, pytest-rerunfailures
|
|
|
|
, pytest-xdist
|
|
|
|
, safetensors
|
2023-11-16 04:20:00 +00:00
|
|
|
, scipy
|
2023-10-09 19:29:22 +00:00
|
|
|
, sentencepiece
|
|
|
|
, soundfile
|
|
|
|
, syrupy
|
|
|
|
, tabulate
|
|
|
|
, tiktoken
|
|
|
|
, transformers
|
|
|
|
, openai-triton
|
|
|
|
, xformers
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
inherit (openllm-core) src version;
|
|
|
|
pname = "openllm";
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
2023-10-09 19:29:22 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
|
|
|
sourceRoot = "source/openllm-python";
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
hatch-fancy-pypi-readme
|
|
|
|
hatch-vcs
|
|
|
|
hatchling
|
|
|
|
pythonRelaxDepsHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonRemoveDeps = [
|
|
|
|
# remove cuda-python as it has an unfree license
|
|
|
|
"cuda-python"
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2023-11-16 04:20:00 +00:00
|
|
|
accelerate
|
2023-10-09 19:29:22 +00:00
|
|
|
bentoml
|
|
|
|
bitsandbytes
|
2024-01-02 11:29:13 +00:00
|
|
|
build
|
2023-10-09 19:29:22 +00:00
|
|
|
click
|
2024-01-02 11:29:13 +00:00
|
|
|
einops
|
2023-11-16 04:20:00 +00:00
|
|
|
ghapi
|
2023-10-09 19:29:22 +00:00
|
|
|
openllm-client
|
2023-11-16 04:20:00 +00:00
|
|
|
openllm-core
|
2023-10-09 19:29:22 +00:00
|
|
|
optimum
|
|
|
|
safetensors
|
2024-01-02 11:29:13 +00:00
|
|
|
scipy
|
|
|
|
sentencepiece
|
2023-10-09 19:29:22 +00:00
|
|
|
tabulate
|
|
|
|
transformers
|
|
|
|
] ++ bentoml.optional-dependencies.io
|
|
|
|
++ tabulate.optional-dependencies.widechars
|
|
|
|
++ transformers.optional-dependencies.tokenizers
|
|
|
|
++ transformers.optional-dependencies.torch;
|
|
|
|
|
|
|
|
passthru.optional-dependencies = {
|
|
|
|
agents = [
|
|
|
|
# diffusers
|
|
|
|
soundfile
|
|
|
|
transformers
|
|
|
|
] ++ transformers.optional-dependencies.agents;
|
2024-01-02 11:29:13 +00:00
|
|
|
awq = [
|
|
|
|
# autoawq
|
|
|
|
];
|
2023-10-09 19:29:22 +00:00
|
|
|
baichuan = [
|
|
|
|
# cpm-kernels
|
|
|
|
];
|
|
|
|
chatglm = [
|
|
|
|
# cpm-kernels
|
2024-01-02 11:29:13 +00:00
|
|
|
];
|
|
|
|
ctranslate = [
|
|
|
|
ctranslate2
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
|
|
|
falcon = [
|
|
|
|
xformers
|
|
|
|
];
|
|
|
|
fine-tune = [
|
|
|
|
datasets
|
2024-01-02 11:29:13 +00:00
|
|
|
huggingface-hub
|
2023-10-09 19:29:22 +00:00
|
|
|
peft
|
|
|
|
# trl
|
|
|
|
];
|
|
|
|
ggml = [
|
|
|
|
# ctransformers
|
|
|
|
];
|
|
|
|
gptq = [
|
|
|
|
# auto-gptq
|
|
|
|
]; # ++ autogptq.optional-dependencies.triton;
|
|
|
|
grpc = [
|
2024-01-02 11:29:13 +00:00
|
|
|
bentoml
|
|
|
|
] ++ bentoml.optional-dependencies.grpc;
|
2023-10-09 19:29:22 +00:00
|
|
|
mpt = [
|
|
|
|
openai-triton
|
|
|
|
];
|
|
|
|
openai = [
|
|
|
|
openai
|
|
|
|
tiktoken
|
2024-01-02 11:29:13 +00:00
|
|
|
] ++ openai.optional-dependencies.datalib;
|
2023-10-09 19:29:22 +00:00
|
|
|
playground = [
|
|
|
|
ipython
|
|
|
|
jupyter
|
|
|
|
jupytext
|
|
|
|
nbformat
|
|
|
|
notebook
|
|
|
|
];
|
|
|
|
starcoder = [
|
|
|
|
bitsandbytes
|
|
|
|
];
|
|
|
|
vllm = [
|
|
|
|
# vllm
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
full = with passthru.optional-dependencies; (
|
2024-01-02 11:29:13 +00:00
|
|
|
agents ++ awq ++ baichuan ++ chatglm ++ ctranslate ++ falcon ++ fine-tune ++ ggml ++ gptq ++ mpt ++ openai ++ playground ++ starcoder ++ vllm
|
2023-10-09 19:29:22 +00:00
|
|
|
);
|
2023-11-16 04:20:00 +00:00
|
|
|
all = passthru.optional-dependencies.full;
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
docker
|
|
|
|
hypothesis
|
|
|
|
pytest-mock
|
|
|
|
pytest-randomly
|
|
|
|
pytest-rerunfailures
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
syrupy
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
# skip GPUs test on CI
|
|
|
|
export GITHUB_ACTIONS=1
|
2023-11-16 04:20:00 +00:00
|
|
|
# disable hypothesis' deadline
|
|
|
|
export CI=1
|
2023-10-09 19:29:22 +00:00
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# require network access
|
|
|
|
"tests/models"
|
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
disabledTests = [
|
2024-01-02 11:29:13 +00:00
|
|
|
# incompatible with recent TypedDict
|
|
|
|
# https://github.com/bentoml/OpenLLM/blob/f3fd32d596253ae34c68e2e9655f19f40e05f666/openllm-python/tests/configuration_test.py#L18-L21
|
|
|
|
"test_missing_default"
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "openllm" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Operating LLMs in production";
|
|
|
|
homepage = "https://github.com/bentoml/OpenLLM/tree/main/openllm-python";
|
|
|
|
changelog = "https://github.com/bentoml/OpenLLM/blob/${src.rev}/CHANGELOG.md";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ happysalada natsukium ];
|
|
|
|
};
|
|
|
|
}
|