From patchwork Thu Sep 29 09:00:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 43039 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 02D5F27BBEA; Thu, 29 Sep 2022 10:08:38 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6181727BBE9 for ; Thu, 29 Sep 2022 10:08:37 +0100 (BST) Received: from localhost ([::1]:50644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odpX2-0003wQ-9j for patchwork@mira.cbaines.net; Thu, 29 Sep 2022 05:08:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odpPj-0007CL-45 for guix-patches@gnu.org; Thu, 29 Sep 2022 05:01:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odpPi-0003rX-MA for guix-patches@gnu.org; Thu, 29 Sep 2022 05:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odpPi-0002wx-Fq for guix-patches@gnu.org; Thu, 29 Sep 2022 05:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58140] [PATCH v3 2/6] gnu: Add kaldi-for-vosk. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 29 Sep 2022 09:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58140 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 58140@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 58140-submit@debbugs.gnu.org id=B58140.166444205311290 (code B ref 58140); Thu, 29 Sep 2022 09:01:02 +0000 Received: (at 58140) by debbugs.gnu.org; 29 Sep 2022 09:00:53 +0000 Received: from localhost ([127.0.0.1]:35928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odpPY-0002vw-Iq for submit@debbugs.gnu.org; Thu, 29 Sep 2022 05:00:53 -0400 Received: from 10.mo561.mail-out.ovh.net ([87.98.165.232]:56759) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odpPR-0002vI-GX for 58140@debbugs.gnu.org; Thu, 29 Sep 2022 05:00:46 -0400 Received: from player695.ha.ovh.net (unknown [10.109.138.64]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 63DD927799 for <58140@debbugs.gnu.org>; Thu, 29 Sep 2022 09:00:44 +0000 (UTC) Received: from ngraves.fr (met42-h01-213-44-161-47.dsl.sta.abo.bbox.fr [213.44.161.47]) (Authenticated sender: ngraves@ngraves.fr) by player695.ha.ovh.net (Postfix) with ESMTPSA id A8AE42EFFE921; Thu, 29 Sep 2022 09:00:42 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-105G00624ab101b-4d53-430e-ad27-a03c5dde5c73, B0E8D5270CD01EFF20DD9E8B4F81152F34611B42) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 213.44.161.47 Date: Thu, 29 Sep 2022 11:00:18 +0200 Message-Id: <20220929090022.5950-2-ngraves@ngraves.fr> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220929090022.5950-1-ngraves@ngraves.fr> References: <20220929090022.5950-1-ngraves@ngraves.fr> MIME-Version: 1.0 X-Ovh-Tracer-Id: 6826331135311012578 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrfeehtddgudduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepvdehleeiffehtedvlefhffffjeefgfduhfetkeevheeiteduiedugfekuedtheejnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkpheptddrtddrtddrtddpvddufedrgeegrdduiedurdegjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepphhlrgihvghrieelhedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeehkedugedtseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehiedu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Patchwork-Original-From: Nicolas Graves via Guix-patches via From: Nicolas Graves X-getmail-retrieved-from-mailbox: Patches * gnu/packages/machine-learning.scm (kaldi-for-vosk): New variable. --- gnu/packages/machine-learning.scm | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 3ad907e0c9..b444352337 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1596,6 +1596,105 @@ (define-public kaldi written in C++.") (license license:asl2.0)))) +(define kaldi-for-vosk + (let* ((commit "6417ac1dece94783e80dfbac0148604685d27579") + (revision "0") + (openfst openfst-for-vosk)) + (package + (inherit kaldi) + (name "kaldi") + (version (git-version "0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/alphacep/kaldi") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "04xw2dpfvpla8skpk08azmgr9k97cd8hn83lj4l85q165gbzql4s")))) + (inputs + (list alsa-lib + ;; `(,gfortran "lib") ;; replaced by lapack + lapack + glib + gstreamer + jack-1 + openblas + openfst + portaudio + python)) + (arguments + (list + #:test-target "test" + #:make-flags ''("online2" "lm" "rnnlm") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "src"))) + (replace 'configure + (lambda _ + (let* ((portaudio #$(this-package-input "portaudio")) + (lapack #$(this-package-input "lapack")) + (openfst #$(this-package-input "openfst")) + (openblas #$(this-package-input "openblas"))) + #$@(if (target-x86?) + '() + #~((substitute* "makefiles/linux_openblas.mk" + (("-msse -msse2") "")))) + (substitute* "makefiles/default_rules.mk" + (("/bin/bash") (which "bash"))) + (substitute* "Makefile" + (("ext_depend: check_portaudio") + "ext_depend:")) + (substitute* '("online/Makefile" + "onlinebin/Makefile" + "gst-plugin/Makefile") + (("../../tools/portaudio/install") + portaudio)) + (substitute* "matrix/Makefile" ;temporary test bypass + (("matrix-lib-test sparse-matrix-test") "")) + + ;; This `configure' script doesn't support variables passed as + ;; arguments, nor does it support "prefix". + (substitute* "configure" + (("check_for_slow_expf;") "") + ;; This affects the RPATH and also serves as the installation + ;; directory. + (("KALDILIBDIR=`pwd`/lib") + (string-append "KALDILIBDIR=" #$output "/lib")) + (("OPENBLASROOT=\\\"\\$\\(rel2abs ..\\/tools\\/OpenBLAS\\/install\\)\\\"") + (string-append "OPENBLASROOT=\"" openblas "\"")) + (("-L\\$OPENBLASLIBDIR -l:libopenblas.a -l:libblas.a -l:liblapack.a -l:libf2c.a") + (string-append "-L$OPENBLASLIBDIR -lopenblas " + "-L" lapack "/lib -lblas -llapack"))) + (mkdir-p #$output) ; must exist + (setenv "CONFIG_SHELL" (which "bash")) + (setenv "OPENFST_VER" #$(package-version openfst)) + (invoke "./configure" + "--use-cuda=no" + "--mathlib=OPENBLAS_CLAPACK" + "--shared" + (string-append "--fst-root=" openfst))))) + (add-after 'configure 'optimize-build + (lambda _ (substitute* "kaldi.mk" ((" -O1") " -O3")))) + (replace 'install + (lambda _ + (let* ((inc (string-append #$output "/include")) + (lib (string-append #$output "/lib"))) + ;; The build phase installed symlinks to the actual + ;; libraries. Install the actual targets. + (for-each (lambda (file) + (let ((target (readlink file))) + (delete-file file) + (install-file target lib))) + (find-files lib "\\.so")) + ;; Install headers + (for-each (lambda (file) + (let ((target-dir (string-append inc "/" (dirname file)))) + (install-file file target-dir))) + (find-files "." "\\.h"))))))))))) + (define-public gst-kaldi-nnet2-online (let ((commit "cb227ef43b66a9835c14eb0ad39e08ee03c210ad") (revision "2"))