Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.11 92 lines 1.6 kB view raw
1{ lib 2, buildPythonPackage 3, pythonOlder 4, fetchFromGitHub 5, which 6# runtime dependencies 7, numpy 8, torch 9# check dependencies 10, pytestCheckHook 11, pytest-cov 12# , pytest-mpi 13, pytest-timeout 14# , pytorch-image-models 15, hydra-core 16, fairscale 17, scipy 18, cmake 19, openai-triton 20, networkx 21#, apex 22, einops 23, transformers 24, timm 25#, flash-attn 26}: 27let 28 version = "0.0.22.post7"; 29in 30buildPythonPackage { 31 pname = "xformers"; 32 inherit version; 33 format = "setuptools"; 34 35 disabled = pythonOlder "3.7"; 36 37 src = fetchFromGitHub { 38 owner = "facebookresearch"; 39 repo = "xformers"; 40 rev = "refs/tags/v${version}"; 41 hash = "sha256-7lZi3+2dVDZJFYCUlxsyDU8t9qdnl+b2ERRXKA6Zp7U="; 42 fetchSubmodules = true; 43 }; 44 45 preBuild = '' 46 cat << EOF > ./xformers/version.py 47 # noqa: C801 48 __version__ = "${version}" 49 EOF 50 ''; 51 52 nativeBuildInputs = [ 53 which 54 ]; 55 56 propagatedBuildInputs = [ 57 numpy 58 torch 59 ]; 60 61 pythonImportsCheck = [ "xformers" ]; 62 63 dontUseCmakeConfigure = true; 64 65 # see commented out missing packages 66 doCheck = false; 67 68 nativeCheckInputs = [ 69 pytestCheckHook 70 pytest-cov 71 pytest-timeout 72 hydra-core 73 fairscale 74 scipy 75 cmake 76 networkx 77 openai-triton 78 # apex 79 einops 80 transformers 81 timm 82 # flash-attn 83 ]; 84 85 meta = with lib; { 86 description = "XFormers: A collection of composable Transformer building blocks"; 87 homepage = "https://github.com/facebookresearch/xformers"; 88 changelog = "https://github.com/facebookresearch/xformers/blob/${version}/CHANGELOG.md"; 89 license = licenses.bsd3; 90 maintainers = with maintainers; [ happysalada ]; 91 }; 92}