From 1fdd20c7d7ac53ccd898ab684e6c2b4d1f4cf907 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 14 Mar 2019 23:28:51 +0100 Subject: gnu: kaldi: Install headers and fix installation of libraries. * gnu/packages/machine-learning.scm (kaldi)[arguments]: Fix installation of libraries and install headers in "install" phase. --- gnu/packages/machine-learning.scm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'gnu/packages/machine-learning.scm') diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 4067b4b1ea..b36186ea31 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -1002,9 +1002,23 @@ association studies (GWAS) on extremely large data sets.") (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) - (install-file "gst-plugin/libgstonlinegmmdecodefaster.so" 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")) + (install-file "gst-plugin/libgstonlinegmmdecodefaster.so" + (string-append lib "/gstreamer-1.0")) #t)))))) (inputs `(("alsa-lib" ,alsa-lib) -- cgit 1.4.1 From 992600141a9a703339d86b22a4c2eaa877d32207 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 14 Mar 2019 23:30:37 +0100 Subject: gnu: Add gst-kaldi-nnet2-online. * gnu/packages/machine-learning.scm (gst-kaldi-nnet2-online): New variable. --- gnu/packages/machine-learning.scm | 73 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'gnu/packages/machine-learning.scm') diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index b36186ea31..f07a905097 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -43,6 +43,7 @@ #:use-module (gnu packages audio) #:use-module (gnu packages autotools) #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages boost) #:use-module (gnu packages check) #:use-module (gnu packages compression) @@ -63,6 +64,7 @@ #:use-module (gnu packages python-xyz) #:use-module (gnu packages statistics) #:use-module (gnu packages swig) + #:use-module (gnu packages web) #:use-module (gnu packages xml) #:use-module (gnu packages xorg)) @@ -1041,3 +1043,74 @@ association studies (GWAS) on extremely large data sets.") (description "Kaldi is an extensible toolkit for speech recognition written in C++.") (license license:asl2.0)))) + +(define-public gst-kaldi-nnet2-online + (let ((commit "617e43e73c7cc45eb9119028c02bd4178f738c4a") + (revision "1")) + (package + (name "gst-kaldi-nnet2-online") + (version (git-version "0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/alumae/gst-kaldi-nnet2-online.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0xh3w67b69818s6ib02ara4lw7wamjdmh4jznvkpzrs4skbs9jx9")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; there are none + #:make-flags + (list (string-append "SHELL=" + (assoc-ref %build-inputs "bash") "/bin/bash") + (string-append "KALDI_ROOT=" + (assoc-ref %build-inputs "kaldi-src")) + (string-append "KALDILIBDIR=" + (assoc-ref %build-inputs "kaldi") "/lib") + "KALDI_FLAVOR=dynamic") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "src") #t)) + (replace 'configure + (lambda* (#:key inputs #:allow-other-keys) + (let ((glib (assoc-ref inputs "glib"))) + (setenv "CXXFLAGS" "-std=c++11 -fPIC") + (setenv "CPLUS_INCLUDE_PATH" + (string-append glib "/include/glib-2.0:" + glib "/lib/glib-2.0/include:" + (assoc-ref inputs "gstreamer") + "/include/gstreamer-1.0:" + (getenv "CPLUS_INCLUDE_PATH")))) + (substitute* "Makefile" + (("include \\$\\(KALDI_ROOT\\)/src/kaldi.mk") "") + (("\\$\\(error Cannot find") "#")))) + (add-before 'build 'build-depend + (lambda* (#:key make-flags #:allow-other-keys) + (apply invoke "make" "depend" make-flags))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (lib (string-append out "/lib/gstreamer-1.0"))) + (install-file "libgstkaldinnet2onlinedecoder.so" lib) + #t)))))) + (inputs + `(("glib" ,glib) + ("gstreamer" ,gstreamer) + ("jansson" ,jansson) + ("openfst" ,openfst) + ("kaldi" ,kaldi))) + (native-inputs + `(("bash" ,bash) + ("glib:bin" ,glib "bin") ; glib-genmarshal + ("kaldi-src" ,(package-source kaldi)) + ("pkg-config" ,pkg-config))) + (home-page "https://kaldi-asr.org/") + (synopsis "Gstreamer plugin for decoding speech") + (description "This package provides a GStreamer plugin that wraps +Kaldi's @code{SingleUtteranceNnet2Decoder}. It requires iVector-adapted DNN +acoustic models. The iVectors are adapted to the current audio stream +automatically.") + (license license:asl2.0)))) -- cgit 1.4.1 From 10451f6bac89460733e3defea0dca9448abeb066 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 17 Mar 2019 10:09:56 +0100 Subject: gnu: Add kaldi-gstreamer-server. * gnu/packages/machine-learning.scm (kaldi-gstreamer-server): New variable. --- gnu/packages/machine-learning.scm | 94 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) (limited to 'gnu/packages/machine-learning.scm') diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index f07a905097..281a95c0ab 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -61,6 +61,7 @@ #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) + #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) #:use-module (gnu packages statistics) #:use-module (gnu packages swig) @@ -1114,3 +1115,96 @@ Kaldi's @code{SingleUtteranceNnet2Decoder}. It requires iVector-adapted DNN acoustic models. The iVectors are adapted to the current audio stream automatically.") (license license:asl2.0)))) + +(define-public kaldi-gstreamer-server + (let ((commit "1735ba49c5dc0ebfc184e45105fc600cd9f1f508") + (revision "1")) + (package + (name "kaldi-gstreamer-server") + (version (git-version "0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/alumae/kaldi-gstreamer-server.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0j701m7lbwmzqxsfanj882v7881hrbmpqybbczbxqpcbg8q34w0k")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; there are no tests that can be run automatically + #:modules ((guix build utils) + (guix build gnu-build-system) + (srfi srfi-26)) + #:phases + (modify-phases %standard-phases + (delete 'configure) + (replace 'build + (lambda* (#:key outputs #:allow-other-keys) + ;; Disable hash randomization to ensure the generated .pycs + ;; are reproducible. + (setenv "PYTHONHASHSEED" "0") + (with-directory-excursion "kaldigstserver" + (for-each (lambda (file) + (apply invoke + `("python" + "-m" "compileall" + "-f" ; force rebuild + ,file))) + (find-files "." "\\.py$"))) + #t)) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin")) + (share (string-append out "/share/kaldi-gstreamer-server/"))) + ;; Install Python files + (with-directory-excursion "kaldigstserver" + (for-each (cut install-file <> share) + (find-files "." ".*"))) + + ;; Install sample configuration files + (for-each (cut install-file <> share) + (find-files "." "\\.yaml")) + + ;; Install executables + (mkdir-p bin) + (let* ((server (string-append bin "/kaldi-gst-server")) + (client (string-append bin "/kaldi-gst-client")) + (worker (string-append bin "/kaldi-gst-worker")) + (PYTHONPATH (getenv "PYTHONPATH")) + (GST_PLUGIN_PATH (string-append + (assoc-ref inputs "gst-kaldi-nnet2-online") + "/lib/gstreamer-1.0:${GST_PLUGIN_PATH}")) + (wrap (lambda (wrapper what) + (with-output-to-file wrapper + (lambda _ + (format #t + "#!~a +export PYTHONPATH=~a +export GST_PLUGIN_PATH=~a +exec ~a ~a/~a \"$@\"~%" + (which "bash") PYTHONPATH GST_PLUGIN_PATH + (which "python") share what))) + (chmod wrapper #o555)))) + (for-each wrap + (list server client worker) + (list "master_server.py" + "client.py" + "worker.py"))) + #t)))))) + (inputs + `(("gst-kaldi-nnet2-online" ,gst-kaldi-nnet2-online) + ("python2" ,python-2) + ("python2-futures" ,python2-futures) + ("python2-pygobject" ,python2-pygobject) + ("python2-pyyaml" ,python2-pyyaml) + ("python2-tornado" ,python2-tornado) + ("python2-ws4py" ,python2-ws4py-for-kaldi-gstreamer-server))) + (home-page "https://github.com/alumae/kaldi-gstreamer-server") + (synopsis "Real-time full-duplex speech recognition server") + (description "This is a real-time full-duplex speech recognition server, +based on the Kaldi toolkit and the GStreamer framework and implemented in +Python.") + (license license:bsd-2)))) -- cgit 1.4.1 From 0dfeb285234ef9b9ac6a01486b0edfa93310ee6d Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 26 Nov 2018 16:42:40 +0100 Subject: gnu: Add grpc. * gnu/packages/machine-learning.scm (grpc): New variable. --- gnu/packages/machine-learning.scm | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'gnu/packages/machine-learning.scm') diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 281a95c0ab..28bb44a3ca 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -39,6 +39,7 @@ #:use-module (guix build-system r) #:use-module (guix git-download) #:use-module (gnu packages) + #:use-module (gnu packages adns) #:use-module (gnu packages algebra) #:use-module (gnu packages audio) #:use-module (gnu packages autotools) @@ -60,11 +61,13 @@ #:use-module (gnu packages onc-rpc) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) #:use-module (gnu packages statistics) #:use-module (gnu packages swig) + #:use-module (gnu packages tls) #:use-module (gnu packages web) #:use-module (gnu packages xml) #:use-module (gnu packages xorg)) @@ -1208,3 +1211,41 @@ exec ~a ~a/~a \"$@\"~%" based on the Kaldi toolkit and the GStreamer framework and implemented in Python.") (license license:bsd-2)))) + +(define-public grpc + (package + (name "grpc") + (version "1.16.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/grpc/grpc.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1jimqz3115f9pli5w6ik9wi7mjc7ix6y7yrq4a1ab9fc3dalj7p2")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; no test target + #:configure-flags + (list "-DgRPC_ZLIB_PROVIDER=package" + "-DgRPC_CARES_PROVIDER=package" + "-DgRPC_SSL_PROVIDER=package" + "-DgRPC_PROTOBUF_PROVIDER=package"))) + (inputs + `(("c-ares" ,c-ares-next) + ("openssl" ,openssl) + ("zlib" ,zlib))) + (native-inputs + `(("protobuf" ,protobuf-next) + ("python" ,python-wrapper))) + (home-page "https://grpc.io") + (synopsis "High performance universal RPC framework") + (description "gRPC is a modern open source high performance @dfn{Remote +Procedure Call} (RPC) framework that can run in any environment. It can +efficiently connect services in and across data centers with pluggable support +for load balancing, tracing, health checking and authentication. It is also +applicable in last mile of distributed computing to connect devices, mobile +applications and browsers to backend services.") + (license license:asl2.0))) -- cgit 1.4.1