1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
{
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
setuptools,
# dependencies
jinja2,
mlx,
numpy,
protobuf,
pyyaml,
transformers,
# tests
lm-eval,
sentencepiece,
pytestCheckHook,
writableTmpDirAsHomeHook,
}:
buildPythonPackage (finalAttrs: {
pname = "mlx-lm";
version = "0.30.2";
pyproject = true;
src = fetchFromGitHub {
owner = "ml-explore";
repo = "mlx-lm";
tag = "v${finalAttrs.version}";
hash = "sha256-6WlKAchze5B724XYwzpVHy+17HlMcGSYjJw0aOdm5yw=";
};
build-system = [
setuptools
];
pythonRelaxDeps = [
"transformers"
];
dependencies = [
jinja2
mlx
numpy
protobuf
pyyaml
transformers
];
nativeCheckInputs = [
lm-eval
pytestCheckHook
sentencepiece
writableTmpDirAsHomeHook
];
pythonImportsCheck = [ "mlx_lm" ];
disabledTestPaths = [
# Requires network access to huggingface.co
"tests/test_datsets.py"
"tests/test_generate.py"
"tests/test_prompt_cache.py::TestPromptCache"
"tests/test_server.py"
"tests/test_tokenizers.py"
"tests/test_utils.py::TestUtils::test_convert"
"tests/test_utils.py::TestUtils::test_load"
# RuntimeError: [metal_kernel] No GPU back-end.
"tests/test_losses.py"
"tests/test_models.py::TestModels::test_bitnet"
# TypeError: 'NoneType' object is not callable
"tests/test_models.py::TestModels::test_gated_delta"
"tests/test_models.py::TestModels::test_gated_delta_masked"
];
meta = {
description = "Run LLMs with MLX";
homepage = "https://github.com/ml-explore/mlx-lm";
changelog = "https://github.com/ml-explore/mlx-lm/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.mit;
};
})
|