python3Packages.gguf: modernize, adopt, disable optional sentencepiece on Darwin (#466349)
This commit is contained in:
@@ -1,40 +1,62 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
fetchPypi,
|
||||
pythonOlder,
|
||||
numpy,
|
||||
fetchFromGitHub,
|
||||
|
||||
# build-system
|
||||
poetry-core,
|
||||
|
||||
# dependencies
|
||||
numpy,
|
||||
pyside6,
|
||||
pyyaml,
|
||||
sentencepiece,
|
||||
tqdm,
|
||||
|
||||
# check inputs
|
||||
pytestCheckHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "gguf";
|
||||
version = "0.17.1";
|
||||
format = "pyproject";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-Nq1xqtkAo+dfyU6+lupgKfA6TkS+difvetPQPox7y1M=";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ggml-org";
|
||||
repo = "llama.cpp";
|
||||
tag = "gguf-v${version}";
|
||||
hash = "sha256-XjDMDca4pyc72WQee4h3R6Iq9M0LzO+6ukV6CBWQO1M=";
|
||||
};
|
||||
|
||||
sourceRoot = "${src.name}/gguf-py";
|
||||
|
||||
build-system = [ poetry-core ];
|
||||
|
||||
dependencies = [
|
||||
numpy
|
||||
poetry-core
|
||||
pyside6
|
||||
pyyaml
|
||||
sentencepiece
|
||||
tqdm
|
||||
]
|
||||
# Sentencepiece is optional and its inclusion crashes darwin
|
||||
# See https://github.com/NixOS/nixpkgs/issues/466092
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
sentencepiece
|
||||
];
|
||||
|
||||
nativeCheckInputs = [ pytestCheckHook ];
|
||||
|
||||
pythonImportsCheck = [ "gguf" ];
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
description = "Module for writing binary files in the GGUF format";
|
||||
homepage = "https://ggml.ai/";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ mitchmindtree ];
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [
|
||||
mitchmindtree
|
||||
sarahec
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user