diff --git a/pkgs/development/python-modules/lm-eval/default.nix b/pkgs/development/python-modules/lm-eval/default.nix index 5346109286e1..3bbaae0ce9e6 100644 --- a/pkgs/development/python-modules/lm-eval/default.nix +++ b/pkgs/development/python-modules/lm-eval/default.nix @@ -34,6 +34,8 @@ tenacity, tiktoken, tqdm, + # dscrim_eval + statsmodels, # hf_transfer hf-transfer, # ifeval @@ -62,16 +64,16 @@ writableTmpDirAsHomeHook, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "lm-eval"; - version = "0.4.9.1"; + version = "0.4.9.2"; pyproject = true; src = fetchFromGitHub { owner = "EleutherAI"; repo = "lm-evaluation-harness"; - tag = "v${version}"; - hash = "sha256-N5NRRabjWxPchwOIkjqYTCKInCmVSY6T5cAmdxNbCkU="; + tag = "v${finalAttrs.version}"; + hash = "sha256-Foz49XfIIzGJkgzjBu9P1J9cwYjl3fjAAJG9GKRwfq8="; }; build-system = [ @@ -108,6 +110,7 @@ buildPythonPackage rec { tiktoken tqdm ]; + discrim_eval = [ statsmodels ]; hf_transfer = [ hf-transfer ]; ifeval = [ immutabledict @@ -144,7 +147,7 @@ buildPythonPackage rec { pytestCheckHook writableTmpDirAsHomeHook ] - ++ optional-dependencies.api; + ++ finalAttrs.passthru.optional-dependencies.api; disabledTests = [ "test_deepsparse" # deepsparse is not available @@ -156,6 +159,7 @@ buildPythonPackage rec { disabledTestPaths = [ # attempts to download models + "tests/models/test_bos_handling.py" "tests/models/test_huggingface.py" "tests/test_evaluator.py" "tests/test_include_path.py" @@ -172,10 +176,10 @@ buildPythonPackage rec { ]; meta = { - changelog = "https://github.com/EleutherAI/lm-evaluation-harness/releases/tag/${src.tag}"; + changelog = "https://github.com/EleutherAI/lm-evaluation-harness/releases/tag/${finalAttrs.src.tag}"; description = "Framework for few-shot evaluation of language models"; homepage = "https://github.com/EleutherAI/lm-evaluation-harness"; license = [ lib.licenses.mit ]; maintainers = [ lib.maintainers.booxter ]; }; -} +}) diff --git a/pkgs/development/python-modules/mlx-lm/default.nix b/pkgs/development/python-modules/mlx-lm/default.nix index 91ffec0c3650..25809fb16869 100644 --- a/pkgs/development/python-modules/mlx-lm/default.nix +++ b/pkgs/development/python-modules/mlx-lm/default.nix @@ -15,22 +15,23 @@ transformers, # tests + aiohttp, lm-eval, - sentencepiece, pytestCheckHook, + sentencepiece, writableTmpDirAsHomeHook, }: buildPythonPackage (finalAttrs: { pname = "mlx-lm"; - version = "0.30.2"; + version = "0.30.4"; pyproject = true; src = fetchFromGitHub { owner = "ml-explore"; repo = "mlx-lm"; tag = "v${finalAttrs.version}"; - hash = "sha256-6WlKAchze5B724XYwzpVHy+17HlMcGSYjJw0aOdm5yw="; + hash = "sha256-ncDg7C84d1tAgk1300N7wY6kD1BocNNIqDUl0xBLhqY="; }; build-system = [ @@ -50,6 +51,7 @@ buildPythonPackage (finalAttrs: { ]; nativeCheckInputs = [ + aiohttp lm-eval pytestCheckHook sentencepiece diff --git a/pkgs/development/python-modules/mlx/default.nix b/pkgs/development/python-modules/mlx/default.nix index 054bd57dcfbd..f146911a9974 100644 --- a/pkgs/development/python-modules/mlx/default.nix +++ b/pkgs/development/python-modules/mlx/default.nix @@ -4,17 +4,16 @@ buildPythonPackage, fetchFromGitHub, replaceVars, + nanobind, # build-system - setuptools, - - # nativeBuildInputs cmake, + setuptools, + typing-extensions, # buildInputs apple-sdk, fmt, - nanobind, nlohmann_json, pybind11, # linux-only @@ -42,26 +41,27 @@ let in buildPythonPackage (finalAttrs: { pname = "mlx"; - version = "0.30.1"; + version = "0.30.3"; pyproject = true; src = fetchFromGitHub { owner = "ml-explore"; repo = "mlx"; tag = "v${finalAttrs.version}"; - hash = "sha256-Vt0RH+70VBwUjXSfPTsNdRS3g0ookJHhzf2kvgEtgH8="; + hash = "sha256-Y4RTkGcDCZ9HLyflN0qYhPt/oVOsBhF1mHnKM4n1/ys="; }; - patches = lib.optionals stdenv.hostPlatform.isDarwin [ + patches = [ + # Use system nanobind instead of fetching its sources + ./dont-fetch-nanobind.patch + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ (replaceVars ./darwin-build-fixes.patch { sdkVersion = apple-sdk.version; }) ]; postPatch = '' - substituteInPlace pyproject.toml \ - --replace-fail "nanobind==2.10.2" "nanobind" - substituteInPlace mlx/backend/cpu/jit_compiler.cpp \ --replace-fail "g++" "${lib.getExe' stdenv.cc "c++"}" ''; @@ -79,7 +79,7 @@ buildPythonPackage (finalAttrs: { passthru.skipBulkUpdate = true; env = { - DEV_RELEASE = 1; + PYPI_RELEASE = 1; CMAKE_ARGS = toString [ # NOTE The `metal` command-line utility used to build the Metal kernels is not open-source. # To build mlx with Metal support in Nix, you'd need to use one of the sandbox escape @@ -89,21 +89,21 @@ buildPythonPackage (finalAttrs: { (lib.cmakeBool "USE_SYSTEM_FMT" true) (lib.cmakeOptionType "filepath" "FETCHCONTENT_SOURCE_DIR_GGUFLIB" "${gguf-tools}") (lib.cmakeOptionType "filepath" "FETCHCONTENT_SOURCE_DIR_JSON" "${nlohmann_json.src}") + + # Cmake cannot find nanobind-config.cmake by itself + (lib.cmakeFeature "nanobind_DIR" "${nanobind}/${python.sitePackages}/nanobind/cmake") ]; }; build-system = [ - setuptools - ]; - - nativeBuildInputs = [ cmake + setuptools + typing-extensions ]; buildInputs = [ fmt gguf-tools - nanobind nlohmann_json pybind11 ] diff --git a/pkgs/development/python-modules/mlx/dont-fetch-nanobind.patch b/pkgs/development/python-modules/mlx/dont-fetch-nanobind.patch new file mode 100644 index 000000000000..f2858448a93b --- /dev/null +++ b/pkgs/development/python-modules/mlx/dont-fetch-nanobind.patch @@ -0,0 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0ed30932..e5842707 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -339,13 +339,7 @@ if(MLX_BUILD_PYTHON_BINDINGS) + Python 3.10 + COMPONENTS Interpreter Development.Module + REQUIRED) +- FetchContent_Declare( +- nanobind +- GIT_REPOSITORY https://github.com/wjakob/nanobind.git +- GIT_TAG v2.10.2 +- GIT_SHALLOW TRUE +- EXCLUDE_FROM_ALL) +- FetchContent_MakeAvailable(nanobind) ++ find_package(nanobind CONFIG REQUIRED) + add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/python/src) + endif() +