diff --git a/misc/py-peft/Makefile b/misc/py-peft/Makefile index 63507f40f150..300bb7f6a832 100644 --- a/misc/py-peft/Makefile +++ b/misc/py-peft/Makefile @@ -1,44 +1,52 @@ PORTNAME= peft -DISTVERSION= 0.17.1 -PORTREVISION= 2 +DISTVERSION= 0.19.0 CATEGORIES= misc python # machine-learning MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= yuri@FreeBSD.org COMMENT= Parameter-Efficient Fine-Tuning (PEFT) WWW= https://huggingface.co/docs/peft/index \ https://github.com/huggingface/peft LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}accelerate>=0.21.0:misc/py-accelerate@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}huggingface-hub>=0.25.0:misc/py-huggingface-hub@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}numpy1>=1.16:math/py-numpy1@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}packaging>=20.0:devel/py-packaging@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}psutil>0:sysutils/py-psutil@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pytorch>=1.13.0:misc/py-pytorch@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}safetensors>0:misc/py-safetensors@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}tqdm>0:misc/py-tqdm@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}transformers>0:misc/py-transformers@${PY_FLAVOR} TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}datasets>0:misc/py-datasets@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}diffusers>0:misc/py-diffusers@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}parameterized>0:devel/py-parameterized@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}protobuf>0:devel/py-protobuf@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pytest-cov>0:devel/py-pytest-cov@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pytest-xdist>0:devel/py-pytest-xdist@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}scipy>0:science/py-scipy@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}sentencepiece>0:textproc/py-sentencepiece@${PY_FLAVOR} USES= python USE_PYTHON= distutils autoplist pytest TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} +TEST_ARGS= -p no:relaxed + +post-patch: + @${TOUCH} ${WRKSRC}/tests/__init__.py NO_ARCH= yes -# tests fail to run, see https://github.com/huggingface/peft/issues/2789 +# tests as of 0.19.0: +# Results (885.15s): +# 70278 passed +# 3362 skipped +# 10 xfailed +# 18751 warnings .include diff --git a/misc/py-peft/distinfo b/misc/py-peft/distinfo index b4a8bb7b5348..9fe5447f18fd 100644 --- a/misc/py-peft/distinfo +++ b/misc/py-peft/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1758189811 -SHA256 (peft-0.17.1.tar.gz) = e6002b42517976c290b3b8bbb9829a33dd5d470676b2dec7cb4df8501b77eb9f -SIZE (peft-0.17.1.tar.gz) = 568192 +TIMESTAMP = 1776227230 +SHA256 (peft-0.19.0.tar.gz) = a2917070092184a462093443029bc4f9292a91b9b99880488e319309ff0a172d +SIZE (peft-0.19.0.tar.gz) = 762553 diff --git a/misc/py-peft/files/patch-pyproject.toml b/misc/py-peft/files/patch-pyproject.toml new file mode 100644 index 000000000000..3766106b990c --- /dev/null +++ b/misc/py-peft/files/patch-pyproject.toml @@ -0,0 +1,21 @@ +--- pyproject.toml.orig 2026-04-14 13:46:22 UTC ++++ pyproject.toml +@@ -34,14 +34,16 @@ known-first-party = ["peft"] + lines-after-imports = 2 + known-first-party = ["peft"] + +-[tool.pytest] ++[tool.pytest.ini_options] + doctest_optionflags = [ + "NORMALIZE_WHITESPACE", + "ELLIPSIS", + "NUMBER", + ] + +-addopts = ["--cov=src/peft", "--cov-report=term-missing", "--durations=10"] ++addopts = ["--durations=10"] ++testpaths = ["tests"] ++pythonpath = ["."] + + markers = [ + "single_gpu_tests: tests that run on a single GPU", diff --git a/misc/py-peft/files/patch-tests_test__mixed.py b/misc/py-peft/files/patch-tests_test__mixed.py new file mode 100644 index 000000000000..7e9d240efdcc --- /dev/null +++ b/misc/py-peft/files/patch-tests_test__mixed.py @@ -0,0 +1,13 @@ +--- tests/test_mixed.py.orig 2026-04-15 06:22:00 UTC ++++ tests/test_mixed.py +@@ -525,8 +525,8 @@ class TestMixedAdapterTypes(unittest.TestCase): + + def test_deeply_nested(self): + # a somewhat absurdly nested model using different adapter types +- if platform.system() == "Linux": +- pytest.skip("This test fails but only on GitHub CI with Linux systems.") ++ if self.torch_device != "cuda": ++ pytest.skip("This test requires CUDA to pass numerical precision checks.") + + atol = 1e-5 + rtol = 1e-5 diff --git a/misc/py-peft/files/patch-tests_testing__utils.py b/misc/py-peft/files/patch-tests_testing__utils.py new file mode 100644 index 000000000000..010d5206793e --- /dev/null +++ b/misc/py-peft/files/patch-tests_testing__utils.py @@ -0,0 +1,19 @@ +--- tests/testing_utils.py.orig 2026-04-15 06:22:00 UTC ++++ tests/testing_utils.py +@@ -177,11 +177,15 @@ def require_bitsandbytes(test_case): + + def require_bitsandbytes(test_case): + """ +- Decorator marking a test that requires the bitsandbytes library. Will be skipped when the library is not installed. ++ Decorator marking a test that requires the bitsandbytes library. Will be skipped when the library is not installed ++ or when CUDA is not available (8-bit optimizers require CUDA). + """ + try: + import bitsandbytes # noqa: F401 ++ import torch + ++ if not torch.cuda.is_available(): ++ return pytest.mark.skip(reason="test requires bitsandbytes with CUDA")(test_case) + test_case = pytest.mark.bitsandbytes(test_case) + except ImportError: + test_case = pytest.mark.skip(reason="test requires bitsandbytes")(test_case)