Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / machine-learning.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
5 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
6 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
8 ;;; Copyright © 2018 Mark Meyer <mark@ofosos.org>
9 ;;; Copyright © 2018 Ben Woodcroft <donttrustben@gmail.com>
10 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
11 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
12 ;;; Copyright © 2018 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages machine-learning)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix utils)
33 #:use-module (guix download)
34 #:use-module (guix svn-download)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system ocaml)
38 #:use-module (guix build-system python)
39 #:use-module (guix build-system r)
40 #:use-module (guix git-download)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages adns)
43 #:use-module (gnu packages algebra)
44 #:use-module (gnu packages audio)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages bash)
48 #:use-module (gnu packages boost)
49 #:use-module (gnu packages check)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages cran)
52 #:use-module (gnu packages databases)
53 #:use-module (gnu packages dejagnu)
54 #:use-module (gnu packages gcc)
55 #:use-module (gnu packages glib)
56 #:use-module (gnu packages gstreamer)
57 #:use-module (gnu packages image)
58 #:use-module (gnu packages linux)
59 #:use-module (gnu packages maths)
60 #:use-module (gnu packages mpi)
61 #:use-module (gnu packages ocaml)
62 #:use-module (gnu packages onc-rpc)
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages protobuf)
66 #:use-module (gnu packages python)
67 #:use-module (gnu packages python-web)
68 #:use-module (gnu packages python-xyz)
69 #:use-module (gnu packages serialization)
70 #:use-module (gnu packages statistics)
71 #:use-module (gnu packages sqlite)
72 #:use-module (gnu packages swig)
73 #:use-module (gnu packages tls)
74 #:use-module (gnu packages web)
75 #:use-module (gnu packages xml)
76 #:use-module (gnu packages xorg)
77 #:use-module (ice-9 match))
78
79 (define-public fann
80 ;; The last release is >100 commits behind, so we package from git.
81 (let ((commit "d71d54788bee56ba4cf7522801270152da5209d7"))
82 (package
83 (name "fann")
84 (version (string-append "2.2.0-1." (string-take commit 8)))
85 (source (origin
86 (method git-fetch)
87 (uri (git-reference
88 (url "https://github.com/libfann/fann.git")
89 (commit commit)))
90 (file-name (string-append name "-" version "-checkout"))
91 (sha256
92 (base32
93 "0ibwpfrjs6q2lijs8slxjgzb2llcl6rk3v2ski4r6215g5jjhg3x"))))
94 (build-system cmake-build-system)
95 (arguments
96 `(#:phases
97 (modify-phases %standard-phases
98 (replace 'check
99 (lambda* (#:key outputs #:allow-other-keys)
100 (let* ((out (assoc-ref outputs "out")))
101 (with-directory-excursion (string-append (getcwd) "/tests")
102 (invoke "./fann_tests"))))))))
103 (home-page "http://leenissen.dk/fann/wp/")
104 (synopsis "Fast Artificial Neural Network")
105 (description
106 "FANN is a free open source neural network library, which implements
107 multilayer artificial neural networks in C with support for both fully
108 connected and sparsely connected networks.")
109 (license license:lgpl2.1))))
110
111 (define-public libsvm
112 (package
113 (name "libsvm")
114 (version "3.22")
115 (source
116 (origin
117 (method url-fetch)
118 (uri (string-append "https://www.csie.ntu.edu.tw/~cjlin/libsvm/"
119 name "-" version ".tar.gz"))
120 (sha256
121 (base32
122 "0zd7s19y5vb7agczl6456bn45cj1y64739sslaskw1qk7dywd0bd"))))
123 (build-system gnu-build-system)
124 (arguments
125 `(#:tests? #f ;no "check" target
126 #:phases (modify-phases %standard-phases
127 (delete 'configure)
128 (replace
129 'install ; no ‘install’ target
130 (lambda* (#:key outputs #:allow-other-keys)
131 (let* ((out (assoc-ref outputs "out"))
132 (bin (string-append out "/bin/")))
133 (mkdir-p bin)
134 (for-each (lambda (file)
135 (copy-file file (string-append bin file)))
136 '("svm-train"
137 "svm-predict"
138 "svm-scale")))
139 #t)))))
140 (home-page "http://www.csie.ntu.edu.tw/~cjlin/libsvm/")
141 (synopsis "Library for Support Vector Machines")
142 (description
143 "LIBSVM is a machine learning library for support vector
144 classification, (C-SVC, nu-SVC), regression (epsilon-SVR, nu-SVR) and
145 distribution estimation (one-class SVM). It supports multi-class
146 classification.")
147 (license license:bsd-3)))
148
149 (define-public python-libsvm
150 (package (inherit libsvm)
151 (name "python-libsvm")
152 (build-system gnu-build-system)
153 (arguments
154 `(#:tests? #f ;no "check" target
155 #:make-flags '("-C" "python")
156 #:phases
157 (modify-phases %standard-phases
158 (delete 'configure)
159 (replace
160 'install ; no ‘install’ target
161 (lambda* (#:key inputs outputs #:allow-other-keys)
162 (let ((site (string-append (assoc-ref outputs "out")
163 "/lib/python"
164 (string-take
165 (string-take-right
166 (assoc-ref inputs "python") 5) 3)
167 "/site-packages/")))
168 (substitute* "python/svm.py"
169 (("../libsvm.so.2") "libsvm.so.2"))
170 (mkdir-p site)
171 (for-each (lambda (file)
172 (copy-file file (string-append site (basename file))))
173 (find-files "python" "\\.py"))
174 (copy-file "libsvm.so.2"
175 (string-append site "libsvm.so.2")))
176 #t)))))
177 (inputs
178 `(("python" ,python)))
179 (synopsis "Python bindings of libSVM")))
180
181 (define-public ghmm
182 ;; The latest release candidate is several years and a couple of fixes have
183 ;; been published since. This is why we download the sources from the SVN
184 ;; repository.
185 (let ((svn-revision 2341))
186 (package
187 (name "ghmm")
188 (version (string-append "0.9-rc3-0." (number->string svn-revision)))
189 (source (origin
190 (method svn-fetch)
191 (uri (svn-reference
192 (url "http://svn.code.sf.net/p/ghmm/code/trunk")
193 (revision svn-revision)))
194 (file-name (string-append name "-" version))
195 (sha256
196 (base32
197 "0qbq1rqp94l530f043qzp8aw5lj7dng9wq0miffd7spd1ff638wq"))))
198 (build-system gnu-build-system)
199 (arguments
200 `(#:imported-modules (,@%gnu-build-system-modules
201 (guix build python-build-system))
202 #:phases
203 (modify-phases %standard-phases
204 (add-after 'unpack 'enter-dir
205 (lambda _ (chdir "ghmm") #t))
206 (delete 'check)
207 (add-after 'install 'check
208 (assoc-ref %standard-phases 'check))
209 (add-before 'check 'fix-PYTHONPATH
210 (lambda* (#:key inputs outputs #:allow-other-keys)
211 (let ((python-version ((@@ (guix build python-build-system)
212 get-python-version)
213 (assoc-ref inputs "python"))))
214 (setenv "PYTHONPATH"
215 (string-append (getenv "PYTHONPATH")
216 ":" (assoc-ref outputs "out")
217 "/lib/python" python-version
218 "/site-packages")))
219 #t))
220 (add-after 'enter-dir 'fix-runpath
221 (lambda* (#:key outputs #:allow-other-keys)
222 (substitute* "ghmmwrapper/setup.py"
223 (("^(.*)extra_compile_args = \\[" line indent)
224 (string-append indent
225 "extra_link_args = [\"-Wl,-rpath="
226 (assoc-ref outputs "out") "/lib\"],\n"
227 line
228 "\"-Wl,-rpath="
229 (assoc-ref outputs "out")
230 "/lib\", ")))
231 #t))
232 (add-after 'enter-dir 'disable-broken-tests
233 (lambda _
234 (substitute* "tests/Makefile.am"
235 ;; GHMM_SILENT_TESTS is assumed to be a command.
236 (("TESTS_ENVIRONMENT.*") "")
237 ;; Do not build broken tests.
238 (("chmm .*") "")
239 (("read_fa .*") "")
240 (("mcmc .*") "")
241 (("label_higher_order_test.*$")
242 "label_higher_order_test\n"))
243
244 ;; These Python unittests are broken as there is no gato.
245 ;; See https://sourceforge.net/p/ghmm/support-requests/3/
246 (substitute* "ghmmwrapper/ghmmunittests.py"
247 (("^(.*)def (testNewXML|testMultipleTransitionClasses|testNewXML)"
248 line indent)
249 (string-append indent
250 "@unittest.skip(\"Disabled by Guix\")\n"
251 line)))
252 #t))
253 (add-after 'disable-broken-tests 'autogen
254 (lambda _
255 (invoke "bash" "autogen.sh"))))))
256 (inputs
257 `(("python" ,python-2) ; only Python 2 is supported
258 ("libxml2" ,libxml2)))
259 (native-inputs
260 `(("pkg-config" ,pkg-config)
261 ("dejagnu" ,dejagnu)
262 ("swig" ,swig)
263 ("autoconf" ,autoconf)
264 ("automake" ,automake)
265 ("libtool" ,libtool)))
266 (home-page "http://ghmm.org")
267 (synopsis "Hidden Markov Model library")
268 (description
269 "The General Hidden Markov Model library (GHMM) is a C library with
270 additional Python bindings implementing a wide range of types of @dfn{Hidden
271 Markov Models} (HMM) and algorithms: discrete, continuous emissions, basic
272 training, HMM clustering, HMM mixtures.")
273 (license license:lgpl2.0+))))
274
275 (define-public mcl
276 (package
277 (name "mcl")
278 (version "14.137")
279 (source (origin
280 (method url-fetch)
281 (uri (string-append
282 "http://micans.org/mcl/src/mcl-"
283 (string-replace-substring version "." "-")
284 ".tar.gz"))
285 (sha256
286 (base32
287 "15xlax3z31lsn62vlg94hkm75nm40q4679amnfg13jm8m2bnhy5m"))))
288 (build-system gnu-build-system)
289 (arguments
290 `(#:configure-flags (list "--enable-blast")))
291 (inputs
292 `(("perl" ,perl)))
293 (home-page "http://micans.org/mcl/")
294 (synopsis "Clustering algorithm for graphs")
295 (description
296 "The MCL algorithm is short for the @dfn{Markov Cluster Algorithm}, a
297 fast and scalable unsupervised cluster algorithm for graphs (also known as
298 networks) based on simulation of (stochastic) flow in graphs.")
299 ;; In the LICENCE file and web page it says "The software is licensed
300 ;; under the GNU General Public License, version 3.", but in several of
301 ;; the source code files it suggests GPL3 or later.
302 ;; http://listserver.ebi.ac.uk/pipermail/mcl-users/2016/000376.html
303 (license license:gpl3)))
304
305 (define-public ocaml-mcl
306 (package
307 (name "ocaml-mcl")
308 (version "12-068oasis4")
309 (source
310 (origin
311 (method git-fetch)
312 (uri (git-reference
313 (url "https://github.com/fhcrc/mcl.git")
314 (commit version)))
315 (file-name (git-file-name name version))
316 (sha256
317 (base32
318 "0009dc3h2jp3qg5val452wngpqnbfyhbcxylghq0mrjqxx0jdq5p"))))
319 (build-system ocaml-build-system)
320 (arguments
321 `(#:phases
322 (modify-phases %standard-phases
323 (add-before 'configure 'patch-paths
324 (lambda _
325 (substitute* "configure"
326 (("/bin/sh") (which "sh")))
327 (substitute* "setup.ml"
328 (("LDFLAGS=-fPIC")
329 (string-append "LDFLAGS=-fPIC\"; \"SHELL=" (which "sh")))
330 (("-std=c89") "-std=gnu99")
331
332 ;; This is a mutable string, which is no longer supported. Use
333 ;; a byte buffer instead.
334 (("String.make \\(String.length s\\)")
335 "Bytes.make (String.length s)")
336
337 ;; These two belong together.
338 (("OASISString.replace_chars")
339 "Bytes.to_string (OASISString.replace_chars")
340 ((" s;")
341 " s);"))
342 (substitute* "myocamlbuild.ml"
343 (("std=c89") "std=gnu99"))
344 ;; Since we build with a more recent OCaml, we have to use C99 or
345 ;; later. This causes problems with the old C code.
346 (substitute* "src/impala/matrix.c"
347 (("restrict") "restrict_"))
348 #t)))))
349 (native-inputs
350 `(("ocamlbuild" ,ocamlbuild)))
351 (home-page "https://github.com/fhcrc/mcl")
352 (synopsis "OCaml wrappers around MCL")
353 (description
354 "This package provides OCaml bindings for the MCL graph clustering
355 algorithm.")
356 (license license:gpl3)))
357
358 (define-public randomjungle
359 (package
360 (name "randomjungle")
361 (version "2.1.0")
362 (source
363 (origin
364 (method url-fetch)
365 (uri (string-append
366 "https://www.imbs.uni-luebeck.de/fileadmin/files/Software"
367 "/randomjungle/randomjungle-" version ".tar_.gz"))
368 (patches (search-patches "randomjungle-disable-static-build.patch"))
369 (sha256
370 (base32
371 "12c8rf30cla71swx2mf4ww9mfd8jbdw5lnxd7dxhyw1ygrvg6y4w"))))
372 (build-system gnu-build-system)
373 (arguments
374 `(#:configure-flags
375 (list "--disable-static"
376 (string-append "--with-boost="
377 (assoc-ref %build-inputs "boost")))
378 #:phases
379 (modify-phases %standard-phases
380 (add-before
381 'configure 'set-CXXFLAGS
382 (lambda _
383 (setenv "CXXFLAGS" "-fpermissive ")
384 #t)))))
385 (inputs
386 `(("boost" ,boost)
387 ("gsl" ,gsl)
388 ("libxml2" ,libxml2)
389 ("zlib" ,zlib)))
390 (native-inputs
391 `(("gfortran" ,gfortran)
392 ("gfortran:lib" ,gfortran "lib")))
393 ;; Non-portable assembly instructions are used so building fails on
394 ;; platforms other than x86_64 or i686.
395 (supported-systems '("x86_64-linux" "i686-linux"))
396 (home-page "https://www.imbs.uni-luebeck.de/forschung/software/details.html#c224")
397 (synopsis "Implementation of the Random Forests machine learning method")
398 (description
399 "Random Jungle is an implementation of Random Forests. It is supposed to
400 analyse high dimensional data. In genetics, it can be used for analysing big
401 Genome Wide Association (GWA) data. Random Forests is a powerful machine
402 learning method. Most interesting features are variable selection, missing
403 value imputation, classifier creation, generalization error estimation and
404 sample proximities between pairs of cases.")
405 (license license:gpl3+)))
406
407 (define-public openfst
408 (package
409 (name "openfst")
410 (version "1.7.1")
411 (source (origin
412 (method url-fetch)
413 (uri (string-append "http://www.openfst.org/twiki/pub/FST/"
414 "FstDownload/openfst-" version ".tar.gz"))
415 (sha256
416 (base32
417 "0x9wfcqd8hq4h349s7j77sr60h8xjdfshqw1m3a2n6z5bdr9qkm1"))))
418 (build-system gnu-build-system)
419 (home-page "http://www.openfst.org")
420 (synopsis "Library for weighted finite-state transducers")
421 (description "OpenFst is a library for constructing, combining,
422 optimizing, and searching weighted finite-state transducers (FSTs).")
423 (license license:asl2.0)))
424
425 (define-public shogun
426 (package
427 (name "shogun")
428 (version "6.1.3")
429 (source
430 (origin
431 (method url-fetch)
432 (uri (string-append
433 "ftp://shogun-toolbox.org/shogun/releases/"
434 (version-major+minor version)
435 "/sources/shogun-" version ".tar.bz2"))
436 (sha256
437 (base32
438 "1rn9skm3nw6hr7mr3lgp2gfqhi7ii0lyxck7qmqnf8avq349s5jp"))
439 (modules '((guix build utils)
440 (ice-9 rdelim)))
441 (snippet
442 '(begin
443 ;; Remove non-free sources and files referencing them
444 (for-each delete-file
445 (find-files "src/shogun/classifier/svm/"
446 "SVMLight\\.(cpp|h)"))
447 (for-each delete-file
448 (find-files "examples/undocumented/libshogun/"
449 (string-append
450 "(classifier_.*svmlight.*|"
451 "evaluation_cross_validation_locked_comparison).cpp")))
452 ;; Remove non-free functions.
453 (define (delete-ifdefs file)
454 (with-atomic-file-replacement file
455 (lambda (in out)
456 (let loop ((line (read-line in 'concat))
457 (skipping? #f))
458 (if (eof-object? line)
459 #t
460 (let ((skip-next?
461 (or (and skipping?
462 (not (string-prefix?
463 "#endif //USE_SVMLIGHT" line)))
464 (string-prefix?
465 "#ifdef USE_SVMLIGHT" line))))
466 (when (or (not skipping?)
467 (and skipping? (not skip-next?)))
468 (display line out))
469 (loop (read-line in 'concat) skip-next?)))))))
470 (for-each delete-ifdefs
471 (append
472 (find-files "src/shogun/classifier/mkl"
473 "^MKLClassification\\.cpp")
474 (find-files "src/shogun/classifier/svm"
475 "^SVMLightOneClass\\.(cpp|h)")
476 (find-files "src/shogun/multiclass"
477 "^ScatterSVM\\.(cpp|h)")
478 (find-files "src/shogun/kernel/"
479 "^(Kernel|CombinedKernel|ProductKernel)\\.(cpp|h)")
480 (find-files "src/shogun/regression/svr"
481 "^(MKLRegression|SVRLight)\\.(cpp|h)")
482 (find-files "src/shogun/transfer/domain_adaptation"
483 "^DomainAdaptationSVM\\.(cpp|h)")))
484 #t))))
485 (build-system cmake-build-system)
486 (arguments
487 '(#:tests? #f ;no check target
488 #:phases
489 (modify-phases %standard-phases
490 (add-after 'unpack 'delete-broken-symlinks
491 (lambda _
492 (for-each delete-file '("applications/arts/data"
493 "applications/asp/data"
494 "applications/easysvm/data"
495 "applications/msplicer/data"
496 "applications/ocr/data"
497 "examples/meta/data"
498 "examples/undocumented/data"))
499 #t))
500 (add-after 'unpack 'change-R-target-path
501 (lambda* (#:key outputs #:allow-other-keys)
502 (substitute* '("src/interfaces/r/CMakeLists.txt"
503 "examples/meta/r/CMakeLists.txt")
504 (("\\$\\{R_COMPONENT_LIB_PATH\\}")
505 (string-append (assoc-ref outputs "out")
506 "/lib/R/library/")))
507 #t))
508 (add-after 'unpack 'fix-octave-modules
509 (lambda* (#:key outputs #:allow-other-keys)
510 (substitute* "src/interfaces/octave/CMakeLists.txt"
511 (("^include_directories\\(\\$\\{OCTAVE_INCLUDE_DIRS\\}")
512 "include_directories(${OCTAVE_INCLUDE_DIRS} ${OCTAVE_INCLUDE_DIRS}/octave")
513 ;; change target directory
514 (("\\$\\{OCTAVE_OCT_LOCAL_API_FILE_DIR\\}")
515 (string-append (assoc-ref outputs "out")
516 "/share/octave/packages")))
517 (substitute* '("src/interfaces/octave/swig_typemaps.i"
518 "src/interfaces/octave/sg_print_functions.cpp")
519 ;; "octave/config.h" and "octave/oct-obj.h" deprecated in Octave.
520 (("octave/config\\.h") "octave/octave-config.h")
521 (("octave/oct-obj.h") "octave/ovl.h"))
522 #t))
523 (add-after 'unpack 'move-rxcpp
524 (lambda* (#:key inputs #:allow-other-keys)
525 (let ((rxcpp-dir "shogun/third-party/rxcpp"))
526 (mkdir-p rxcpp-dir)
527 (install-file (assoc-ref inputs "rxcpp") rxcpp-dir)
528 #t)))
529 (add-before 'build 'set-HOME
530 ;; $HOME needs to be set at some point during the build phase
531 (lambda _ (setenv "HOME" "/tmp") #t)))
532 #:configure-flags
533 (list "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
534 "-DUSE_SVMLIGHT=OFF" ;disable proprietary SVMLIGHT
535 "-DBUILD_META_EXAMPLES=OFF" ;requires unpackaged ctags
536 ;;"-DINTERFACE_JAVA=ON" ;requires unpackaged jblas
537 ;;"-DINTERFACE_RUBY=ON" ;requires unpackaged ruby-narray
538 ;;"-DINTERFACE_PERL=ON" ;"FindPerlLibs" does not exist
539 ;;"-DINTERFACE_LUA=ON" ;fails because lua doesn't build pkgconfig file
540 "-DINTERFACE_OCTAVE=ON"
541 "-DINTERFACE_PYTHON=ON"
542 "-DINTERFACE_R=ON")))
543 (inputs
544 `(("python" ,python)
545 ("numpy" ,python-numpy)
546 ("r-minimal" ,r-minimal)
547 ("octave" ,octave-cli)
548 ("swig" ,swig)
549 ("eigen" ,eigen)
550 ("hdf5" ,hdf5)
551 ("atlas" ,atlas)
552 ("arpack" ,arpack-ng)
553 ("lapack" ,lapack)
554 ("glpk" ,glpk)
555 ("libxml2" ,libxml2)
556 ("lzo" ,lzo)
557 ("zlib" ,zlib)))
558 (native-inputs
559 `(("pkg-config" ,pkg-config)
560 ("rxcpp" ,rxcpp)))
561 ;; Non-portable SSE instructions are used so building fails on platforms
562 ;; other than x86_64.
563 (supported-systems '("x86_64-linux"))
564 (home-page "http://shogun-toolbox.org/")
565 (synopsis "Machine learning toolbox")
566 (description
567 "The Shogun Machine learning toolbox provides a wide range of unified and
568 efficient Machine Learning (ML) methods. The toolbox seamlessly allows to
569 combine multiple data representations, algorithm classes, and general purpose
570 tools. This enables both rapid prototyping of data pipelines and extensibility
571 in terms of new algorithms.")
572 (license license:gpl3+)))
573
574 (define-public rxcpp
575 (package
576 (name "rxcpp")
577 (version "4.0.0")
578 (source
579 (origin
580 (method url-fetch)
581 (uri (string-append "https://github.com/ReactiveX/RxCpp/archive/v"
582 version ".tar.gz"))
583 (sha256
584 (base32
585 "0y2isr8dy2n1yjr9c5570kpc9lvdlch6jv0jvw000amwn5d3krsh"))
586 (file-name (string-append name "-" version ".tar.gz"))))
587 (build-system cmake-build-system)
588 (arguments
589 `(#:phases
590 (modify-phases %standard-phases
591 (add-after 'unpack 'remove-werror
592 (lambda _
593 (substitute* (find-files ".")
594 (("-Werror") ""))
595 #t))
596 (replace 'check
597 (lambda _
598 (invoke "ctest"))))))
599 (native-inputs
600 `(("catch" ,catch-framework)))
601 (home-page "http://reactivex.io/")
602 (synopsis "Reactive Extensions for C++")
603 (description
604 "The Reactive Extensions for C++ (RxCpp) is a library of algorithms for
605 values-distributed-in-time. ReactiveX is a library for composing asynchronous
606 and event-based programs by using observable sequences.
607
608 It extends the observer pattern to support sequences of data and/or events and
609 adds operators that allow you to compose sequences together declaratively while
610 abstracting away concerns about things like low-level threading,
611 synchronization, thread-safety, concurrent data structures, and non-blocking
612 I/O.")
613 (license license:asl2.0)))
614
615 (define-public r-adaptivesparsity
616 (package
617 (name "r-adaptivesparsity")
618 (version "1.6")
619 (source (origin
620 (method url-fetch)
621 (uri (cran-uri "AdaptiveSparsity" version))
622 (sha256
623 (base32
624 "0imr5m8mll9j6n4icsv6z9rl5kbnwsp9wvzrg7n90nnmcxq2cz91"))))
625 (properties
626 `((upstream-name . "AdaptiveSparsity")))
627 (build-system r-build-system)
628 (arguments
629 `(#:phases
630 (modify-phases %standard-phases
631 (add-after 'unpack 'link-against-armadillo
632 (lambda _
633 (substitute* "src/Makevars"
634 (("PKG_LIBS=" prefix)
635 (string-append prefix "-larmadillo"))))))))
636 (propagated-inputs
637 `(("r-mass" ,r-mass)
638 ("r-matrix" ,r-matrix)
639 ("r-rcpp" ,r-rcpp)
640 ("r-rcpparmadillo" ,r-rcpparmadillo)))
641 (inputs
642 `(("armadillo" ,armadillo)))
643 (home-page "https://cran.r-project.org/web/packages/AdaptiveSparsity")
644 (synopsis "Adaptive sparsity models")
645 (description
646 "This package implements the Figueiredo machine learning algorithm for
647 adaptive sparsity and the Wong algorithm for adaptively sparse gaussian
648 geometric models.")
649 (license license:lgpl3+)))
650
651 (define-public gemmlowp-for-tensorflow
652 ;; The commit hash is taken from "tensorflow/workspace.bzl".
653 (let ((commit "38ebac7b059e84692f53e5938f97a9943c120d98")
654 (revision "2"))
655 (package
656 (name "gemmlowp")
657 (version (git-version "0" revision commit))
658 (source (origin
659 (method url-fetch)
660 (uri (string-append "https://mirror.bazel.build/"
661 "github.com/google/gemmlowp/archive/"
662 commit ".zip"))
663 (file-name (string-append "gemmlowp-" version ".zip"))
664 (sha256
665 (base32
666 "0n56s2g8hrssm4w8qj1v58gfm56a04n9v992ixkmvk6zjiralzxq"))))
667 (build-system cmake-build-system)
668 (arguments
669 `(#:configure-flags
670 (list ,@(match (%current-system)
671 ((or "x86_64-linux" "i686-linux")
672 '("-DCMAKE_CXX_FLAGS=-msse4.1"))
673 (_ '())))
674 #:phases
675 (modify-phases %standard-phases
676 ;; This directory contains the CMakeLists.txt.
677 (add-after 'unpack 'chdir
678 (lambda _ (chdir "contrib") #t))
679 ;; There is no install target
680 (replace 'install
681 (lambda* (#:key outputs #:allow-other-keys)
682 (let* ((out (assoc-ref outputs "out"))
683 (lib (string-append out "/lib/"))
684 (inc (string-append out "/include/")))
685 (install-file "../build/libeight_bit_int_gemm.so" lib)
686 (for-each (lambda (dir)
687 (let ((target (string-append inc "/" dir)))
688 (mkdir-p target)
689 (for-each (lambda (h)
690 (install-file h target))
691 (find-files (string-append "../" dir)
692 "\\.h$"))))
693 '("meta" "profiling" "public" "fixedpoint"
694 "eight_bit_int_gemm" "internal"))
695 #t))))))
696 (native-inputs
697 `(("unzip" ,unzip)))
698 (home-page "https://github.com/google/gemmlowp")
699 (synopsis "Small self-contained low-precision GEMM library")
700 (description
701 "This is a small self-contained low-precision @dfn{general matrix
702 multiplication} (GEMM) library. It is not a full linear algebra library.
703 Low-precision means that the input and output matrix entries are integers on
704 at most 8 bits. To avoid overflow, results are internally accumulated on more
705 than 8 bits, and at the end only some significant 8 bits are kept.")
706 (license license:asl2.0))))
707
708 (define-public dlib
709 (package
710 (name "dlib")
711 (version "19.7")
712 (source (origin
713 (method url-fetch)
714 (uri (string-append
715 "http://dlib.net/files/dlib-" version ".tar.bz2"))
716 (sha256
717 (base32
718 "1mljz02kwkrbggyncxv5fpnyjdybw2qihaacb3js8yfkw12vwpc2"))
719 (modules '((guix build utils)))
720 (snippet
721 '(begin
722 ;; Delete ~13MB of bundled dependencies.
723 (delete-file-recursively "dlib/external")
724 (delete-file-recursively "docs/dlib/external")
725 #t))))
726 (build-system cmake-build-system)
727 (arguments
728 `(#:phases
729 (modify-phases %standard-phases
730 (add-after 'unpack 'disable-asserts
731 (lambda _
732 ;; config.h recommends explicitly enabling or disabling asserts
733 ;; when building as a shared library. By default neither is set.
734 (substitute* "dlib/config.h"
735 (("^//#define DLIB_DISABLE_ASSERTS") "#define DLIB_DISABLE_ASSERTS"))
736 #t))
737 (add-after 'disable-asserts 'disable-failing-tests
738 (lambda _
739 ;; One test times out on MIPS, so we need to disable it.
740 ;; Others are flaky on some platforms.
741 (let* ((system ,(or (%current-target-system)
742 (%current-system)))
743 (disabled-tests (cond
744 ((string-prefix? "mips64" system)
745 '("object_detector" ; timeout
746 "data_io"))
747 ((string-prefix? "armhf" system)
748 '("learning_to_track"))
749 ((string-prefix? "i686" system)
750 '("optimization"))
751 (else '()))))
752 (for-each
753 (lambda (test)
754 (substitute* "dlib/test/makefile"
755 (((string-append "SRC \\+= " test "\\.cpp")) "")))
756 disabled-tests)
757 #t)))
758 (replace 'check
759 (lambda _
760 ;; No test target, so we build and run the unit tests here.
761 (let ((test-dir (string-append "../dlib-" ,version "/dlib/test")))
762 (with-directory-excursion test-dir
763 (invoke "make" "-j" (number->string (parallel-job-count)))
764 (invoke "./dtest" "--runall"))
765 #t)))
766 (add-after 'install 'delete-static-library
767 (lambda* (#:key outputs #:allow-other-keys)
768 (delete-file (string-append (assoc-ref outputs "out")
769 "/lib/libdlib.a"))
770 #t)))))
771 (native-inputs
772 `(("pkg-config" ,pkg-config)
773 ;; For tests.
774 ("libnsl" ,libnsl)))
775 (inputs
776 `(("giflib" ,giflib)
777 ("lapack" ,lapack)
778 ("libjpeg" ,libjpeg)
779 ("libpng" ,libpng)
780 ("libx11" ,libx11)
781 ("openblas" ,openblas)
782 ("zlib" ,zlib)))
783 (synopsis
784 "Toolkit for making machine learning and data analysis applications in C++")
785 (description
786 "Dlib is a modern C++ toolkit containing machine learning algorithms and
787 tools. It is used in both industry and academia in a wide range of domains
788 including robotics, embedded devices, mobile phones, and large high performance
789 computing environments.")
790 (home-page "http://dlib.net")
791 (license license:boost1.0)))
792
793 (define-public python-scikit-learn
794 (package
795 (name "python-scikit-learn")
796 (version "0.20.1")
797 (source
798 (origin
799 (method git-fetch)
800 (uri (git-reference
801 (url "https://github.com/scikit-learn/scikit-learn.git")
802 (commit version)))
803 (file-name (git-file-name name version))
804 (sha256
805 (base32
806 "0fkhwg3xn1s7ln9q1szq6kwc4jhwvjh8w4kmv9wcrqy7cq3lbv0d"))))
807 (build-system python-build-system)
808 (arguments
809 `(#:phases
810 (modify-phases %standard-phases
811 (add-after 'build 'build-ext
812 (lambda _ (invoke "python" "setup.py" "build_ext" "--inplace") #t))
813 (replace 'check
814 (lambda _
815 ;; Restrict OpenBLAS threads to prevent segfaults while testing!
816 (setenv "OPENBLAS_NUM_THREADS" "1")
817
818 ;; Some tests require write access to $HOME.
819 (setenv "HOME" "/tmp")
820
821 (invoke "pytest" "sklearn" "-m" "not network")))
822 ;; FIXME: This fails with permission denied
823 (delete 'reset-gzip-timestamps))))
824 (inputs
825 `(("openblas" ,openblas)))
826 (native-inputs
827 `(("python-pytest" ,python-pytest)
828 ("python-pandas" ,python-pandas) ;for tests
829 ("python-cython" ,python-cython)))
830 (propagated-inputs
831 `(("python-numpy" ,python-numpy)
832 ("python-scipy" ,python-scipy)))
833 (home-page "http://scikit-learn.org/")
834 (synopsis "Machine Learning in Python")
835 (description
836 "Scikit-learn provides simple and efficient tools for data mining and
837 data analysis.")
838 (license license:bsd-3)))
839
840 (define-public python2-scikit-learn
841 (package-with-python2 python-scikit-learn))
842
843 (define-public python-autograd
844 (let* ((commit "442205dfefe407beffb33550846434baa90c4de7")
845 (revision "0")
846 (version (git-version "0.0.0" revision commit)))
847 (package
848 (name "python-autograd")
849 (home-page "https://github.com/HIPS/autograd")
850 (source (origin
851 (method git-fetch)
852 (uri (git-reference
853 (url home-page)
854 (commit commit)))
855 (sha256
856 (base32
857 "189sv2xb0mwnjawa9z7mrgdglc1miaq93pnck26r28fi1jdwg0z4"))
858 (file-name (git-file-name name version))))
859 (version version)
860 (build-system python-build-system)
861 (native-inputs
862 `(("python-nose" ,python-nose)
863 ("python-pytest" ,python-pytest)))
864 (propagated-inputs
865 `(("python-future" ,python-future)
866 ("python-numpy" ,python-numpy)))
867 (arguments
868 `(#:phases (modify-phases %standard-phases
869 (replace 'check
870 (lambda _
871 (invoke "py.test" "-v"))))))
872 (synopsis "Efficiently computes derivatives of NumPy code")
873 (description "Autograd can automatically differentiate native Python and
874 NumPy code. It can handle a large subset of Python's features, including loops,
875 ifs, recursion and closures, and it can even take derivatives of derivatives
876 of derivatives. It supports reverse-mode differentiation
877 (a.k.a. backpropagation), which means it can efficiently take gradients of
878 scalar-valued functions with respect to array-valued arguments, as well as
879 forward-mode differentiation, and the two can be composed arbitrarily. The
880 main intended application of Autograd is gradient-based optimization.")
881 (license license:expat))))
882
883 (define-public python2-autograd
884 (package-with-python2 python-autograd))
885
886 (define-public lightgbm
887 (package
888 (name "lightgbm")
889 (version "2.0.12")
890 (source (origin
891 (method url-fetch)
892 (uri (string-append
893 "https://github.com/Microsoft/LightGBM/archive/v"
894 version ".tar.gz"))
895 (sha256
896 (base32
897 "132zf0yk0545mg72hyzxm102g3hpb6ixx9hnf8zd2k55gas6cjj1"))
898 (file-name (string-append name "-" version ".tar.gz"))))
899 (native-inputs
900 `(("python-pytest" ,python-pytest)
901 ("python-nose" ,python-nose)))
902 (inputs
903 `(("openmpi" ,openmpi)))
904 (propagated-inputs
905 `(("python-numpy" ,python-numpy)
906 ("python-scipy" ,python-scipy)))
907 (arguments
908 `(#:configure-flags
909 '("-DUSE_MPI=ON")
910 #:phases
911 (modify-phases %standard-phases
912 (replace 'check
913 (lambda* (#:key outputs #:allow-other-keys)
914 (with-directory-excursion ,(string-append "../LightGBM-" version)
915 (invoke "pytest" "tests/c_api_test/test_.py")))))))
916 (build-system cmake-build-system)
917 (home-page "https://github.com/Microsoft/LightGBM")
918 (synopsis "Gradient boosting framework based on decision tree algorithms")
919 (description "LightGBM is a gradient boosting framework that uses tree
920 based learning algorithms. It is designed to be distributed and efficient with
921 the following advantages:
922
923 @itemize
924 @item Faster training speed and higher efficiency
925 @item Lower memory usage
926 @item Better accuracy
927 @item Parallel and GPU learning supported (not enabled in this package)
928 @item Capable of handling large-scale data
929 @end itemize\n")
930 (license license:expat)))
931
932 (define-public vowpal-wabbit
933 ;; Language bindings not included.
934 (package
935 (name "vowpal-wabbit")
936 (version "8.5.0")
937 (source (origin
938 (method url-fetch)
939 (uri (string-append
940 "https://github.com/JohnLangford/vowpal_wabbit/archive/"
941 version ".tar.gz"))
942 (sha256
943 (base32
944 "0clp2kb7rk5sckhllxjr5a651awf4s8dgzg4659yh4hf5cqnf0gr"))
945 (file-name (string-append name "-" version ".tar.gz"))))
946 (inputs
947 `(("boost" ,boost)
948 ("zlib" ,zlib)))
949 (arguments
950 `(#:configure-flags
951 (list (string-append "--with-boost="
952 (assoc-ref %build-inputs "boost")))))
953 (build-system gnu-build-system)
954 (home-page "https://github.com/JohnLangford/vowpal_wabbit")
955 (synopsis "Fast machine learning library for online learning")
956 (description "Vowpal Wabbit is a machine learning system with techniques
957 such as online, hashing, allreduce, reductions, learning2search, active, and
958 interactive learning.")
959 (license license:bsd-3)))
960
961 (define-public python2-fastlmm
962 (package
963 (name "python2-fastlmm")
964 (version "0.2.21")
965 (source
966 (origin
967 (method url-fetch)
968 (uri (pypi-uri "fastlmm" version ".zip"))
969 (sha256
970 (base32
971 "1q8c34rpmwkfy3r4d5172pzdkpfryj561897z9r3x22gq7813x1m"))))
972 (build-system python-build-system)
973 (arguments
974 `(#:tests? #f ; some test files are missing
975 #:python ,python-2)) ; only Python 2.7 is supported
976 (propagated-inputs
977 `(("python2-numpy" ,python2-numpy)
978 ("python2-scipy" ,python2-scipy)
979 ("python2-matplotlib" ,python2-matplotlib)
980 ("python2-pandas" ,python2-pandas)
981 ("python2-scikit-learn" ,python2-scikit-learn)
982 ("python2-pysnptools" ,python2-pysnptools)))
983 (native-inputs
984 `(("unzip" ,unzip)
985 ("python2-cython" ,python2-cython)
986 ("python2-mock" ,python2-mock)
987 ("python2-nose" ,python2-nose)))
988 (home-page "http://research.microsoft.com/en-us/um/redmond/projects/mscompbio/fastlmm/")
989 (synopsis "Perform genome-wide association studies on large data sets")
990 (description
991 "FaST-LMM, which stands for Factored Spectrally Transformed Linear Mixed
992 Models, is a program for performing both single-SNP and SNP-set genome-wide
993 association studies (GWAS) on extremely large data sets.")
994 (license license:asl2.0)))
995
996 ;; There have been no proper releases yet.
997 (define-public kaldi
998 (let ((commit "2f95609f0bb085bd3a1dc5eb0a39f3edea59e606")
999 (revision "1"))
1000 (package
1001 (name "kaldi")
1002 (version (git-version "0" revision commit))
1003 (source (origin
1004 (method git-fetch)
1005 (uri (git-reference
1006 (url "https://github.com/kaldi-asr/kaldi.git")
1007 (commit commit)))
1008 (file-name (git-file-name name version))
1009 (sha256
1010 (base32
1011 "082qh3pfi7hvncylp4xsmkfahbd7gb0whdfa4rwrx7fxk9rdh3kz"))))
1012 (build-system gnu-build-system)
1013 (arguments
1014 `(#:test-target "test"
1015 #:phases
1016 (modify-phases %standard-phases
1017 (add-after 'unpack 'chdir
1018 (lambda _ (chdir "src") #t))
1019 (replace 'configure
1020 (lambda* (#:key build system inputs outputs #:allow-other-keys)
1021 (when (not (or (string-prefix? "x86_64" system)
1022 (string-prefix? "i686" system)))
1023 (substitute* "makefiles/linux_openblas.mk"
1024 (("-msse -msse2") "")))
1025 (substitute* "makefiles/default_rules.mk"
1026 (("/bin/bash") (which "bash")))
1027 (substitute* "Makefile"
1028 (("ext_depend: check_portaudio")
1029 "ext_depend:"))
1030 (substitute* '("online/Makefile"
1031 "onlinebin/Makefile"
1032 "gst-plugin/Makefile")
1033 (("../../tools/portaudio/install")
1034 (assoc-ref inputs "portaudio")))
1035
1036 ;; This `configure' script doesn't support variables passed as
1037 ;; arguments, nor does it support "prefix".
1038 (let ((out (assoc-ref outputs "out"))
1039 (openblas (assoc-ref inputs "openblas"))
1040 (openfst (assoc-ref inputs "openfst")))
1041 (substitute* "configure"
1042 (("check_for_slow_expf;") "")
1043 ;; This affects the RPATH and also serves as the installation
1044 ;; directory.
1045 (("KALDILIBDIR=`pwd`/lib")
1046 (string-append "KALDILIBDIR=" out "/lib")))
1047 (mkdir-p out) ; must exist
1048 (setenv "CONFIG_SHELL" (which "bash"))
1049 (setenv "OPENFST_VER" ,(package-version openfst))
1050 (invoke "./configure"
1051 "--use-cuda=no"
1052 "--shared"
1053 (string-append "--openblas-root=" openblas)
1054 (string-append "--fst-root=" openfst)))))
1055 (add-after 'build 'build-ext-and-gstreamer-plugin
1056 (lambda _
1057 (invoke "make" "-C" "online" "depend")
1058 (invoke "make" "-C" "online")
1059 (invoke "make" "-C" "onlinebin" "depend")
1060 (invoke "make" "-C" "onlinebin")
1061 (invoke "make" "-C" "gst-plugin" "depend")
1062 (invoke "make" "-C" "gst-plugin")
1063 #t))
1064 ;; TODO: also install the executables.
1065 (replace 'install
1066 (lambda* (#:key outputs #:allow-other-keys)
1067 (let* ((out (assoc-ref outputs "out"))
1068 (inc (string-append out "/include"))
1069 (lib (string-append out "/lib")))
1070 (mkdir-p lib)
1071 ;; The build phase installed symlinks to the actual
1072 ;; libraries. Install the actual targets.
1073 (for-each (lambda (file)
1074 (let ((target (readlink file)))
1075 (delete-file file)
1076 (install-file target lib)))
1077 (find-files lib "\\.so"))
1078 ;; Install headers
1079 (for-each (lambda (file)
1080 (let ((target-dir (string-append inc "/" (dirname file))))
1081 (install-file file target-dir)))
1082 (find-files "." "\\.h"))
1083 (install-file "gst-plugin/libgstonlinegmmdecodefaster.so"
1084 (string-append lib "/gstreamer-1.0"))
1085 #t))))))
1086 (inputs
1087 `(("alsa-lib" ,alsa-lib)
1088 ("gfortran" ,gfortran "lib")
1089 ("glib" ,glib)
1090 ("gstreamer" ,gstreamer)
1091 ("jack" ,jack-1)
1092 ("openblas" ,openblas)
1093 ("openfst" ,openfst)
1094 ("portaudio" ,portaudio)
1095 ("python" ,python)))
1096 (native-inputs
1097 `(("glib" ,glib "bin") ; glib-genmarshal
1098 ("grep" ,grep)
1099 ("sed" ,sed)
1100 ("pkg-config" ,pkg-config)
1101 ("which" ,which)))
1102 (home-page "https://kaldi-asr.org/")
1103 (synopsis "Speech recognition toolkit")
1104 (description "Kaldi is an extensible toolkit for speech recognition
1105 written in C++.")
1106 (license license:asl2.0))))
1107
1108 (define-public gst-kaldi-nnet2-online
1109 (let ((commit "617e43e73c7cc45eb9119028c02bd4178f738c4a")
1110 (revision "1"))
1111 (package
1112 (name "gst-kaldi-nnet2-online")
1113 (version (git-version "0" revision commit))
1114 (source (origin
1115 (method git-fetch)
1116 (uri (git-reference
1117 (url "https://github.com/alumae/gst-kaldi-nnet2-online.git")
1118 (commit commit)))
1119 (file-name (git-file-name name version))
1120 (sha256
1121 (base32
1122 "0xh3w67b69818s6ib02ara4lw7wamjdmh4jznvkpzrs4skbs9jx9"))))
1123 (build-system gnu-build-system)
1124 (arguments
1125 `(#:tests? #f ; there are none
1126 #:make-flags
1127 (list (string-append "SHELL="
1128 (assoc-ref %build-inputs "bash") "/bin/bash")
1129 (string-append "KALDI_ROOT="
1130 (assoc-ref %build-inputs "kaldi-src"))
1131 (string-append "KALDILIBDIR="
1132 (assoc-ref %build-inputs "kaldi") "/lib")
1133 "KALDI_FLAVOR=dynamic")
1134 #:phases
1135 (modify-phases %standard-phases
1136 (add-after 'unpack 'chdir
1137 (lambda _ (chdir "src") #t))
1138 (replace 'configure
1139 (lambda* (#:key inputs #:allow-other-keys)
1140 (let ((glib (assoc-ref inputs "glib")))
1141 (setenv "CXXFLAGS" "-std=c++11 -fPIC")
1142 (setenv "CPLUS_INCLUDE_PATH"
1143 (string-append glib "/include/glib-2.0:"
1144 glib "/lib/glib-2.0/include:"
1145 (assoc-ref inputs "gstreamer")
1146 "/include/gstreamer-1.0:"
1147 (getenv "CPLUS_INCLUDE_PATH"))))
1148 (substitute* "Makefile"
1149 (("include \\$\\(KALDI_ROOT\\)/src/kaldi.mk") "")
1150 (("\\$\\(error Cannot find") "#"))))
1151 (add-before 'build 'build-depend
1152 (lambda* (#:key make-flags #:allow-other-keys)
1153 (apply invoke "make" "depend" make-flags)))
1154 (replace 'install
1155 (lambda* (#:key outputs #:allow-other-keys)
1156 (let* ((out (assoc-ref outputs "out"))
1157 (lib (string-append out "/lib/gstreamer-1.0")))
1158 (install-file "libgstkaldinnet2onlinedecoder.so" lib)
1159 #t))))))
1160 (inputs
1161 `(("glib" ,glib)
1162 ("gstreamer" ,gstreamer)
1163 ("jansson" ,jansson)
1164 ("openfst" ,openfst)
1165 ("kaldi" ,kaldi)))
1166 (native-inputs
1167 `(("bash" ,bash)
1168 ("glib:bin" ,glib "bin") ; glib-genmarshal
1169 ("kaldi-src" ,(package-source kaldi))
1170 ("pkg-config" ,pkg-config)))
1171 (home-page "https://kaldi-asr.org/")
1172 (synopsis "Gstreamer plugin for decoding speech")
1173 (description "This package provides a GStreamer plugin that wraps
1174 Kaldi's @code{SingleUtteranceNnet2Decoder}. It requires iVector-adapted DNN
1175 acoustic models. The iVectors are adapted to the current audio stream
1176 automatically.")
1177 (license license:asl2.0))))
1178
1179 (define-public kaldi-gstreamer-server
1180 (let ((commit "1735ba49c5dc0ebfc184e45105fc600cd9f1f508")
1181 (revision "1"))
1182 (package
1183 (name "kaldi-gstreamer-server")
1184 (version (git-version "0" revision commit))
1185 (source (origin
1186 (method git-fetch)
1187 (uri (git-reference
1188 (url "https://github.com/alumae/kaldi-gstreamer-server.git")
1189 (commit commit)))
1190 (file-name (git-file-name name version))
1191 (sha256
1192 (base32
1193 "0j701m7lbwmzqxsfanj882v7881hrbmpqybbczbxqpcbg8q34w0k"))))
1194 (build-system gnu-build-system)
1195 (arguments
1196 `(#:tests? #f ; there are no tests that can be run automatically
1197 #:modules ((guix build utils)
1198 (guix build gnu-build-system)
1199 (srfi srfi-26))
1200 #:phases
1201 (modify-phases %standard-phases
1202 (delete 'configure)
1203 (replace 'build
1204 (lambda* (#:key outputs #:allow-other-keys)
1205 ;; Disable hash randomization to ensure the generated .pycs
1206 ;; are reproducible.
1207 (setenv "PYTHONHASHSEED" "0")
1208 (with-directory-excursion "kaldigstserver"
1209 (for-each (lambda (file)
1210 (apply invoke
1211 `("python"
1212 "-m" "compileall"
1213 "-f" ; force rebuild
1214 ,file)))
1215 (find-files "." "\\.py$")))
1216 #t))
1217 (replace 'install
1218 (lambda* (#:key inputs outputs #:allow-other-keys)
1219 (let* ((out (assoc-ref outputs "out"))
1220 (bin (string-append out "/bin"))
1221 (share (string-append out "/share/kaldi-gstreamer-server/")))
1222 ;; Install Python files
1223 (with-directory-excursion "kaldigstserver"
1224 (for-each (cut install-file <> share)
1225 (find-files "." ".*")))
1226
1227 ;; Install sample configuration files
1228 (for-each (cut install-file <> share)
1229 (find-files "." "\\.yaml"))
1230
1231 ;; Install executables
1232 (mkdir-p bin)
1233 (let* ((server (string-append bin "/kaldi-gst-server"))
1234 (client (string-append bin "/kaldi-gst-client"))
1235 (worker (string-append bin "/kaldi-gst-worker"))
1236 (PYTHONPATH (getenv "PYTHONPATH"))
1237 (GST_PLUGIN_PATH (string-append
1238 (assoc-ref inputs "gst-kaldi-nnet2-online")
1239 "/lib/gstreamer-1.0:${GST_PLUGIN_PATH}"))
1240 (wrap (lambda (wrapper what)
1241 (with-output-to-file wrapper
1242 (lambda _
1243 (format #t
1244 "#!~a
1245 export PYTHONPATH=~a
1246 export GST_PLUGIN_PATH=~a
1247 exec ~a ~a/~a \"$@\"~%"
1248 (which "bash") PYTHONPATH GST_PLUGIN_PATH
1249 (which "python") share what)))
1250 (chmod wrapper #o555))))
1251 (for-each wrap
1252 (list server client worker)
1253 (list "master_server.py"
1254 "client.py"
1255 "worker.py")))
1256 #t))))))
1257 (inputs
1258 `(("gst-kaldi-nnet2-online" ,gst-kaldi-nnet2-online)
1259 ("python2" ,python-2)
1260 ("python2-futures" ,python2-futures)
1261 ("python2-pygobject" ,python2-pygobject)
1262 ("python2-pyyaml" ,python2-pyyaml)
1263 ("python2-tornado" ,python2-tornado)
1264 ("python2-ws4py" ,python2-ws4py-for-kaldi-gstreamer-server)))
1265 (home-page "https://github.com/alumae/kaldi-gstreamer-server")
1266 (synopsis "Real-time full-duplex speech recognition server")
1267 (description "This is a real-time full-duplex speech recognition server,
1268 based on the Kaldi toolkit and the GStreamer framework and implemented in
1269 Python.")
1270 (license license:bsd-2))))
1271
1272 (define-public grpc
1273 (package
1274 (name "grpc")
1275 (version "1.16.1")
1276 (source (origin
1277 (method git-fetch)
1278 (uri (git-reference
1279 (url "https://github.com/grpc/grpc.git")
1280 (commit (string-append "v" version))))
1281 (file-name (git-file-name name version))
1282 (sha256
1283 (base32
1284 "1jimqz3115f9pli5w6ik9wi7mjc7ix6y7yrq4a1ab9fc3dalj7p2"))))
1285 (build-system cmake-build-system)
1286 (arguments
1287 `(#:tests? #f ; no test target
1288 #:configure-flags
1289 (list "-DgRPC_ZLIB_PROVIDER=package"
1290 "-DgRPC_CARES_PROVIDER=package"
1291 "-DgRPC_SSL_PROVIDER=package"
1292 "-DgRPC_PROTOBUF_PROVIDER=package")))
1293 (inputs
1294 `(("c-ares" ,c-ares-next)
1295 ("openssl" ,openssl)
1296 ("zlib" ,zlib)))
1297 (native-inputs
1298 `(("protobuf" ,protobuf-next)
1299 ("python" ,python-wrapper)))
1300 (home-page "https://grpc.io")
1301 (synopsis "High performance universal RPC framework")
1302 (description "gRPC is a modern open source high performance @dfn{Remote
1303 Procedure Call} (RPC) framework that can run in any environment. It can
1304 efficiently connect services in and across data centers with pluggable support
1305 for load balancing, tracing, health checking and authentication. It is also
1306 applicable in last mile of distributed computing to connect devices, mobile
1307 applications and browsers to backend services.")
1308 (license license:asl2.0)))
1309
1310 ;; Note that Tensorflow includes a "third_party" directory, which seems to not
1311 ;; only contain modified subsets of upstream library source code, but also
1312 ;; adapter headers provided by Google (such as the fft.h header, which is not
1313 ;; part of the upstream project code). The Tensorflow code includes headers
1314 ;; from the "third_party" directory. It does not look like we can replace
1315 ;; these headers with unmodified upstream files, so we keep them.
1316 (define-public tensorflow
1317 (package
1318 (name "tensorflow")
1319 (version "1.9.0")
1320 (source
1321 (origin
1322 (method git-fetch)
1323 (uri (git-reference
1324 (url "https://github.com/tensorflow/tensorflow.git")
1325 (commit (string-append "v" version))))
1326 (file-name (string-append "tensorflow-" version "-checkout"))
1327 (sha256
1328 (base32
1329 "0a9kwha395g3wgxfwln5j8vn9nkspmd75xldrlqdq540w996g8xa"))))
1330 (build-system cmake-build-system)
1331 (arguments
1332 `(#:tests? #f ; no "check" target
1333 #:build-type "Release"
1334 #:configure-flags
1335 (let ((protobuf (assoc-ref %build-inputs "protobuf"))
1336 (protobuf:native (assoc-ref %build-inputs "protobuf:native"))
1337 (jsoncpp (assoc-ref %build-inputs "jsoncpp"))
1338 (snappy (assoc-ref %build-inputs "snappy"))
1339 (sqlite (assoc-ref %build-inputs "sqlite")))
1340 (list
1341 ;; Use protobuf from Guix
1342 (string-append "-Dprotobuf_STATIC_LIBRARIES="
1343 protobuf "/lib/libprotobuf.so")
1344 (string-append "-DPROTOBUF_PROTOC_EXECUTABLE="
1345 protobuf:native "/bin/protoc")
1346
1347 ;; Use snappy from Guix
1348 (string-append "-Dsnappy_STATIC_LIBRARIES="
1349 snappy "/lib/libsnappy.so")
1350 ;; Yes, this is not actually the include directory but a prefix...
1351 (string-append "-Dsnappy_INCLUDE_DIR=" snappy)
1352
1353 ;; Use jsoncpp from Guix
1354 (string-append "-Djsoncpp_STATIC_LIBRARIES="
1355 jsoncpp "/lib/libjsoncpp.so")
1356 ;; Yes, this is not actually the include directory but a prefix...
1357 (string-append "-Djsoncpp_INCLUDE_DIR=" jsoncpp)
1358
1359 ;; Use sqlite from Guix
1360 (string-append "-Dsqlite_STATIC_LIBRARIES="
1361 sqlite "/lib/libsqlite.a")
1362
1363 ;; Use system libraries wherever possible. Currently, this
1364 ;; only affects zlib.
1365 "-Dsystemlib_ALL=ON"
1366 "-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON"
1367 "-Dtensorflow_BUILD_SHARED_LIB=ON"
1368 "-Dtensorflow_OPTIMIZE_FOR_NATIVE_ARCH=OFF"
1369 "-Dtensorflow_ENABLE_SSL_SUPPORT=OFF"
1370 "-Dtensorflow_BUILD_CONTRIB_KERNELS=OFF"))
1371 #:make-flags
1372 (list "CC=gcc")
1373 #:modules ((ice-9 ftw)
1374 (guix build utils)
1375 (guix build cmake-build-system))
1376 #:phases
1377 (modify-phases %standard-phases
1378 (add-after 'unpack 'set-source-file-times-to-1980
1379 ;; At the end of the tf_python_build_pip_package target, a ZIP
1380 ;; archive should be generated via bdist_wheel, but it fails with
1381 ;; "ZIP does not support timestamps before 1980". Luckily,
1382 ;; SOURCE_DATE_EPOCH is respected, which we set to some time in
1383 ;; 1980.
1384 (lambda _ (setenv "SOURCE_DATE_EPOCH" "315532800") #t))
1385 ;; See https://github.com/tensorflow/tensorflow/issues/20517#issuecomment-406373913
1386 (add-after 'unpack 'python3.7-compatibility
1387 (lambda _
1388 (substitute* '("tensorflow/python/eager/pywrap_tfe_src.cc"
1389 "tensorflow/python/lib/core/ndarray_tensor.cc"
1390 "tensorflow/python/lib/core/py_func.cc")
1391 (("PyUnicode_AsUTF8") "(char *)PyUnicode_AsUTF8"))
1392 (substitute* "tensorflow/c/eager/c_api.h"
1393 (("unsigned char async")
1394 "unsigned char is_async"))
1395
1396 ;; Remove dependency on tensorboard, a complicated but probably
1397 ;; optional package.
1398 (substitute* "tensorflow/tools/pip_package/setup.py"
1399 ((".*'tensorboard >.*") ""))
1400 #t))
1401 (add-after 'python3.7-compatibility 'chdir
1402 (lambda _ (chdir "tensorflow/contrib/cmake") #t))
1403 (add-after 'chdir 'disable-downloads
1404 (lambda* (#:key inputs #:allow-other-keys)
1405 (substitute* (find-files "external" "\\.cmake$")
1406 (("GIT_REPOSITORY.*") "")
1407 (("GIT_TAG.*") "")
1408 (("PREFIX ")
1409 "DOWNLOAD_COMMAND \"\"\nPREFIX "))
1410
1411 ;; Use packages from Guix
1412 (let ((grpc (assoc-ref inputs "grpc")))
1413 (substitute* "CMakeLists.txt"
1414 ;; Sqlite
1415 (("include\\(sqlite\\)") "")
1416 (("\\$\\{sqlite_STATIC_LIBRARIES\\}")
1417 (string-append (assoc-ref inputs "sqlite")
1418 "/lib/libsqlite3.so"))
1419 (("sqlite_copy_headers_to_destination") "")
1420
1421 ;; PNG
1422 (("include\\(png\\)") "")
1423 (("\\$\\{png_STATIC_LIBRARIES\\}")
1424 (string-append (assoc-ref inputs "libpng")
1425 "/lib/libpng16.so"))
1426 (("png_copy_headers_to_destination") "")
1427
1428 ;; JPEG
1429 (("include\\(jpeg\\)") "")
1430 (("\\$\\{jpeg_STATIC_LIBRARIES\\}")
1431 (string-append (assoc-ref inputs "libjpeg")
1432 "/lib/libjpeg.so"))
1433 (("jpeg_copy_headers_to_destination") "")
1434
1435 ;; GIF
1436 (("include\\(gif\\)") "")
1437 (("\\$\\{gif_STATIC_LIBRARIES\\}")
1438 (string-append (assoc-ref inputs "giflib")
1439 "/lib/libgif.so"))
1440 (("gif_copy_headers_to_destination") "")
1441
1442 ;; lmdb
1443 (("include\\(lmdb\\)") "")
1444 (("\\$\\{lmdb_STATIC_LIBRARIES\\}")
1445 (string-append (assoc-ref inputs "lmdb")
1446 "/lib/liblmdb.so"))
1447 (("lmdb_copy_headers_to_destination") "")
1448
1449 ;; Protobuf
1450 (("include\\(protobuf\\)") "")
1451 (("protobuf_copy_headers_to_destination") "")
1452 (("^ +protobuf") "")
1453
1454 ;; gRPC
1455 (("include\\(grpc\\)")
1456 "find_package(grpc REQUIRED NAMES gRPC)")
1457 (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES grpc\\)") "")
1458
1459 ;; Eigen
1460 (("include\\(eigen\\)")
1461 (string-append "find_package(eigen REQUIRED NAMES Eigen3)
1462 set(eigen_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/external/eigen_archive "
1463 (assoc-ref inputs "eigen") "/include/eigen3)"))
1464 (("^ +eigen") "")
1465
1466 ;; snappy
1467 (("include\\(snappy\\)")
1468 "add_definitions(-DTF_USE_SNAPPY)")
1469 (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES snappy\\)") "")
1470
1471 ;; jsoncpp
1472 (("include\\(jsoncpp\\)") "")
1473 (("^ +jsoncpp") ""))
1474
1475 (substitute* "tf_core_framework.cmake"
1476 ((" grpc") "")
1477 (("\\$\\{GRPC_BUILD\\}/grpc_cpp_plugin")
1478 (which "grpc_cpp_plugin"))
1479 ;; Link with gRPC libraries
1480 (("add_library\\(tf_protos_cc.*" m)
1481 (string-append m
1482 (format #f "\ntarget_link_libraries(tf_protos_cc PRIVATE \
1483 ~a/lib/libgrpc++_unsecure.a \
1484 ~a/lib/libgrpc_unsecure.a \
1485 ~a/lib/libaddress_sorting.a \
1486 ~a/lib/libgpr.a \
1487 ~a//lib/libcares.so
1488 )\n"
1489 grpc grpc grpc grpc
1490 (assoc-ref inputs "c-ares"))))))
1491 (substitute* "tf_tools.cmake"
1492 (("add_dependencies\\(\\$\\{proto_text.*") ""))
1493 ;; Remove dependency on bundled grpc
1494 (substitute* "tf_core_distributed_runtime.cmake"
1495 (("tf_core_cpu grpc") "tf_core_cpu"))
1496
1497 ;; This directory is a dependency of many targets.
1498 (mkdir-p "protobuf")
1499 #t))
1500 (add-after 'configure 'unpack-third-party-sources
1501 (lambda* (#:key inputs #:allow-other-keys)
1502 ;; This is needed to configure bundled packages properly.
1503 (setenv "CONFIG_SHELL" (which "bash"))
1504 (for-each
1505 (lambda (name)
1506 (let* ((what (assoc-ref inputs (string-append name "-src")))
1507 (name* (string-map (lambda (c)
1508 (if (char=? c #\-)
1509 #\_ c)) name))
1510 (where (string-append "../build/" name* "/src/" name*)))
1511 (cond
1512 ((string-suffix? ".zip" what)
1513 (mkdir-p where)
1514 (with-directory-excursion where
1515 (invoke "unzip" what)))
1516 ((string-suffix? ".tar.gz" what)
1517 (mkdir-p where)
1518 (invoke "tar" "xf" what
1519 "-C" where "--strip-components=1"))
1520 (else
1521 (let ((parent (dirname where)))
1522 (mkdir-p parent)
1523 (with-directory-excursion parent
1524 (when (file-exists? name*)
1525 (delete-file-recursively name*))
1526 (copy-recursively what name*)
1527 (map make-file-writable
1528 (find-files name* ".*"))))))))
1529 (list "boringssl"
1530 "cub"
1531 "double-conversion"
1532 "farmhash"
1533 "fft2d"
1534 "highwayhash"
1535 "nsync"
1536 "re2"))
1537
1538 (rename-file "../build/cub/src/cub/cub-1.8.0/"
1539 "../build/cub/src/cub/cub/")
1540 #t))
1541 (add-after 'unpack 'fix-python-build
1542 (lambda* (#:key inputs outputs #:allow-other-keys)
1543 (mkdir-p "protobuf-src")
1544 (invoke "tar" "xf" (assoc-ref inputs "protobuf:src")
1545 "-C" "protobuf-src" "--strip-components=1")
1546 (mkdir-p "eigen-src")
1547 (invoke "tar" "xf" (assoc-ref inputs "eigen:src")
1548 "-C" "eigen-src" "--strip-components=1")
1549
1550 (substitute* "tensorflow/contrib/cmake/tf_python.cmake"
1551 ;; Ensure that all Python dependencies can be found at build time.
1552 (("PYTHONPATH=\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/tf_python" m)
1553 (string-append m ":" (getenv "PYTHONPATH")))
1554 ;; Take protobuf source files from our source package.
1555 (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/protobuf/src/protobuf/src/google")
1556 (string-append (getcwd) "/protobuf-src/src/google")))
1557
1558 (substitute* '("tensorflow/contrib/cmake/tf_shared_lib.cmake"
1559 "tensorflow/contrib/cmake/tf_python.cmake")
1560 ;; Take Eigen source files from our source package.
1561 (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/eigen/src/eigen/")
1562 (string-append (getcwd) "/eigen-src/"))
1563 ;; Take Eigen headers from our own package.
1564 (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/external/eigen_archive")
1565 (string-append (assoc-ref inputs "eigen") "/include/eigen3")))
1566
1567 ;; Correct the RUNPATH of ops libraries generated for Python.
1568 ;; TODO: this doesn't work :(
1569 ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so:
1570 ;; warning: RUNPATH contains bogus entries: ("/tmp/guix-build-tensorflow-1.9.0.drv-0/source/tensorflow/contrib/build")
1571 ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so:
1572 ;; error: depends on 'libpywrap_tensorflow_internal.so', which
1573 ;; cannot be found in RUNPATH ...
1574 (substitute* "tensorflow/contrib/cmake/tf_cc_ops.cmake"
1575 (("set_target_properties.*")
1576 (string-append "set_target_properties(${_AT_TARGET} PROPERTIES \
1577 COMPILE_FLAGS ${target_compile_flags} \
1578 INSTALL_RPATH_USE_LINK_PATH TRUE \
1579 INSTALL_RPATH " (assoc-ref outputs "out") "/lib)\n")))
1580 #t))
1581 (add-after 'build 'build-pip-package
1582 (lambda* (#:key outputs #:allow-other-keys)
1583 (setenv "LDFLAGS"
1584 (string-append "-Wl,-rpath="
1585 (assoc-ref outputs "out") "/lib"))
1586 (invoke "make" "tf_python_build_pip_package")
1587 #t))
1588 (add-after 'build-pip-package 'install-python
1589 (lambda* (#:key outputs #:allow-other-keys)
1590 (let ((out (assoc-ref outputs "out"))
1591 (wheel (car (find-files "../build/tf_python/dist/" "\\.whl$"))))
1592 (invoke "python" "-m" "pip" "install" wheel
1593 (string-append "--prefix=" out))
1594
1595 ;; XXX: broken RUNPATH, see fix-python-build phase.
1596 (delete-file
1597 (string-append
1598 out "/lib/python3.7/site-packages/tensorflow/contrib/"
1599 "seq2seq/python/ops/lib_beam_search_ops.so"))
1600 #t))))))
1601 (native-inputs
1602 `(("pkg-config" ,pkg-config)
1603 ("protobuf:native" ,protobuf-next) ; protoc
1604 ("protobuf:src" ,(package-source protobuf-next))
1605 ("eigen:src" ,(package-source eigen-for-tensorflow))
1606 ;; The commit hashes and URLs for third-party source code are taken
1607 ;; from "tensorflow/workspace.bzl".
1608 ("boringssl-src"
1609 ,(let ((commit "ee7aa02")
1610 (revision "1"))
1611 (origin
1612 (method git-fetch)
1613 (uri (git-reference
1614 (url "https://boringssl.googlesource.com/boringssl")
1615 (commit commit)))
1616 (file-name (string-append "boringssl-0-" revision
1617 (string-take commit 7)
1618 "-checkout"))
1619 (sha256
1620 (base32
1621 "1jf693q0nw0adsic6cgmbdx6g7wr4rj4vxa8j1hpn792fqhd8wgw")))))
1622 ("cub-src"
1623 ,(let ((version "1.8.0"))
1624 (origin
1625 (method url-fetch)
1626 (uri (string-append "https://mirror.bazel.build/github.com/NVlabs/"
1627 "cub/archive/" version ".zip"))
1628 (file-name (string-append "cub-" version ".zip"))
1629 (sha256
1630 (base32
1631 "1hsqikqridb90dkxkjr2918dcry6pfh46ccnwrzawl56aamhdykb")))))
1632 ("double-conversion-src"
1633 ,(let ((commit "5664746")
1634 (revision "1"))
1635 (origin
1636 (method git-fetch)
1637 (uri (git-reference
1638 (url "https://github.com/google/double-conversion.git")
1639 (commit commit)))
1640 (file-name
1641 (git-file-name "double-conversion"
1642 (string-append "0-" revision "."
1643 (string-take commit 7))))
1644 (sha256
1645 (base32
1646 "1h5lppqqxcvdg5jq42i5msgwx20ryij3apvmndflngrgdpc04gn1")))))
1647 ("farmhash-src"
1648 ,(let ((commit "816a4ae622e964763ca0862d9dbd19324a1eaf45"))
1649 (origin
1650 (method url-fetch)
1651 (uri (string-append
1652 "https://mirror.bazel.build/github.com/google/farmhash/archive/"
1653 commit ".tar.gz"))
1654 (file-name (string-append "farmhash-0-" (string-take commit 7)
1655 ".tar.gz"))
1656 (sha256
1657 (base32
1658 "185b2xdxl4d4cnsnv6abg8s22gxvx8673jq2yaq85bz4cdy58q35")))))
1659 ;; The license notice on the home page at
1660 ;; http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html says:
1661 ;; Copyright Takuya OOURA, 1996-2001
1662 ;;
1663 ;; You may use, copy, modify and distribute this code for any purpose
1664 ;; (include commercial use) and without fee. Please refer to this
1665 ;; package when you modify this code.
1666 ;;
1667 ;; We take the identical tarball from the Bazel mirror, because the URL
1668 ;; at the home page is not versioned and might change.
1669 ("fft2d-src"
1670 ,(origin
1671 (method url-fetch)
1672 (uri "https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz")
1673 (file-name "fft2d.tar.gz")
1674 (sha256
1675 (base32
1676 "15jjkfvhqvl2c0753d2di8hz0pyzn598g74wqy79awdrf1y67fsj"))))
1677 ("highwayhash-src"
1678 ,(let ((commit "be5edafc2e1a455768e260ccd68ae7317b6690ee")
1679 (revision "1"))
1680 (origin
1681 (method git-fetch)
1682 (uri (git-reference
1683 (url "https://github.com/google/highwayhash.git")
1684 (commit commit)))
1685 (file-name (string-append "highwayhash-0-" revision
1686 (string-take commit 7)
1687 "-checkout"))
1688 (sha256
1689 (base32
1690 "154jwf98cyy54hldr94pgjn85zynly3abpnc1avmb8a18lzwjyb6")))))
1691 ("nsync-src"
1692 ,(let ((version "0559ce013feac8db639ee1bf776aca0325d28777")
1693 (revision "1"))
1694 (origin
1695 (method url-fetch)
1696 (uri (string-append "https://mirror.bazel.build/"
1697 "github.com/google/nsync/archive/"
1698 version ".tar.gz"))
1699 (file-name (string-append "nsync-0." revision
1700 "-" (string-take version 7)
1701 ".tar.gz"))
1702 (sha256
1703 (base32
1704 "0qdkyqym34x739mmzv97ah5r7ph462v5xkxqxvidmcfqbi64b132")))))
1705 ("re2-src"
1706 ,(let ((commit "e7efc48")
1707 (revision "1"))
1708 (origin
1709 (method git-fetch)
1710 (uri (git-reference
1711 (url "https://github.com/google/re2")
1712 (commit commit)))
1713 (file-name (string-append "re2-0-" revision
1714 (string-take commit 7)
1715 "-checkout"))
1716 (sha256
1717 (base32
1718 "161g9841rjfsy5pn52fcis0s9hdr7rxvb06pad38j5rppfihvign")))))
1719 ("googletest" ,googletest)
1720 ("swig" ,swig)
1721 ("unzip" ,unzip)))
1722 (propagated-inputs
1723 `(("python-absl-py" ,python-absl-py)
1724 ("python-astor" ,python-astor)
1725 ("python-gast" ,python-gast)
1726 ("python-grpcio" ,python-grpcio)
1727 ("python-numpy" ,python-numpy)
1728 ("python-protobuf" ,python-protobuf-next)
1729 ("python-six" ,python-six)
1730 ("python-termcolo" ,python-termcolor)
1731 ("python-wheel" ,python-wheel)))
1732 (inputs
1733 `(("c-ares" ,c-ares-next)
1734 ("eigen" ,eigen-for-tensorflow)
1735 ("gemmlowp" ,gemmlowp-for-tensorflow)
1736 ("lmdb" ,lmdb)
1737 ("libjpeg" ,libjpeg)
1738 ("libpng" ,libpng)
1739 ("giflib" ,giflib)
1740 ("grpc" ,grpc)
1741 ("jsoncpp" ,jsoncpp-for-tensorflow)
1742 ("snappy" ,snappy)
1743 ("sqlite" ,sqlite)
1744 ("protobuf" ,protobuf-next)
1745 ("python" ,python-wrapper)
1746 ("zlib" ,zlib)))
1747 (home-page "https://tensorflow.org")
1748 (synopsis "Machine learning framework")
1749 (description
1750 "TensorFlow is a flexible platform for building and training machine
1751 learning models. It provides a library for high performance numerical
1752 computation and includes high level Python APIs, including both a sequential
1753 API for beginners that allows users to build models quickly by plugging
1754 together building blocks and a subclassing API with an imperative style for
1755 advanced research.")
1756 (license license:asl2.0)))