diff options
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/packages/machine-learning.scm | 562 |
1 files changed, 0 insertions, 562 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 9b0982be04e..ff99c5cbc16 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm | |||
| @@ -3169,568 +3169,6 @@ based on the Kaldi toolkit and the GStreamer framework and implemented in | |||
| 3169 | Python.") | 3169 | Python.") |
| 3170 | (license license:bsd-2)))) | 3170 | (license license:bsd-2)))) |
| 3171 | 3171 | ||
| 3172 | ;; Note that Tensorflow includes a "third_party" directory, which seems to not | ||
| 3173 | ;; only contain modified subsets of upstream library source code, but also | ||
| 3174 | ;; adapter headers provided by Google (such as the fft.h header, which is not | ||
| 3175 | ;; part of the upstream project code). The Tensorflow code includes headers | ||
| 3176 | ;; from the "third_party" directory. It does not look like we can replace | ||
| 3177 | ;; these headers with unmodified upstream files, so we keep them. | ||
| 3178 | (define-public tensorflow | ||
| 3179 | (package | ||
| 3180 | (name "tensorflow") | ||
| 3181 | (version "1.9.0") | ||
| 3182 | (source | ||
| 3183 | (origin | ||
| 3184 | (method git-fetch) | ||
| 3185 | (uri (git-reference | ||
| 3186 | (url "https://github.com/tensorflow/tensorflow") | ||
| 3187 | (commit (string-append "v" version)))) | ||
| 3188 | (file-name (string-append "tensorflow-" version "-checkout")) | ||
| 3189 | (sha256 | ||
| 3190 | (base32 | ||
| 3191 | "0a9kwha395g3wgxfwln5j8vn9nkspmd75xldrlqdq540w996g8xa")) | ||
| 3192 | (patches | ||
| 3193 | (search-patches "tensorflow-c-api-fix.patch")))) | ||
| 3194 | (build-system cmake-build-system) | ||
| 3195 | (arguments | ||
| 3196 | `(#:tests? #f ; no "check" target | ||
| 3197 | #:build-type "Release" | ||
| 3198 | #:configure-flags | ||
| 3199 | (let ((protobuf (assoc-ref %build-inputs "protobuf")) | ||
| 3200 | (protobuf:native (assoc-ref %build-inputs "protobuf:native")) | ||
| 3201 | (jsoncpp (assoc-ref %build-inputs "jsoncpp")) | ||
| 3202 | (snappy (assoc-ref %build-inputs "snappy")) | ||
| 3203 | (sqlite (assoc-ref %build-inputs "sqlite"))) | ||
| 3204 | (list | ||
| 3205 | ;; Use protobuf from Guix | ||
| 3206 | (string-append "-Dprotobuf_STATIC_LIBRARIES=" | ||
| 3207 | protobuf "/lib/libprotobuf.so") | ||
| 3208 | (string-append "-DPROTOBUF_PROTOC_EXECUTABLE=" | ||
| 3209 | protobuf:native "/bin/protoc") | ||
| 3210 | |||
| 3211 | ;; Use snappy from Guix | ||
| 3212 | (string-append "-Dsnappy_STATIC_LIBRARIES=" | ||
| 3213 | snappy "/lib/libsnappy.so") | ||
| 3214 | ;; Yes, this is not actually the include directory but a prefix... | ||
| 3215 | (string-append "-Dsnappy_INCLUDE_DIR=" snappy) | ||
| 3216 | |||
| 3217 | ;; Use jsoncpp from Guix | ||
| 3218 | (string-append "-Djsoncpp_STATIC_LIBRARIES=" | ||
| 3219 | jsoncpp "/lib/libjsoncpp.so") | ||
| 3220 | ;; Yes, this is not actually the include directory but a prefix... | ||
| 3221 | (string-append "-Djsoncpp_INCLUDE_DIR=" jsoncpp) | ||
| 3222 | |||
| 3223 | ;; Use sqlite from Guix | ||
| 3224 | (string-append "-Dsqlite_STATIC_LIBRARIES=" | ||
| 3225 | sqlite "/lib/libsqlite.a") | ||
| 3226 | |||
| 3227 | ;; Use system libraries wherever possible. Currently, this | ||
| 3228 | ;; only affects zlib. | ||
| 3229 | "-Dsystemlib_ALL=ON" | ||
| 3230 | "-Dtensorflow_ENABLE_POSITION_INDEPENDENT_CODE=ON" | ||
| 3231 | "-Dtensorflow_BUILD_SHARED_LIB=ON" | ||
| 3232 | "-Dtensorflow_OPTIMIZE_FOR_NATIVE_ARCH=OFF" | ||
| 3233 | "-Dtensorflow_ENABLE_SSL_SUPPORT=OFF" | ||
| 3234 | "-Dtensorflow_BUILD_CONTRIB_KERNELS=OFF")) | ||
| 3235 | #:make-flags | ||
| 3236 | (list "CC=gcc") | ||
| 3237 | #:modules ((ice-9 ftw) | ||
| 3238 | (guix build utils) | ||
| 3239 | (guix build cmake-build-system) | ||
| 3240 | ((guix build python-build-system) | ||
| 3241 | #:select (python-version))) | ||
| 3242 | #:imported-modules (,@%cmake-build-system-modules | ||
| 3243 | (guix build python-build-system)) | ||
| 3244 | #:phases | ||
| 3245 | (modify-phases %standard-phases | ||
| 3246 | (add-after 'unpack 'set-source-file-times-to-1980 | ||
| 3247 | ;; At the end of the tf_python_build_pip_package target, a ZIP | ||
| 3248 | ;; archive should be generated via bdist_wheel, but it fails with | ||
| 3249 | ;; "ZIP does not support timestamps before 1980". Luckily, | ||
| 3250 | ;; SOURCE_DATE_EPOCH is respected, which we set to some time in | ||
| 3251 | ;; 1980. | ||
| 3252 | (lambda _ (setenv "SOURCE_DATE_EPOCH" "315532800"))) | ||
| 3253 | (add-after 'unpack 'python3.11-compatibility | ||
| 3254 | (lambda _ | ||
| 3255 | ;; Py_TYPE was changed to an inline static function in Python | ||
| 3256 | ;; 3.11, so it cannot be used on the left-hand side. | ||
| 3257 | (substitute* "tensorflow/python/lib/core/bfloat16.cc" | ||
| 3258 | (("Py_TYPE\\(&NPyBfloat16_Descr\\) = &PyArrayDescr_Type;") | ||
| 3259 | "Py_SET_TYPE(&NPyBfloat16_Descr, &PyArrayDescr_Type);")) | ||
| 3260 | |||
| 3261 | ;; See https://github.com/tensorflow/tensorflow/issues/20517#issuecomment-406373913 | ||
| 3262 | (substitute* '("tensorflow/python/eager/pywrap_tfe_src.cc" | ||
| 3263 | "tensorflow/python/lib/core/ndarray_tensor.cc" | ||
| 3264 | "tensorflow/python/lib/core/py_func.cc") | ||
| 3265 | (("PyUnicode_AsUTF8") "(char *)PyUnicode_AsUTF8")) | ||
| 3266 | (substitute* "tensorflow/c/eager/c_api.h" | ||
| 3267 | (("unsigned char async") | ||
| 3268 | "unsigned char is_async")) | ||
| 3269 | |||
| 3270 | ;; Remove dependency on tensorboard, a complicated but probably | ||
| 3271 | ;; optional package. | ||
| 3272 | (substitute* "tensorflow/tools/pip_package/setup.py" | ||
| 3273 | ((".*'tensorboard >.*") "")) | ||
| 3274 | |||
| 3275 | ;; Fix the build with python-3.8, taken from rejected upstream patch: | ||
| 3276 | ;; https://github.com/tensorflow/tensorflow/issues/34197 | ||
| 3277 | (substitute* (find-files "tensorflow/python" ".*\\.cc$") | ||
| 3278 | (("(nullptr,)(\\ +/. tp_print)" _ _ tp_print) | ||
| 3279 | (string-append "NULL, " tp_print))) | ||
| 3280 | |||
| 3281 | ;; Many collections classes have been moved to collections.abc | ||
| 3282 | (substitute* '("tensorflow/python/framework/ops.py" | ||
| 3283 | "tensorflow/python/ops/clip_ops.py" | ||
| 3284 | "tensorflow/python/ops/data_flow_ops.py" | ||
| 3285 | "tensorflow/python/ops/gradients_impl.py" | ||
| 3286 | "tensorflow/python/training/input.py" | ||
| 3287 | "tensorflow/python/training/checkpointable/data_structures.py" | ||
| 3288 | "tensorflow/python/util/nest.py" | ||
| 3289 | "tensorflow/python/util/protobuf/compare.py") | ||
| 3290 | (("collections.Mapping") "collections.abc.Mapping") | ||
| 3291 | (("collections.Sequence") "collections.abc.Sequence")) | ||
| 3292 | (substitute* "tensorflow/python/feature_column/feature_column.py" | ||
| 3293 | (("collections.Iterator") "collections.abc.Iterator")) | ||
| 3294 | (substitute* "tensorflow/python/ops/sparse_ops.py" | ||
| 3295 | (("collections.Iterable") "collections.abc.Iterable")) | ||
| 3296 | (substitute* "tensorflow/python/keras/callbacks.py" | ||
| 3297 | (("from collections import Iterable") | ||
| 3298 | "from collections.abc import Iterable")) | ||
| 3299 | (substitute* "tensorflow/python/ops/variable_scope.py" | ||
| 3300 | (("collections_lib.Sequence") "collections_lib.abc.Sequence")) | ||
| 3301 | |||
| 3302 | ;; XXX: it is not clear if this is a good idea, but the build | ||
| 3303 | ;; system tries to overwrite the __or__ and __ror__ methods of | ||
| 3304 | ;; the Tensor class. | ||
| 3305 | (substitute* "tensorflow/python/framework/ops.py" | ||
| 3306 | (("if not isinstance\\(existing, type\\(object.__lt__\\)\\)" m) | ||
| 3307 | (string-append m | ||
| 3308 | " and not isinstance(existing, type(object.__or__))"))) | ||
| 3309 | |||
| 3310 | ;; ArgSpec has been replaced with FullArgSpec. | ||
| 3311 | (substitute* "tensorflow/python/util/tf_inspect.py" | ||
| 3312 | (("ArgSpec = _inspect.ArgSpec") "\ | ||
| 3313 | ArgSpec = namedtuple('ArgSpec', [ 'args', 'varargs', 'keywords', 'defaults' ]) | ||
| 3314 | def makeargspec(s): | ||
| 3315 | return ArgSpec(args=s.args, varargs=s.varargs, keywords=s.varkw, defaults=s.defaults) | ||
| 3316 | ") | ||
| 3317 | (("_inspect.getargspec\\((.*)\\)" m target) | ||
| 3318 | (string-append "makeargspec(_inspect.getfullargspec(" target "))"))) | ||
| 3319 | |||
| 3320 | ;; Fix the build with numpy >= 1.19. | ||
| 3321 | ;; Suggested in https://github.com/tensorflow/tensorflow/issues/41086#issuecomment-656833081 | ||
| 3322 | (substitute* "tensorflow/python/lib/core/bfloat16.cc" | ||
| 3323 | (("void BinaryUFunc\\(char\\*\\* args, npy_intp\\* dimensions, npy_intp\\* steps,") | ||
| 3324 | "void BinaryUFunc(char** args, npy_intp const* dimensions, npy_intp const* steps,") | ||
| 3325 | (("void CompareUFunc\\(char\\*\\* args, npy_intp\\* dimensions, npy_intp\\* steps,") | ||
| 3326 | "void CompareUFunc(char** args, npy_intp const* dimensions, npy_intp const* steps,")) | ||
| 3327 | |||
| 3328 | ;; ...and for numpy >= 1.23 | ||
| 3329 | (substitute* "tensorflow/python/framework/tensor_util.py" | ||
| 3330 | (("np.asscalar\\(x\\[0\\]\\)") "x[0].item()") | ||
| 3331 | (("np.asscalar\\(x\\)") "x.item()") | ||
| 3332 | (("np.asscalar\\(v\\)") "np.ndarray.item(v)") | ||
| 3333 | (("return np.asscalar") "return np.ndarray.item")) | ||
| 3334 | (substitute* "tensorflow/python/kernel_tests/cwise_ops_test.py" | ||
| 3335 | (("np.asscalar\\(np.random.rand\\(1\\) \\* 100.\\)") | ||
| 3336 | "(np.random.rand(1) * 100.).item()")) | ||
| 3337 | (substitute* '("tensorflow/python/framework/fast_tensor_util.pyx" | ||
| 3338 | "tensorflow/python/estimator/canned/linear_testing_utils.py") | ||
| 3339 | (("np.asscalar") "np.ndarray.item")))) | ||
| 3340 | (add-after 'python3.11-compatibility 'numpy-compatibility | ||
| 3341 | (lambda _ | ||
| 3342 | (substitute* (cons* "tensorflow/compiler/xla/python/xla_client.py" | ||
| 3343 | "tensorflow/contrib/layers/python/ops/sparse_ops_test.py" | ||
| 3344 | (find-files "tensorflow/python/" "\\.py$")) | ||
| 3345 | (("np.object") "object")) | ||
| 3346 | (substitute* (append | ||
| 3347 | '("tensorflow/compiler/tests/unary_ops_test.py" | ||
| 3348 | "tensorflow/compiler/xla/python/xla_client.py" | ||
| 3349 | "tensorflow/compiler/xla/python/xla_client_test.py") | ||
| 3350 | (find-files "tensorflow/python/" "\\.py$") | ||
| 3351 | (find-files "tensorflow/contrib/" "\\.py$")) | ||
| 3352 | (("np.bool,") "bool,") | ||
| 3353 | (("np.bool\\)") "bool)") | ||
| 3354 | (("np.bool:") "bool:")))) | ||
| 3355 | (add-after 'numpy-compatibility 'chdir | ||
| 3356 | (lambda _ (chdir "tensorflow/contrib/cmake"))) | ||
| 3357 | (add-after 'chdir 'disable-downloads | ||
| 3358 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 3359 | (substitute* (find-files "external" "\\.cmake$") | ||
| 3360 | (("GIT_REPOSITORY.*") "") | ||
| 3361 | (("GIT_TAG.*") "") | ||
| 3362 | (("PREFIX ") | ||
| 3363 | "DOWNLOAD_COMMAND \"\"\nPREFIX ")) | ||
| 3364 | |||
| 3365 | ;; Use packages from Guix | ||
| 3366 | (let ((grpc (assoc-ref inputs "grpc"))) | ||
| 3367 | (substitute* "CMakeLists.txt" | ||
| 3368 | ;; Sqlite | ||
| 3369 | (("include\\(sqlite\\)") "") | ||
| 3370 | (("\\$\\{sqlite_STATIC_LIBRARIES\\}") | ||
| 3371 | (search-input-file inputs "/lib/libsqlite3.so")) | ||
| 3372 | (("sqlite_copy_headers_to_destination") "") | ||
| 3373 | |||
| 3374 | ;; PNG | ||
| 3375 | (("include\\(png\\)") "") | ||
| 3376 | (("\\$\\{png_STATIC_LIBRARIES\\}") | ||
| 3377 | (search-input-file inputs "/lib/libpng16.so")) | ||
| 3378 | (("png_copy_headers_to_destination") "") | ||
| 3379 | |||
| 3380 | ;; JPEG | ||
| 3381 | (("include\\(jpeg\\)") "") | ||
| 3382 | (("\\$\\{jpeg_STATIC_LIBRARIES\\}") | ||
| 3383 | (search-input-file inputs "/lib/libjpeg.so")) | ||
| 3384 | (("jpeg_copy_headers_to_destination") "") | ||
| 3385 | |||
| 3386 | ;; GIF | ||
| 3387 | (("include\\(gif\\)") "") | ||
| 3388 | (("\\$\\{gif_STATIC_LIBRARIES\\}") | ||
| 3389 | (search-input-file inputs "/lib/libgif.so")) | ||
| 3390 | (("gif_copy_headers_to_destination") "") | ||
| 3391 | |||
| 3392 | ;; lmdb | ||
| 3393 | (("include\\(lmdb\\)") "") | ||
| 3394 | (("\\$\\{lmdb_STATIC_LIBRARIES\\}") | ||
| 3395 | (search-input-file inputs "/lib/liblmdb.so")) | ||
| 3396 | (("lmdb_copy_headers_to_destination") "") | ||
| 3397 | |||
| 3398 | ;; Protobuf | ||
| 3399 | (("include\\(protobuf\\)") "") | ||
| 3400 | (("protobuf_copy_headers_to_destination") "") | ||
| 3401 | (("^ +protobuf") "") | ||
| 3402 | |||
| 3403 | ;; gRPC | ||
| 3404 | (("include\\(grpc\\)") | ||
| 3405 | "find_package(grpc REQUIRED NAMES gRPC)") | ||
| 3406 | (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES grpc\\)") "") | ||
| 3407 | |||
| 3408 | ;; Eigen | ||
| 3409 | (("include\\(eigen\\)") | ||
| 3410 | (string-append "find_package(eigen REQUIRED NAMES Eigen3) | ||
| 3411 | set(eigen_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/external/eigen_archive " | ||
| 3412 | (assoc-ref inputs "eigen") "/include/eigen3)")) | ||
| 3413 | (("^ +eigen") "") | ||
| 3414 | |||
| 3415 | ;; snappy | ||
| 3416 | (("include\\(snappy\\)") | ||
| 3417 | "add_definitions(-DTF_USE_SNAPPY)") | ||
| 3418 | (("list\\(APPEND tensorflow_EXTERNAL_DEPENDENCIES snappy\\)") "") | ||
| 3419 | |||
| 3420 | ;; jsoncpp | ||
| 3421 | (("include\\(jsoncpp\\)") "") | ||
| 3422 | (("^ +jsoncpp") "")) | ||
| 3423 | |||
| 3424 | (substitute* "tf_core_framework.cmake" | ||
| 3425 | ((" grpc") "") | ||
| 3426 | (("\\$\\{GRPC_BUILD\\}/grpc_cpp_plugin") | ||
| 3427 | (which "grpc_cpp_plugin")) | ||
| 3428 | ;; Link with gRPC libraries | ||
| 3429 | (("add_library\\(tf_protos_cc.*" m) | ||
| 3430 | (string-append m | ||
| 3431 | (format #f "\ntarget_link_libraries(tf_protos_cc PRIVATE \ | ||
| 3432 | ~a/lib/libgrpc++_unsecure.a \ | ||
| 3433 | ~a/lib/libgrpc_unsecure.a \ | ||
| 3434 | ~a/lib/libaddress_sorting.a \ | ||
| 3435 | ~a/lib/libgpr.a \ | ||
| 3436 | ~a//lib/libcares.so | ||
| 3437 | )\n" | ||
| 3438 | grpc grpc grpc grpc | ||
| 3439 | (assoc-ref inputs "c-ares")))))) | ||
| 3440 | (substitute* "tf_tools.cmake" | ||
| 3441 | (("add_dependencies\\(\\$\\{proto_text.*") "")) | ||
| 3442 | ;; Remove dependency on bundled grpc | ||
| 3443 | (substitute* "tf_core_distributed_runtime.cmake" | ||
| 3444 | (("tf_core_cpu grpc") "tf_core_cpu")) | ||
| 3445 | |||
| 3446 | ;; This directory is a dependency of many targets. | ||
| 3447 | (mkdir-p "protobuf"))) | ||
| 3448 | (add-after 'configure 'unpack-third-party-sources | ||
| 3449 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 3450 | ;; This is needed to configure bundled packages properly. | ||
| 3451 | (setenv "CONFIG_SHELL" (which "bash")) | ||
| 3452 | (for-each | ||
| 3453 | (lambda (name) | ||
| 3454 | (let* ((what (assoc-ref inputs (string-append name "-src"))) | ||
| 3455 | (name* (string-map (lambda (c) | ||
| 3456 | (if (char=? c #\-) | ||
| 3457 | #\_ c)) name)) | ||
| 3458 | (where (string-append "../build/" name* "/src/" name*))) | ||
| 3459 | (cond | ||
| 3460 | ((string-suffix? ".zip" what) | ||
| 3461 | (mkdir-p where) | ||
| 3462 | (with-directory-excursion where | ||
| 3463 | (invoke "unzip" what))) | ||
| 3464 | ((string-suffix? ".tar.gz" what) | ||
| 3465 | (mkdir-p where) | ||
| 3466 | (invoke "tar" "xf" what | ||
| 3467 | "-C" where "--strip-components=1")) | ||
| 3468 | (else | ||
| 3469 | (let ((parent (dirname where))) | ||
| 3470 | (mkdir-p parent) | ||
| 3471 | (with-directory-excursion parent | ||
| 3472 | (when (file-exists? name*) | ||
| 3473 | (delete-file-recursively name*)) | ||
| 3474 | (copy-recursively what name*) | ||
| 3475 | (map make-file-writable | ||
| 3476 | (find-files name* ".*")))))))) | ||
| 3477 | (list "boringssl" | ||
| 3478 | "cub" | ||
| 3479 | "double-conversion" | ||
| 3480 | "farmhash" | ||
| 3481 | "fft2d" | ||
| 3482 | "highwayhash" | ||
| 3483 | "nsync" | ||
| 3484 | "re2")) | ||
| 3485 | |||
| 3486 | ;; https://github.com/google/farmhash/issues/24 | ||
| 3487 | (substitute* "../build/farmhash/src/farmhash/src/farmhash.cc" | ||
| 3488 | (("using namespace std;") "") | ||
| 3489 | (("make_pair") "std::make_pair") | ||
| 3490 | (("pair<") "std::pair<")) | ||
| 3491 | |||
| 3492 | (rename-file "../build/cub/src/cub/cub-1.8.0/" | ||
| 3493 | "../build/cub/src/cub/cub/") | ||
| 3494 | |||
| 3495 | (setenv "LDFLAGS" | ||
| 3496 | (string-append "-Wl,-rpath=" | ||
| 3497 | (assoc-ref outputs "out") "/lib")))) | ||
| 3498 | (add-after 'unpack 'fix-python-build | ||
| 3499 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 3500 | (mkdir-p "protobuf-src") | ||
| 3501 | (invoke "tar" "xf" (assoc-ref inputs "protobuf:src") | ||
| 3502 | "-C" "protobuf-src" "--strip-components=1") | ||
| 3503 | (mkdir-p "eigen-src") | ||
| 3504 | (copy-recursively (assoc-ref inputs "eigen:src") "eigen-src") | ||
| 3505 | |||
| 3506 | ;; distutils.sysconfig is deprecated and prints a deprecation | ||
| 3507 | ;; warning that breaks the generated CXX_INCLUDES line. | ||
| 3508 | (substitute* "tensorflow/contrib/cmake/tf_python.cmake" | ||
| 3509 | (("import distutils.sysconfig; print\\(distutils.sysconfig.get_python_inc\\(\\)\\)") | ||
| 3510 | "import sysconfig; print(sysconfig.get_path('include'))")) | ||
| 3511 | |||
| 3512 | (substitute* "tensorflow/contrib/cmake/tf_python.cmake" | ||
| 3513 | ;; Take protobuf source files from our source package. | ||
| 3514 | (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/protobuf/src/protobuf/src/google") | ||
| 3515 | (string-append (getcwd) "/protobuf-src/src/google"))) | ||
| 3516 | |||
| 3517 | (substitute* '("tensorflow/contrib/cmake/tf_shared_lib.cmake" | ||
| 3518 | "tensorflow/contrib/cmake/tf_python.cmake") | ||
| 3519 | ;; Take Eigen source files from our source package. | ||
| 3520 | (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/eigen/src/eigen/") | ||
| 3521 | (string-append (getcwd) "/eigen-src/")) | ||
| 3522 | ;; Take Eigen headers from our own package. | ||
| 3523 | (("\\$\\{CMAKE_CURRENT_BINARY_DIR\\}/external/eigen_archive") | ||
| 3524 | (search-input-directory inputs "/include/eigen3"))) | ||
| 3525 | |||
| 3526 | ;; Correct the RUNPATH of ops libraries generated for Python. | ||
| 3527 | ;; TODO: this doesn't work :( | ||
| 3528 | ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so: | ||
| 3529 | ;; warning: RUNPATH contains bogus entries: ("/tmp/guix-build-tensorflow-1.9.0.drv-0/source/tensorflow/contrib/build") | ||
| 3530 | ;; /gnu/store/...-tensorflow-1.9.0/lib/python3.7/site-packages/tensorflow/contrib/seq2seq/python/ops/lib_beam_search_ops.so: | ||
| 3531 | ;; error: depends on 'libpywrap_tensorflow_internal.so', which | ||
| 3532 | ;; cannot be found in RUNPATH ... | ||
| 3533 | (substitute* "tensorflow/contrib/cmake/tf_cc_ops.cmake" | ||
| 3534 | (("set_target_properties.*") | ||
| 3535 | (string-append "set_target_properties(${_AT_TARGET} PROPERTIES \ | ||
| 3536 | COMPILE_FLAGS ${target_compile_flags} \ | ||
| 3537 | INSTALL_RPATH_USE_LINK_PATH TRUE \ | ||
| 3538 | INSTALL_RPATH " (assoc-ref outputs "out") "/lib)\n"))))) | ||
| 3539 | (add-after 'unpack 'patch-cmake-file-to-install-c-headers | ||
| 3540 | (lambda _ | ||
| 3541 | (substitute* "tensorflow/contrib/cmake/tf_c.cmake" | ||
| 3542 | (("if\\(tensorflow_BUILD_PYTHON_BINDINGS" m) | ||
| 3543 | (string-append | ||
| 3544 | "install(DIRECTORY ${tensorflow_source_dir}/tensorflow/c/ \ | ||
| 3545 | DESTINATION include/tensorflow/c FILES_MATCHING PATTERN \"*.h\")\n" m))))) | ||
| 3546 | (add-after 'build 'build-c-bindings | ||
| 3547 | (lambda* (#:key outputs parallel-build? #:allow-other-keys) | ||
| 3548 | (invoke "make" "-j" (if parallel-build? | ||
| 3549 | (number->string (parallel-job-count)) | ||
| 3550 | "1") | ||
| 3551 | "tf_c"))) | ||
| 3552 | (add-after 'install 'build-pip-package | ||
| 3553 | (lambda* (#:key outputs parallel-build? #:allow-other-keys) | ||
| 3554 | (invoke "make" "-j" (if parallel-build? | ||
| 3555 | (number->string (parallel-job-count)) | ||
| 3556 | "1") | ||
| 3557 | "tf_python_build_pip_package"))) | ||
| 3558 | (add-after 'build-pip-package 'install-python | ||
| 3559 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 3560 | (let ((out (assoc-ref outputs "out")) | ||
| 3561 | (wheel (car (find-files "../build/tf_python/dist/" "\\.whl$"))) | ||
| 3562 | (python-version (python-version | ||
| 3563 | (assoc-ref inputs "python")))) | ||
| 3564 | (invoke "python" "-m" "pip" "install" wheel | ||
| 3565 | (string-append "--prefix=" out)) | ||
| 3566 | |||
| 3567 | ;; XXX: broken RUNPATH, see fix-python-build phase. | ||
| 3568 | (delete-file | ||
| 3569 | (string-append | ||
| 3570 | out "/lib/python" python-version | ||
| 3571 | "/site-packages/tensorflow/contrib/" | ||
| 3572 | "seq2seq/python/ops/lib_beam_search_ops.so")))))))) | ||
| 3573 | (native-inputs | ||
| 3574 | `(("pkg-config" ,pkg-config) | ||
| 3575 | ("protobuf:native" ,protobuf-3.6) ; protoc | ||
| 3576 | ("protobuf:src" ,(package-source protobuf-3.6)) | ||
| 3577 | ("eigen:src" ,(package-source eigen-for-tensorflow)) | ||
| 3578 | ;; install_pip_packages.sh wants setuptools 39.1.0 specifically. | ||
| 3579 | ("python-setuptools" ,python-setuptools-for-tensorflow) | ||
| 3580 | |||
| 3581 | ;; The commit hashes and URLs for third-party source code are taken | ||
| 3582 | ;; from "tensorflow/workspace.bzl". | ||
| 3583 | ("boringssl-src" | ||
| 3584 | ,(let ((commit "ee7aa02") | ||
| 3585 | (revision "1")) | ||
| 3586 | (origin | ||
| 3587 | (method git-fetch) | ||
| 3588 | (uri (git-reference | ||
| 3589 | (url "https://boringssl.googlesource.com/boringssl") | ||
| 3590 | (commit commit))) | ||
| 3591 | (file-name (string-append "boringssl-0-" revision | ||
| 3592 | (string-take commit 7) | ||
| 3593 | "-checkout")) | ||
| 3594 | (sha256 | ||
| 3595 | (base32 | ||
| 3596 | "1jf693q0nw0adsic6cgmbdx6g7wr4rj4vxa8j1hpn792fqhd8wgw"))))) | ||
| 3597 | ("cub-src" | ||
| 3598 | ,(let ((version "1.8.0")) | ||
| 3599 | (origin | ||
| 3600 | (method url-fetch) | ||
| 3601 | (uri (string-append "https://mirror.bazel.build/github.com/NVlabs/" | ||
| 3602 | "cub/archive/" version ".zip")) | ||
| 3603 | (file-name (string-append "cub-" version ".zip")) | ||
| 3604 | (sha256 | ||
| 3605 | (base32 | ||
| 3606 | "1hsqikqridb90dkxkjr2918dcry6pfh46ccnwrzawl56aamhdykb"))))) | ||
| 3607 | ("double-conversion-src" | ||
| 3608 | ,(let ((commit "5664746") | ||
| 3609 | (revision "1")) | ||
| 3610 | (origin | ||
| 3611 | (method git-fetch) | ||
| 3612 | (uri (git-reference | ||
| 3613 | (url "https://github.com/google/double-conversion") | ||
| 3614 | (commit commit))) | ||
| 3615 | (file-name | ||
| 3616 | (git-file-name "double-conversion" | ||
| 3617 | (string-append "0-" revision "." | ||
| 3618 | (string-take commit 7)))) | ||
| 3619 | (sha256 | ||
| 3620 | (base32 | ||
| 3621 | "1h5lppqqxcvdg5jq42i5msgwx20ryij3apvmndflngrgdpc04gn1"))))) | ||
| 3622 | ("farmhash-src" | ||
| 3623 | ,(let ((commit "816a4ae622e964763ca0862d9dbd19324a1eaf45")) | ||
| 3624 | (origin | ||
| 3625 | (method url-fetch) | ||
| 3626 | (uri (string-append | ||
| 3627 | "https://mirror.bazel.build/github.com/google/farmhash/archive/" | ||
| 3628 | commit ".tar.gz")) | ||
| 3629 | (file-name (string-append "farmhash-0-" (string-take commit 7) | ||
| 3630 | ".tar.gz")) | ||
| 3631 | (sha256 | ||
| 3632 | (base32 | ||
| 3633 | "185b2xdxl4d4cnsnv6abg8s22gxvx8673jq2yaq85bz4cdy58q35"))))) | ||
| 3634 | ;; The license notice on the home page at | ||
| 3635 | ;; http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html says: | ||
| 3636 | ;; Copyright Takuya OOURA, 1996-2001 | ||
| 3637 | ;; | ||
| 3638 | ;; You may use, copy, modify and distribute this code for any purpose | ||
| 3639 | ;; (include commercial use) and without fee. Please refer to this | ||
| 3640 | ;; package when you modify this code. | ||
| 3641 | ;; | ||
| 3642 | ;; We take the identical tarball from the Bazel mirror, because the URL | ||
| 3643 | ;; at the home page is not versioned and might change. | ||
| 3644 | ("fft2d-src" | ||
| 3645 | ,(origin | ||
| 3646 | (method url-fetch) | ||
| 3647 | (uri "https://mirror.bazel.build/www.kurims.kyoto-u.ac.jp/~ooura/fft.tgz") | ||
| 3648 | (file-name "fft2d.tar.gz") | ||
| 3649 | (sha256 | ||
| 3650 | (base32 | ||
| 3651 | "15jjkfvhqvl2c0753d2di8hz0pyzn598g74wqy79awdrf1y67fsj")))) | ||
| 3652 | ("highwayhash-src" | ||
| 3653 | ,(let ((commit "be5edafc2e1a455768e260ccd68ae7317b6690ee") | ||
| 3654 | (revision "1")) | ||
| 3655 | (origin | ||
| 3656 | (method git-fetch) | ||
| 3657 | (uri (git-reference | ||
| 3658 | (url "https://github.com/google/highwayhash") | ||
| 3659 | (commit commit))) | ||
| 3660 | (file-name (string-append "highwayhash-0-" revision | ||
| 3661 | (string-take commit 7) | ||
| 3662 | "-checkout")) | ||
| 3663 | (sha256 | ||
| 3664 | (base32 | ||
| 3665 | "154jwf98cyy54hldr94pgjn85zynly3abpnc1avmb8a18lzwjyb6"))))) | ||
| 3666 | ("nsync-src" | ||
| 3667 | ,(let ((version "0559ce013feac8db639ee1bf776aca0325d28777") | ||
| 3668 | (revision "1")) | ||
| 3669 | (origin | ||
| 3670 | (method url-fetch) | ||
| 3671 | (uri (string-append "https://mirror.bazel.build/" | ||
| 3672 | "github.com/google/nsync/archive/" | ||
| 3673 | version ".tar.gz")) | ||
| 3674 | (file-name (string-append "nsync-0." revision | ||
| 3675 | "-" (string-take version 7) | ||
| 3676 | ".tar.gz")) | ||
| 3677 | (sha256 | ||
| 3678 | (base32 | ||
| 3679 | "0qdkyqym34x739mmzv97ah5r7ph462v5xkxqxvidmcfqbi64b132"))))) | ||
| 3680 | ("re2-src" | ||
| 3681 | ,(let ((commit "e7efc48") | ||
| 3682 | (revision "1")) | ||
| 3683 | (origin | ||
| 3684 | (method git-fetch) | ||
| 3685 | (uri (git-reference | ||
| 3686 | (url "https://github.com/google/re2") | ||
| 3687 | (commit commit))) | ||
| 3688 | (file-name (string-append "re2-0-" revision | ||
| 3689 | (string-take commit 7) | ||
| 3690 | "-checkout")) | ||
| 3691 | (sha256 | ||
| 3692 | (base32 | ||
| 3693 | "161g9841rjfsy5pn52fcis0s9hdr7rxvb06pad38j5rppfihvign"))))) | ||
| 3694 | ("googletest" ,googletest) | ||
| 3695 | ("swig" ,swig) | ||
| 3696 | ("unzip" ,unzip))) | ||
| 3697 | (propagated-inputs | ||
| 3698 | (list python-absl-py | ||
| 3699 | python-astor | ||
| 3700 | python-gast | ||
| 3701 | python-grpcio | ||
| 3702 | python-numpy | ||
| 3703 | python-protobuf-3.6 | ||
| 3704 | python-six | ||
| 3705 | python-termcolor | ||
| 3706 | python-wheel)) | ||
| 3707 | (inputs | ||
| 3708 | `(("c-ares" ,c-ares) | ||
| 3709 | ("eigen" ,eigen-for-tensorflow) | ||
| 3710 | ("gemmlowp" ,gemmlowp-for-tensorflow) | ||
| 3711 | ("lmdb" ,lmdb) | ||
| 3712 | ("libjpeg" ,libjpeg-turbo) | ||
| 3713 | ("libpng" ,libpng) | ||
| 3714 | ("giflib" ,giflib) | ||
| 3715 | ("grpc" ,grpc-1.16.1 "static") | ||
| 3716 | ("grpc:bin" ,grpc-1.16.1) | ||
| 3717 | ("jsoncpp" ,jsoncpp-for-tensorflow) | ||
| 3718 | ("snappy" ,snappy) | ||
| 3719 | ("sqlite" ,sqlite) | ||
| 3720 | ("protobuf" ,protobuf-3.6) | ||
| 3721 | ("python" ,python-wrapper) | ||
| 3722 | ("zlib" ,zlib))) | ||
| 3723 | (home-page "https://tensorflow.org") | ||
| 3724 | (synopsis "Machine learning framework") | ||
| 3725 | (description | ||
| 3726 | "TensorFlow is a flexible platform for building and training machine | ||
| 3727 | learning models. It provides a library for high performance numerical | ||
| 3728 | computation and includes high level Python APIs, including both a sequential | ||
| 3729 | API for beginners that allows users to build models quickly by plugging | ||
| 3730 | together building blocks and a subclassing API with an imperative style for | ||
| 3731 | advanced research.") | ||
| 3732 | (license license:asl2.0))) | ||
| 3733 | |||
| 3734 | (define-public tensorflow-lite | 3172 | (define-public tensorflow-lite |
| 3735 | (package | 3173 | (package |
| 3736 | (name "tensorflow-lite") | 3174 | (name "tensorflow-lite") |
