From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id +BZCOx1lNGNXdgEAbAwnHQ (envelope-from ) for ; Wed, 28 Sep 2022 17:15:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0F5FOx1lNGMR0AAAauVa8A (envelope-from ) for ; Wed, 28 Sep 2022 17:15:41 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7E5083D7CB for ; Wed, 28 Sep 2022 17:15:41 +0200 (CEST) Received: from localhost ([::1]:33620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odYmi-0003RY-9l for larch@yhetil.org; Wed, 28 Sep 2022 11:15:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odViQ-0003E9-MV for guix-patches@gnu.org; Wed, 28 Sep 2022 07:59:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33124) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odViQ-0001N1-DE for guix-patches@gnu.org; Wed, 28 Sep 2022 07:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odViQ-0001Gw-8O for guix-patches@gnu.org; Wed, 28 Sep 2022 07:59:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58140] [PATCH 2/6] gnu: Add kaldi-for-vosk. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 28 Sep 2022 11:59: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.16643663034786 (code B ref 58140); Wed, 28 Sep 2022 11:59:02 +0000 Received: (at 58140) by debbugs.gnu.org; 28 Sep 2022 11:58:23 +0000 Received: from localhost ([127.0.0.1]:60422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odVhm-0001F8-LH for submit@debbugs.gnu.org; Wed, 28 Sep 2022 07:58:23 -0400 Received: from 4.mo575.mail-out.ovh.net ([46.105.59.63]:57251) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odVhi-0001Eu-NG for 58140@debbugs.gnu.org; Wed, 28 Sep 2022 07:58:19 -0400 Received: from player758.ha.ovh.net (unknown [10.108.1.202]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 097B6255CD for <58140@debbugs.gnu.org>; Wed, 28 Sep 2022 11:58:16 +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 player758.ha.ovh.net (Postfix) with ESMTPSA id 3B76F2F133AF6; Wed, 28 Sep 2022 11:58:15 +0000 (UTC) X-OVh-ClientIp: 213.44.161.47 Date: Wed, 28 Sep 2022 13:57:51 +0200 Message-Id: <20220928115755.6292-2-ngraves@ngraves.fr> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220928115755.6292-1-ngraves@ngraves.fr> References: <20220928115755.6292-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 3951908675544212194 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrfeegkedggeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepvdehleeiffehtedvlefhffffjeefgfduhfetkeevheeiteduiedugfekuedtheejnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkpheptddrtddrtddrtddpvddufedrgeegrdduiedurdegjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepphhlrgihvghrjeehkedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeehkedugedtseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeeh 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664378141; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=YzaF6nou9Mm2QkrwXQR0AOavauod7qVF45pTFoQmQjk=; b=OLyYPpzJh9+hd05x29Lrnef7XgCOlW6CxWJFgCmUrCy5werajYd8GdaErDnK+FbcuWHKhO oMMmVmQf1eLPRL2yJShBO0jJ1IjUto912f5BLeS0KmFW0mBiLyoMGHKkOvL5u5P3Xvc3wt /QTwFAyUBVSQTDTD0IFsBNWjDV8NvQDojDBvPOnSui12md8wEzWlaRj4uW+Nzh1Fk49dDk Cq+o5vXH8GUrzNHE4ugy/LO1/nuNQMRLood355pvIB5JH4TMo/TosSk/bvBMH22uXU/5Vc /uKiQMIqeZX02TzWyhQuf/bvru5vKoag8OmTqD4dn2a4eAhuV4BeigzRfcq5WA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664378141; a=rsa-sha256; cv=none; b=sCE2ae75M1yAWUkawhv+5t5Zg/dRJi6NUql5KB2gPVXtIwXS0ZLfonkfPCl5TvUF1q8trI FSYpAeXw3nBvkImwApaYMr7HDMfGaNmpmImFxUm7ERJeyRv35HX3KrmwvdMSW+Nur10a4N B3MSu7SKlbbungsJG+JwzoIyNBIHDPQfpB1wwt1IlxOqCGmr3GR5VPuV1LRC7PjJ13Rh4X DgA6nPGMz4WN8jQdvBoQ/tKPK22MYvvLGrU8omAljRDPRUXS18Vh0l3Kkt2DYX/nywHYgb N2vRds8QVEXh05bdvTY8M8G2oO3NH0wADuSR0sM4fKeyy2OX54YmhU1sp5dUZw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.85 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 7E5083D7CB X-Spam-Score: -2.85 X-Migadu-Scanner: scn1.migadu.com X-TUID: xocIWp4feyoE * gnu/packages/machine-learning.scm (kaldi-for-vosk): New variable. --- gnu/packages/machine-learning.scm | 98 +++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 3ad907e0c9..9b2e01c102 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1596,6 +1596,104 @@ (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") #t)) + (replace 'configure + (lambda* (#:key build system inputs outputs #:allow-other-keys) + (when (not (or (string-prefix? "x86_64" system) + (string-prefix? "i686" system))) + (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") + (assoc-ref inputs "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". + (let ((out (assoc-ref outputs "out"))) + (substitute* "configure" + (("check_for_slow_expf;") "") + ;; This affects the RPATH and also serves as the installation + ;; directory. + (("KALDILIBDIR=`pwd`/lib") + (string-append "KALDILIBDIR=" out "/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 out) ; 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* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (inc (string-append out "/include")) + (lib (string-append out "/lib"))) + (mkdir-p 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")) -- 2.37.3