From patchwork Thu Sep 29 09:00:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 43041 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 8340827BBEA; Thu, 29 Sep 2022 10:08:55 +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 F04A927BBE9 for ; Thu, 29 Sep 2022 10:08:54 +0100 (BST) Received: from localhost ([::1]:39326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1odpXK-0004Mb-3X for patchwork@mira.cbaines.net; Thu, 29 Sep 2022 05:08:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odpPj-0007Ct-MV for guix-patches@gnu.org; Thu, 29 Sep 2022 05:01:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odpPj-0003s3-82 for guix-patches@gnu.org; Thu, 29 Sep 2022 05:01:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1odpPi-0002xA-Uz for guix-patches@gnu.org; Thu, 29 Sep 2022 05:01:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58140] [PATCH v3 3/6] gnu: Add vosk-api. 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.166444205911310 (code B ref 58140); Thu, 29 Sep 2022 09:01:02 +0000 Received: (at 58140) by debbugs.gnu.org; 29 Sep 2022 09:00:59 +0000 Received: from localhost ([127.0.0.1]:35934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odpPe-0002wI-FB for submit@debbugs.gnu.org; Thu, 29 Sep 2022 05:00:58 -0400 Received: from 1.mo576.mail-out.ovh.net ([178.33.251.173]:55981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1odpPW-0002vr-WC for 58140@debbugs.gnu.org; Thu, 29 Sep 2022 05:00:52 -0400 Received: from player693.ha.ovh.net (unknown [10.111.208.252]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id 9B6E4261C8 for <58140@debbugs.gnu.org>; Thu, 29 Sep 2022 09:00:48 +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 player693.ha.ovh.net (Postfix) with ESMTPSA id C28022F14ED4C; Thu, 29 Sep 2022 09:00:46 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-104R0051a3d3c0b-2f97-42d2-85d9-f7ac189b7193, B0E8D5270CD01EFF20DD9E8B4F81152F34611B42) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 213.44.161.47 Date: Thu, 29 Sep 2022 11:00:19 +0200 Message-Id: <20220929090022.5950-3-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: 6827457038986633954 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrfeehtddgudduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepudeivdeggeduudehheevjeeufffgueffkeelvdevffdvjefgueekkefhjeejiefhnecuffhomhgrihhnpehgihhthhhusgdrtghomhdprghlphhhrggtvghphhgvihdrtghomhenucfkpheptddrtddrtddrtddpvddufedrgeegrdduiedurdegjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepphhlrgihvghrieelfedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeehkedugedtseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeei 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 (vosk-api): New variable. --- gnu/packages/machine-learning.scm | 80 ++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index b444352337..b5e17462eb 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1615,8 +1615,7 @@ (define kaldi-for-vosk (base32 "04xw2dpfvpla8skpk08azmgr9k97cd8hn83lj4l85q165gbzql4s")))) (inputs (list alsa-lib - ;; `(,gfortran "lib") ;; replaced by lapack - lapack + lapack ;; compared to base kaldi, replacing `(,gfortran "lib") glib gstreamer jack-1 @@ -3486,3 +3485,80 @@ (define-public python-pyro-ppl "This package provides a Python library for probabilistic modeling and inference.") (license license:asl2.0))) + +(define-public vosk-api + (let* ((openfst openfst-for-vosk) + (kaldi kaldi-for-vosk)) + (package + (name "vosk-api") + (version "0.3.43") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/alphacep/vosk-api") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0xmp8i140c2hd3rj9dap8a2rnsvzb1k9hnqm12xzbaxrw73rkc29")))) + (build-system gnu-build-system) + (arguments + (list + #:tests? #f + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "src"))) + (replace 'configure + (lambda _ + (let* ((lapack #$(this-package-input "lapack")) + (openfst #$(this-package-input "openfst")) + (openblas #$(this-package-input "openblas")) + (kaldi #$(this-package-input "kaldi"))) + (substitute* "./Makefile" + (("USE_SHARED\\?=0") + "USE_SHARED?=1") + (("-DFST_NO_DYNAMIC_LINKING") + "") + (("-lopenblas -llapack -lblas -lf2c") + (string-append + "-L" openblas "/lib " "-lopenblas " + "-L" lapack "/lib " "-llapack -lblas ")) + (("-lfst -lfstngram") + (string-append + "-L" openfst "/lib " "-lfst -lfstngram ")) + (("\\$\\(HOME\\)\\/travis\\/kaldi") + (string-append kaldi "/include")) + (("\\$\\(KALDI_ROOT\\)\\/tools\\/openfst") + openfst) + (("\\$\\(KALDI_ROOT\\)\\/tools\\/OpenBLAS\\/install") + openblas) + (("\\$\\(KALDI_ROOT\\)\\/libs") + (string-append kaldi "/lib")))))) + (replace 'install + (lambda _ + (let* ((lib (string-append #$output "/lib")) + (src (string-append #$output "/src"))) + (mkdir-p lib) + (mkdir-p src) + (install-file "libvosk.so" lib) + (for-each + (lambda (x) (install-file x src)) + (find-files "." "\\.h$")))))))) + (inputs (list kaldi openfst lapack openblas)) + (home-page "https://alphacephei.com/vosk") + (synopsis "Speech recognition toolkit based on @code{kaldi}") + (description "\ +This package provides a speech recognition toolkit based on @code{kaldi}. It +supports more than 20 languages and dialects - English, Indian English, +German, French, Spanish, Portuguese, Chinese, Russian, Turkish, Vietnamese, +Italian, Dutch, Catalan, Arabic, Greek, Farsi, Filipino, Ukrainian, Kazakh, +Swedish, Japanese, Esperanto, Hindi, Czech, Polish. The program works offline, +even on lightweight devices. Portable per-language models are about 50Mb each, +and there are much bigger and precise models available. + +Vosk API provides a streaming API allowing to use it `on-the-fly' and bindings +for different programming languages. It allows quick reconfiguration of +vocabulary for better accuracy, and supports speaker identification beside +simple speech recognition.") + (license license:asl2.0))))