2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, hatch-fancy-pypi-readme
|
|
|
|
, hatch-vcs
|
|
|
|
, hatchling
|
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
|
|
|
, pythonRelaxDepsHook
|
|
|
|
, accelerate
|
|
|
|
, bentoml
|
|
|
|
, bitsandbytes
|
|
|
|
, click
|
|
|
|
, datasets
|
|
|
|
, docker
|
|
|
|
, einops
|
|
|
|
, fairscale
|
|
|
|
, flax
|
2023-11-16 04:20:00 +00:00
|
|
|
, ghapi
|
2023-10-09 19:29:22 +00:00
|
|
|
, hypothesis
|
|
|
|
, ipython
|
|
|
|
, jax
|
|
|
|
, jaxlib
|
|
|
|
, jupyter
|
|
|
|
, jupytext
|
|
|
|
, keras
|
|
|
|
, nbformat
|
|
|
|
, notebook
|
|
|
|
, openai
|
|
|
|
, openllm-client
|
|
|
|
, openllm-core
|
|
|
|
, optimum
|
|
|
|
, peft
|
|
|
|
, pytest-mock
|
|
|
|
, pytest-randomly
|
|
|
|
, pytest-rerunfailures
|
|
|
|
, pytest-xdist
|
|
|
|
, ray
|
|
|
|
, safetensors
|
2023-11-16 04:20:00 +00:00
|
|
|
, scipy
|
2023-10-09 19:29:22 +00:00
|
|
|
, sentencepiece
|
|
|
|
, soundfile
|
|
|
|
, syrupy
|
|
|
|
, tabulate
|
|
|
|
, tensorflow
|
|
|
|
, 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
|
|
|
|
click
|
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
|
|
|
|
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;
|
|
|
|
baichuan = [
|
|
|
|
# cpm-kernels
|
|
|
|
sentencepiece
|
|
|
|
];
|
|
|
|
chatglm = [
|
|
|
|
# cpm-kernels
|
|
|
|
sentencepiece
|
|
|
|
];
|
|
|
|
falcon = [
|
|
|
|
einops
|
|
|
|
xformers
|
|
|
|
];
|
|
|
|
fine-tune = [
|
|
|
|
accelerate
|
|
|
|
bitsandbytes
|
|
|
|
datasets
|
|
|
|
peft
|
|
|
|
# trl
|
|
|
|
];
|
|
|
|
flan-t5 = [
|
|
|
|
flax
|
|
|
|
jax
|
|
|
|
jaxlib
|
|
|
|
keras
|
|
|
|
tensorflow
|
|
|
|
];
|
|
|
|
ggml = [
|
|
|
|
# ctransformers
|
|
|
|
];
|
|
|
|
gptq = [
|
|
|
|
# auto-gptq
|
2023-11-16 04:20:00 +00:00
|
|
|
optimum
|
2023-10-09 19:29:22 +00:00
|
|
|
]; # ++ autogptq.optional-dependencies.triton;
|
|
|
|
grpc = [
|
2023-11-16 04:20:00 +00:00
|
|
|
openllm-client
|
2023-10-09 19:29:22 +00:00
|
|
|
] ++ openllm-client.optional-dependencies.grpc;
|
|
|
|
llama = [
|
|
|
|
fairscale
|
|
|
|
sentencepiece
|
2023-11-16 04:20:00 +00:00
|
|
|
scipy
|
2023-10-09 19:29:22 +00:00
|
|
|
];
|
|
|
|
mpt = [
|
|
|
|
einops
|
|
|
|
openai-triton
|
|
|
|
];
|
|
|
|
openai = [
|
|
|
|
openai
|
|
|
|
tiktoken
|
2023-11-16 04:20:00 +00:00
|
|
|
] ++ openai.optional-dependencies.embeddings;
|
2023-10-09 19:29:22 +00:00
|
|
|
opt = [
|
|
|
|
flax
|
|
|
|
jax
|
|
|
|
jaxlib
|
|
|
|
keras
|
|
|
|
tensorflow
|
|
|
|
];
|
|
|
|
playground = [
|
|
|
|
ipython
|
|
|
|
jupyter
|
|
|
|
jupytext
|
|
|
|
nbformat
|
|
|
|
notebook
|
|
|
|
];
|
|
|
|
starcoder = [
|
|
|
|
bitsandbytes
|
|
|
|
];
|
|
|
|
vllm = [
|
|
|
|
ray
|
|
|
|
# vllm
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
full = with passthru.optional-dependencies; (
|
2023-10-09 19:29:22 +00:00
|
|
|
agents ++ baichuan ++ chatglm ++ falcon ++ fine-tune ++ flan-t5 ++ ggml ++ gptq ++ llama ++ mpt ++ openai ++ opt ++ playground ++ starcoder ++ vllm
|
|
|
|
);
|
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
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# these tests access to huggingface.co
|
|
|
|
"test_opt_125m"
|
|
|
|
"test_opt_125m"
|
|
|
|
"test_flan_t5"
|
|
|
|
"test_flan_t5"
|
|
|
|
];
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|