1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 6 # build-system 7 setuptools, 8 setuptools-scm, 9 10 # dependencies 11 accelerate, 12 cut-cross-entropy, 13 datasets, 14 hf-transfer, 15 huggingface-hub, 16 msgspec, 17 packaging, 18 peft, 19 psutil, 20 sentencepiece, 21 torch, 22 tqdm, 23 transformers, 24 trl, 25 tyro, 26}: 27 28buildPythonPackage rec { 29 pname = "unsloth-zoo"; 30 version = "2025.9.5"; 31 pyproject = true; 32 33 # no tags on GitHub 34 src = fetchPypi { 35 pname = "unsloth_zoo"; 36 inherit version; 37 hash = "sha256-wlKlXTgEdfkz4j//LHw23CmeL7toINg5IUxcpwrPtAw="; 38 }; 39 40 # pyproject.toml requires an obsolete version of protobuf, 41 # but it is not used. 42 # Upstream issue: https://github.com/unslothai/unsloth-zoo/pull/68 43 pythonRelaxDeps = [ 44 "datasets" 45 "protobuf" 46 "transformers" 47 "torch" 48 ]; 49 50 patches = [ 51 # Avoid circular dependency in Nix, since `unsloth` depends on `unsloth-zoo`. 52 ./dont-require-unsloth.patch 53 ]; 54 55 build-system = [ 56 setuptools 57 setuptools-scm 58 ]; 59 60 dependencies = [ 61 accelerate 62 cut-cross-entropy 63 datasets 64 hf-transfer 65 huggingface-hub 66 msgspec 67 packaging 68 peft 69 psutil 70 sentencepiece 71 torch 72 tqdm 73 transformers 74 trl 75 tyro 76 ]; 77 78 # No tests 79 doCheck = false; 80 81 pythonImportsCheck = [ 82 "unsloth_zoo" 83 ]; 84 85 meta = { 86 description = "Utils for Unsloth"; 87 homepage = "https://github.com/unslothai/unsloth_zoo"; 88 license = lib.licenses.mit; 89 maintainers = with lib.maintainers; [ hoh ]; 90 }; 91}