python3Packages.{compressed-tensors,mistral-common,partial-json-parser}: init (#378782)

This commit is contained in:
Pavol Rusnak 2025-02-02 12:04:47 +01:00 committed by GitHub
commit 5daad7e208
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 171 additions and 0 deletions

View File

@ -0,0 +1,66 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
pydantic,
torch,
transformers,
nbconvert,
nbformat,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "compressed-tensors";
version = "0.9.1";
pyproject = true;
# Release on PyPI is missing the `utils` directory, which `setup.py` wants to import
src = fetchFromGitHub {
owner = "neuralmagic";
repo = pname;
tag = version;
hash = "sha256-AsbNFBvHxjiLl0T4JnQ5QrZdERUUYgS4iJvMRQytzN4=";
};
build-system = [ setuptools ];
dependencies = [
pydantic
torch
transformers
];
doCheck = true;
pythonImportsCheck = [ "compressed_tensors" ];
nativeCheckInputs = [
nbconvert
nbformat
pytestCheckHook
];
disabledTests = [
# these try to download models from HF Hub
"test_get_observer_token_count"
"test_kv_cache_quantization"
"test_target_prioritization"
"test_load_compressed_sharded"
"test_save_compressed_model"
"test_apply_tinyllama_dynamic_activations"
];
disabledTestPaths = [
# these try to download models from HF Hub
"tests/test_quantization/lifecycle/test_apply.py"
];
meta = with lib; {
description = "A safetensors extension to efficiently store sparse quantized tensors on disk";
homepage = "https://github.com/neuralmagic/compressed-tensors";
license = licenses.asl20;
maintainers = [ ];
};
}

View File

@ -0,0 +1,57 @@
{
lib,
buildPythonPackage,
fetchPypi,
poetry-core,
numpy,
pydantic,
jsonschema,
sentencepiece,
typing-extensions,
tiktoken,
pillow,
requests,
}:
buildPythonPackage rec {
pname = "mistral-common";
version = "1.5.2";
pyproject = true;
src = fetchPypi {
pname = "mistral_common";
inherit version;
hash = "sha256-nRFXsTdsSdNav8dD2+AITyyjezpavQPnQSdqG8ZshS8=";
};
# relax dependencies
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'pillow = "^10.3.0"' 'pillow = ">=10.3.0"' \
--replace-fail 'tiktoken = "^0.7.0"' 'tiktoken = ">=0.7.0"' \
'';
build-system = [ poetry-core ];
dependencies = [
numpy
pydantic
jsonschema
sentencepiece
typing-extensions
tiktoken
pillow
requests
];
doCheck = true;
pythonImportsCheck = [ "mistral_common" ];
meta = with lib; {
description = "mistral-common is a set of tools to help you work with Mistral models.";
homepage = "https://github.com/mistralai/mistral-common";
license = licenses.asl20;
maintainers = with maintainers; [ bgamari ];
};
}

View File

@ -0,0 +1,42 @@
{
lib,
buildPythonPackage,
fetchPypi,
pdm-backend,
tqdm,
hypothesis,
pytest,
}:
buildPythonPackage rec {
pname = "partial-json-parser";
version = "0.2.1.1.post5";
pyproject = true;
src = fetchPypi {
pname = "partial_json_parser";
inherit version;
hash = "sha256-mScQrGfpCzZ5IdUnJ2mJKAQPdxO6fsszuWNx6nrsgso=";
};
build-system = [ pdm-backend ];
dependencies = [ ];
doCheck = true;
pythonImportsCheck = [ "partial_json_parser" ];
dev-dependencies = [
hypothesis
tqdm
pytest
];
meta = with lib; {
description = "Parse partial JSON generated by LLM";
homepage = "https://github.com/promplate/partial-json-parser";
license = licenses.mit;
maintainers = [ ];
};
}

View File

@ -2586,6 +2586,8 @@ self: super: with self; {
compressed-rtf = callPackage ../development/python-modules/compressed-rtf { };
compressed-tensors = callPackage ../development/python-modules/compressed-tensors { };
concurrent-log-handler = callPackage ../development/python-modules/concurrent-log-handler { };
conda = callPackage ../development/python-modules/conda { };
@ -8276,6 +8278,8 @@ self: super: with self; {
mistletoe = callPackage ../development/python-modules/mistletoe { };
mistral-common = callPackage ../development/python-modules/mistral-common { };
mistune = callPackage ../development/python-modules/mistune { };
mitmproxy = callPackage ../development/python-modules/mitmproxy { };
@ -10088,6 +10092,8 @@ self: super: with self; {
partd = callPackage ../development/python-modules/partd { };
partial-json-parser = callPackage ../development/python-modules/partial-json-parser { };
parts = callPackage ../development/python-modules/parts { };
particle = callPackage ../development/python-modules/particle { };