mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
python312Packages.xgrammar: 0.1.11 -> 0.1.14 (#386255)
This commit is contained in:
@@ -3,57 +3,63 @@
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
|
||||
# build-system
|
||||
cmake,
|
||||
ninja,
|
||||
pip,
|
||||
pytestCheckHook,
|
||||
python3,
|
||||
pybind11,
|
||||
scikit-build-core,
|
||||
|
||||
# dependencies
|
||||
pydantic,
|
||||
sentencepiece,
|
||||
tiktoken,
|
||||
torch,
|
||||
transformers,
|
||||
triton,
|
||||
|
||||
# tests
|
||||
pytestCheckHook,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "xgrammar";
|
||||
version = "0.1.11";
|
||||
format = "other";
|
||||
version = "0.1.14";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mlc-ai";
|
||||
repo = pname;
|
||||
repo = "xgrammar";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-q5d8/9S9p9M8HlCIernT9IwPEDnbC1R9nGsLuS15RXY=";
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-ohsoc3g5XUp9vSXxyOGj20wXzCXZC02ktHYVQjDqNeM=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
build-system = [
|
||||
cmake
|
||||
ninja
|
||||
pybind11
|
||||
scikit-build-core
|
||||
];
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
buildInputs = [ pip ];
|
||||
dependencies =
|
||||
[
|
||||
pydantic
|
||||
sentencepiece
|
||||
tiktoken
|
||||
torch
|
||||
transformers
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64) [
|
||||
triton
|
||||
];
|
||||
|
||||
dontUseNinjaInstall = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cd ../python
|
||||
${python3.interpreter} -m pip install --prefix=$out .
|
||||
cd ..
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [ pytestCheckHook ];
|
||||
|
||||
preCheck = ''
|
||||
cd tests/python/
|
||||
'';
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
disabledTests = [
|
||||
# You are trying to access a gated repo.
|
||||
@@ -64,27 +70,18 @@ buildPythonPackage rec {
|
||||
"test_grammar_matcher_json_schema"
|
||||
"test_grammar_matcher_tag_dispatch"
|
||||
"test_regex_converter"
|
||||
"test_tokenizer_info"
|
||||
|
||||
# Torch not compiled with CUDA enabled
|
||||
"test_token_bitmask_operations"
|
||||
# You are trying to access a gated repo.
|
||||
"test_tokenizer_info"
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "xgrammar" ];
|
||||
|
||||
dependencies = [
|
||||
pybind11
|
||||
pydantic
|
||||
sentencepiece
|
||||
tiktoken
|
||||
torch
|
||||
transformers
|
||||
triton
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
description = "Efficient, Flexible and Portable Structured Generation";
|
||||
homepage = "https://xgrammar.mlc.ai";
|
||||
license = licenses.asl20;
|
||||
changelog = "https://github.com/mlc-ai/xgrammar/releases/tag/v${version}";
|
||||
license = lib.licenses.asl20;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user