From 917e09135793dcd50755a92272ee55aab3343cfc Mon Sep 17 00:00:00 2001 From: jaredmontoya <49511278+jaredmontoya@users.noreply.github.com> Date: Sat, 14 Feb 2026 01:55:21 +0100 Subject: [PATCH] python3Packages.onnx-asr: init at 0.10.2 --- .../python-modules/onnx-asr/default.nix | 83 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 85 insertions(+) create mode 100644 pkgs/development/python-modules/onnx-asr/default.nix diff --git a/pkgs/development/python-modules/onnx-asr/default.nix b/pkgs/development/python-modules/onnx-asr/default.nix new file mode 100644 index 000000000000..dfd75018eea5 --- /dev/null +++ b/pkgs/development/python-modules/onnx-asr/default.nix @@ -0,0 +1,83 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + hatchling, + hatch-vcs, + + # build-time deps for the custom hatch build hook that generates + # ONNX preprocessor models (listed in pyproject.toml [dependency-groups] build) + numpy, + onnx, + onnxscript, + torch, + torchaudio, + + # dependencies + onnxruntime, + + # optional-dependencies + huggingface-hub, +}: + +buildPythonPackage (finalAttrs: { + pname = "onnx-asr"; + version = "0.10.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "istupakov"; + repo = "onnx-asr"; + tag = "v${finalAttrs.version}"; + hash = "sha256-KumdelY9oNMAEBSGVdvbBH6SYi93n2cA/eEqaE8MmIU="; + }; + + build-system = [ + hatchling + hatch-vcs + # The custom hatch build hook (hatch_build.py) generates ONNX preprocessor + # models at build time using these dependencies. + numpy + onnx + onnxscript + torch + torchaudio + ]; + + dependencies = [ + numpy + onnxruntime + ]; + + optional-dependencies = { + cpu = [ + onnxruntime + ]; + hub = [ + huggingface-hub + ]; + # gpu extra installs onnxruntime-gpu; in nixpkgs users should use + # onnxruntime built with cudaSupport instead + gpu = [ + onnxruntime + ]; + }; + + # Most tests require downloading models from Hugging Face + doCheck = false; + + pythonImportsCheck = [ + "onnx_asr" + ]; + + meta = { + description = "Lightweight Automatic Speech Recognition using ONNX models"; + homepage = "https://github.com/istupakov/onnx-asr"; + changelog = "https://github.com/istupakov/onnx-asr/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.mit; + mainProgram = "onnx-asr"; + maintainers = with lib.maintainers; [ jaredmontoya ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 9a84b34e2e7a..ecdc86597051 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11291,6 +11291,8 @@ self: super: with self; { }; }; + onnx-asr = callPackage ../development/python-modules/onnx-asr { }; + onnx-ir = callPackage ../development/python-modules/onnx-ir { }; onnxconverter-common = callPackage ../development/python-modules/onnxconverter-common { };