Files
Alexander Miroshnichenko ab88b09ceb
Some checks failed
CI / check (push) Has been cancelled
feat(packages): add freetoken 0.1.2 NVIDIA MoE inference runtime
Package FreeToken (FlashML-org/FreeToken) — edge-native MoE serving
engine with OpenAI/Anthropic-compatible APIs, serving the `ft` CLI.

- torch-bin 2.11 (CUDA 12.9 wheel build) satisfies the torch>=2.11,<2.12
  pin; extensions link the same cudaPackages.cuda_cudart via a synthetic
  CUDA_HOME (cudart headers + nvcc crt/ headers, no nvcc needed).
- flashlib==0.3.0 vendored from the PyPI wheel (Triton-only; freetoken
  never imports the CuTeDSL GEMM backends, so nvidia-cutlass-dsl is
  omitted via pythonRemoveDeps).
- apache-tvm-ffi overridden to the pinned 0.1.13.post3 with a vendored
  cython 3.3.0 (build needs >=3.2.8, nixpkgs has 3.2.4); pytest skipped
  (upstream runs pytest-xdist with GPU tests).
- Unfree (CUDA EULA) is self-scoped: the package re-imports nixpkgs with
  config.allowUnfree so no flake-level or user config change is needed.
- Optional accel extras (flashinfer/sglang-kernel) and the kernel-cache
  wheel are not packaged; runtime falls back to pure-Triton kernels.
- Verified: nix build .#freetoken, ft --version, python imports check,
  extension RPATHs.
2026-08-30 20:51:15 +03:00

52 lines
1.5 KiB
Nix

{
lib,
buildPythonPackage,
fetchurl,
# dependencies
numpy,
numba,
# torch-bin (CUDA wheel build) and triton-bin are passed by the caller;
# the python scope defaults are the source-built torch (CPU-only) and
# triton — using them would duplicate torch/triton in the closure.
torch,
triton,
tqdm,
}:
buildPythonPackage rec {
pname = "flashlib";
version = "0.3.0";
format = "wheel";
src = fetchurl {
url = "https://files.pythonhosted.org/packages/e5/b8/4c085892462e521bb9f2d943ff34fa219e3a5a206798f3c96a983538039f/flashlib-0.3.0-py3-none-any.whl";
hash = "sha256-kDeRHzFf7zyfRFMmFZc2Ory4OGiBOtGyWKsTCLNP0Ro=";
};
# freetoken pins flashlib==0.3.0 (not in nixpkgs) and only uses its Triton
# kernels (flashlib.kernels.slot_cache). nvidia-cutlass-dsl — needed only by
# the CuTeDSL GEMM backends in flashlib.linalg, which drag in cuda-python and
# nvdisasm binary wheels — is deliberately not packaged (and removed from
# the wheel metadata so the runtime deps check passes).
pythonRemoveDeps = [ "nvidia-cutlass-dsl" ];
dependencies = [
numpy
numba
torch
triton
tqdm
];
# flashlib is CPU-safe at import time: CuteDSL imports are lazy and hardware
# detection (flashlib._hw) is cuda-optional.
pythonImportsCheck = [ "flashlib" ];
meta = {
description = "High-performance ML primitives Triton and CuteDSL kernels for NVIDIA GPUs";
homepage = "https://pypi.org/project/flashlib/";
license = lib.licenses.asl20;
platforms = lib.platforms.linux;
};
}