[arch-commits] Commit in tensorflow/trunk (PKGBUILD fix-h5py3.0.patch)
Sven-Hendrik Haase
svenstaro at archlinux.org
Thu Feb 18 09:31:33 UTC 2021
Date: Thursday, February 18, 2021 @ 09:31:33
Author: svenstaro
Revision: 863875
upgpkg: tensorflow 2.4.1-5: Update hdf5 patch to the one merged by upstream
Modified:
tensorflow/trunk/PKGBUILD
tensorflow/trunk/fix-h5py3.0.patch
-------------------+
PKGBUILD | 4
fix-h5py3.0.patch | 377 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 377 insertions(+), 4 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2021-02-18 09:30:18 UTC (rev 863874)
+++ PKGBUILD 2021-02-18 09:31:33 UTC (rev 863875)
@@ -7,7 +7,7 @@
pkgname=(tensorflow tensorflow-opt tensorflow-cuda tensorflow-opt-cuda python-tensorflow python-tensorflow-opt python-tensorflow-cuda python-tensorflow-opt-cuda)
pkgver=2.4.1
_pkgver=2.4.1
-pkgrel=4
+pkgrel=5
pkgdesc="Library for computation using data flow graphs for scalable machine learning"
url="https://www.tensorflow.org/"
license=('APACHE')
@@ -22,7 +22,7 @@
fix-h5py3.0.patch
build-against-actual-mkl.patch)
sha512sums=('be8273f464c1c1c392f3ab0190dbba36d56a0edcc7991c1a86f16604c859056d3188737d11c3b41ec7918e1cf46d13814c50c00be8f459dde9f0fb618740ee3c'
- '9d7b71fed280ffaf4dfcd4889aa9ab5471874c153259f3e77ed6e6efa745e5c5aa8507d3d1f71dead5b6f4bea5f8b1c10c543929f37a6580c3f4a7cbec338a6a'
+ '556e3dd4bf0989c139536a7fbfd423b67007839814b04d778790d1c51eb9a4e9f13730a004fc4361a5e6d8a0d08b7b1a28f6e26e184c07f9297c67073a4e9192'
'e51e3f3dced121db3a09fbdaefd33555536095584b72a5eb6f302fa6fa68ab56ea45e8a847ec90ff4ba076db312c06f91ff672e08e95263c658526582494ce08')
# consolidate common dependencies to prevent mishaps
Modified: fix-h5py3.0.patch
===================================================================
--- fix-h5py3.0.patch 2021-02-18 09:30:18 UTC (rev 863874)
+++ fix-h5py3.0.patch 2021-02-18 09:31:33 UTC (rev 863875)
@@ -1,18 +1,391 @@
+From c0dbdfb718de6481b00d7ff17a0ff763cf7a7544 Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Tue, 8 Dec 2020 19:05:35 +0000
+Subject: [PATCH 01/12] Revert "Revert PR #45380: Try to switch to h5py 3.1.0"
+
+This reverts commit d36db2955c460d2abe185ced9cc5bdfabc67b631.
+---
+ .../tools/ci_build/install/install_centos_pip_packages.sh | 2 +-
+ tensorflow/tools/ci_build/install/install_pip_packages.sh | 2 +-
+ .../tools/ci_build/install/install_python3.5_pip_packages.sh | 2 +-
+ .../tools/ci_build/install/install_python3.6_pip_packages.sh | 2 +-
+ tensorflow/tools/ci_build/release/common.sh | 4 ++--
+ tensorflow/tools/ci_build/release/common_win.bat | 4 ++--
+ tensorflow/tools/pip_package/setup.py | 2 +-
+ 7 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/tensorflow/tools/ci_build/install/install_centos_pip_packages.sh b/tensorflow/tools/ci_build/install/install_centos_pip_packages.sh
+index ce7789b3704b2..0f0f182a1bc10 100755
+--- a/tensorflow/tools/ci_build/install/install_centos_pip_packages.sh
++++ b/tensorflow/tools/ci_build/install/install_centos_pip_packages.sh
+@@ -102,7 +102,7 @@ pip3 install --upgrade termcolor
+ pip2 install keras_preprocessing==1.0.5 --no-deps
+ pip3 install keras_preprocessing==1.0.5 --no-deps
+ pip2 install --upgrade h5py==2.8.0
+-pip3 install --upgrade h5py==2.8.0
++pip3 install --upgrade h5py==3.1.0
+
+ # Estimator
+ pip2 install tf-estimator-nightly --no-deps
+diff --git a/tensorflow/tools/ci_build/install/install_pip_packages.sh b/tensorflow/tools/ci_build/install/install_pip_packages.sh
+index 578967a67cf84..f9893f070d596 100755
+--- a/tensorflow/tools/ci_build/install/install_pip_packages.sh
++++ b/tensorflow/tools/ci_build/install/install_pip_packages.sh
+@@ -134,7 +134,7 @@ pip3 install --upgrade termcolor
+ pip2 install keras_preprocessing==1.1.0 --no-deps
+ pip3 install keras_preprocessing==1.1.0 --no-deps
+ pip2 install --upgrade h5py==2.8.0
+-pip3 install --upgrade h5py==2.8.0
++pip3 install --upgrade h5py==3.1.0
+
+ # Estimator
+ pip2 install tf-estimator-nightly --no-deps
+diff --git a/tensorflow/tools/ci_build/install/install_python3.5_pip_packages.sh b/tensorflow/tools/ci_build/install/install_python3.5_pip_packages.sh
+index bb53fc91981aa..9530c9fdf22e8 100755
+--- a/tensorflow/tools/ci_build/install/install_python3.5_pip_packages.sh
++++ b/tensorflow/tools/ci_build/install/install_python3.5_pip_packages.sh
+@@ -87,7 +87,7 @@ pip3.5 install --upgrade termcolor
+
+ # Keras
+ pip3.5 install keras_preprocessing==1.0.5
+-pip3.5 install --upgrade h5py==2.8.0
++pip3.5 install --upgrade h5py==3.1.0
+
+ # Estimator
+ pip3.5 install tf-estimator-nightly==1.12.0.dev20181203 --no-deps
+diff --git a/tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh b/tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh
+index bcf0d0b87ab56..f130ab87dc23a 100755
+--- a/tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh
++++ b/tensorflow/tools/ci_build/install/install_python3.6_pip_packages.sh
+@@ -101,7 +101,7 @@ pip3 install --upgrade astor
+ pip3 install --upgrade gast
+ pip3 install --upgrade termcolor
+
+-pip3 install --upgrade h5py==2.8.0
++pip3 install --upgrade h5py==3.1.0
+
+ # Keras
+ pip3 install keras_preprocessing==1.0.5
+diff --git a/tensorflow/tools/ci_build/release/common_win.bat b/tensorflow/tools/ci_build/release/common_win.bat
+index f27ec3117ed50..dbe159a67767a 100644
+--- a/tensorflow/tools/ci_build/release/common_win.bat
++++ b/tensorflow/tools/ci_build/release/common_win.bat
+@@ -18,7 +18,7 @@ echo on
+ @REM Set Environment Variables
+ @REM
+ IF NOT DEFINED PYTHON_DIRECTORY (
+- SET PYTHON_DIRECTORY=Python36
++ SET PYTHON_DIRECTORY=Python37
+ )
+ SET PY_EXE=C:\%PYTHON_DIRECTORY%\python.exe
+ SET PATH=%PATH%;C:\%PYTHON_DIRECTORY%
+@@ -32,7 +32,7 @@ SET PATH=%PATH%;C:\%PYTHON_DIRECTORY%
+ %PY_EXE% -m pip install "astunparse ~= 1.6.3"
+ %PY_EXE% -m pip install "flatbuffers ~= 1.12.0"
+ %PY_EXE% -m pip install "google_pasta ~= 0.2"
+-%PY_EXE% -m pip install "h5py ~= 2.10.0"
++%PY_EXE% -m pip install "h5py ~= 3.1.0"
+ %PY_EXE% -m pip install "keras_preprocessing ~= 1.1.2"
+ %PY_EXE% -m pip install "numpy ~= 1.19.2"
+ %PY_EXE% -m pip install "opt_einsum ~= 3.3.0"
+diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
+index 613ce9f5bf3e1..d84b08de7a11f 100644
+--- a/tensorflow/tools/pip_package/setup.py
++++ b/tensorflow/tools/pip_package/setup.py
+@@ -79,7 +79,7 @@
+ 'astunparse ~= 1.6.3',
+ 'flatbuffers ~= 1.12.0',
+ 'google_pasta ~= 0.2',
+- 'h5py ~= 2.10.0',
++ 'h5py ~= 3.1.0',
+ 'keras_preprocessing ~= 1.1.2',
+ 'numpy ~= 1.19.2',
+ 'opt_einsum ~= 3.3.0',
+
+From 9631c2de4240f6c435bc559647659ba4e2116572 Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Wed, 9 Dec 2020 14:10:12 +0000
+Subject: [PATCH 02/12] Check if win and Macosx pass
+
+---
+ tensorflow/python/keras/saving/hdf5_format.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
diff --git a/tensorflow/python/keras/saving/hdf5_format.py b/tensorflow/python/keras/saving/hdf5_format.py
-index d3bb10c98d..e89f5356bb 100644
+index d3bb10c98ddf9..d6b0a773c77ca 100644
--- a/tensorflow/python/keras/saving/hdf5_format.py
+++ b/tensorflow/python/keras/saving/hdf5_format.py
-@@ -659,11 +659,11 @@ def load_weights_from_hdf5_group(f, layers):
+@@ -179,7 +179,9 @@ def load_model_from_hdf5(filepath, custom_objects=None, compile=True): # pylint
+ model_config = f.attrs.get('model_config')
+ if model_config is None:
+ raise ValueError('No model found in config file.')
+- model_config = json_utils.decode(model_config.decode('utf-8'))
++ if hasattr(model_config, 'decode'):
++ model_config = model_config.decode('utf-8')
++ model_config = json_utils.decode(model_config)
+ model = model_config_lib.model_from_config(model_config,
+ custom_objects=custom_objects)
+
+
+From 711304d116d38c833928d38c75224b6a03e029d7 Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Wed, 9 Dec 2020 18:57:40 +0000
+Subject: [PATCH 03/12] Conditional decode workaround for win
+
+---
+ tensorflow/python/keras/saving/hdf5_format.py | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/tensorflow/python/keras/saving/hdf5_format.py b/tensorflow/python/keras/saving/hdf5_format.py
+index d6b0a773c77ca..509caf0ab3351 100644
+--- a/tensorflow/python/keras/saving/hdf5_format.py
++++ b/tensorflow/python/keras/saving/hdf5_format.py
+@@ -191,11 +191,13 @@ def load_model_from_hdf5(filepath, custom_objects=None, compile=True): # pylint
+ if compile:
+ # instantiate optimizer
+ training_config = f.attrs.get('training_config')
++ if hasattr(training_config, 'decode'):
++ training_config = training_config.decode('utf-8')
+ if training_config is None:
+ logging.warning('No training configuration found in the save file, so '
+ 'the model was *not* compiled. Compile it manually.')
+ return model
+- training_config = json_utils.decode(training_config.decode('utf-8'))
++ training_config = json_utils.decode(training_config)
+
+ # Compile model.
+ model.compile(**saving_utils.compile_args_from_training_config(
+@@ -661,11 +663,15 @@ def load_weights_from_hdf5_group(f, layers):
and weights file.
"""
if 'keras_version' in f.attrs:
- original_keras_version = f.attrs['keras_version'].decode('utf8')
+ original_keras_version = f.attrs['keras_version']
++ if hasattr(original_keras_version, 'decode'):
++ original_keras_version = original_keras_version.decode('utf8')
else:
original_keras_version = '1'
if 'backend' in f.attrs:
- original_backend = f.attrs['backend'].decode('utf8')
+ original_backend = f.attrs['backend']
++ if hasattr(original_backend, 'decode'):
++ original_backend = original_backend.decode('utf8')
else:
original_backend = None
+@@ -732,11 +738,14 @@ def load_weights_from_hdf5_group_by_name(
+ and weights file and skip_match=False.
+ """
+ if 'keras_version' in f.attrs:
+- original_keras_version = f.attrs['keras_version'].decode('utf8')
++ original_keras_version = f.attrs['keras_version']
++ if hasattr(original_keras_version, 'decode'):
++ original_keras_version = original_keras_version.decode('utf8')
+ else:
+ original_keras_version = '1'
+ if 'backend' in f.attrs:
+- original_backend = f.attrs['backend'].decode('utf8')
++ if hasattr(original_backend, 'decode'):
++ original_backend = original_backend.decode('utf8')
+ else:
+ original_backend = None
+
+
+From e25fe38db749897d91bce7a4aac36a83d6b38966 Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Wed, 9 Dec 2020 19:21:35 +0000
+Subject: [PATCH 04/12] Other fixes
+
+---
+ tensorflow/python/keras/saving/hdf5_format.py | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/tensorflow/python/keras/saving/hdf5_format.py b/tensorflow/python/keras/saving/hdf5_format.py
+index 509caf0ab3351..edf6cc1cf8dc9 100644
+--- a/tensorflow/python/keras/saving/hdf5_format.py
++++ b/tensorflow/python/keras/saving/hdf5_format.py
+@@ -744,6 +744,7 @@ def load_weights_from_hdf5_group_by_name(
+ else:
+ original_keras_version = '1'
+ if 'backend' in f.attrs:
++ original_backend = f.attrs['backend']
+ if hasattr(original_backend, 'decode'):
+ original_backend = original_backend.decode('utf8')
+ else:
+@@ -860,13 +861,15 @@ def load_attributes_from_hdf5_group(group, name):
+ data: Attributes data.
+ """
+ if name in group.attrs:
+- data = [n.decode('utf8') for n in group.attrs[name]]
++ data = [n.decode('utf8') if hasattr(n,"decode") else n
++ for n in group.attrs[name]]
+ else:
+ data = []
+ chunk_id = 0
+ while '%s%d' % (name, chunk_id) in group.attrs:
+ data.extend(
+- [n.decode('utf8') for n in group.attrs['%s%d' % (name, chunk_id)]])
++ [n.decode('utf8') if hasattr(n,"decode") else n
++ for n in group.attrs['%s%d' % (name, chunk_id)]])
+ chunk_id += 1
+ return data
+
+
+From b539145fc87fc10a0a4cfaa94f941b28dd2c7057 Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Wed, 9 Dec 2020 20:20:40 +0000
+Subject: [PATCH 05/12] Change the name for Win
+
+---
+ tensorflow/python/keras/saving/save_test.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
+index de6180092f560..f48edc3a513ad 100644
+--- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
++++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
+@@ -22,6 +22,7 @@
+ from __future__ import division
+ from __future__ import print_function
+
++import os
+ import tempfile
+
+ from absl import app
+@@ -79,11 +80,12 @@ def app_main(argv):
+ if FLAGS.save_model_path:
+ save_model_path = FLAGS.save_model_path
+ else:
+- save_model_path = tempfile.mktemp(suffix='.saved_model')
++ fd, save_model_path = tempfile.mkstemp(suffix='.saved_model')
+ save_options = tf.saved_model.SaveOptions(save_debug_info=show_debug_info)
+ tf.saved_model.save(
+ create_module_fn(), save_model_path, options=save_options)
+ logging.info('Saved model to: %s', save_model_path)
++ os.close(fd)
+ mlir = pywrap_mlir.experimental_convert_saved_model_to_mlir(
+ save_model_path, ','.join(exported_names), show_debug_info)
+ # We don't strictly need this, but it serves as a handy sanity check
+
+From 594eacfa18a7f83d1957dcf1c111d8c79b08c734 Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Thu, 10 Dec 2020 04:56:00 +0100
+Subject: [PATCH 09/12] Fix
+
+---
+ .../compiler/mlir/tensorflow/tests/tf_saved_model/common.py | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
+index f48edc3a513ad..47f6b88125217 100644
+--- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
++++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
+@@ -22,7 +22,6 @@
+ from __future__ import division
+ from __future__ import print_function
+
+-import os
+ import tempfile
+
+ from absl import app
+@@ -80,12 +79,11 @@ def app_main(argv):
+ if FLAGS.save_model_path:
+ save_model_path = FLAGS.save_model_path
+ else:
+- fd, save_model_path = tempfile.mkstemp(suffix='.saved_model')
++ save_model_path = tempfile.mkdtemp(suffix='.saved_model')
+ save_options = tf.saved_model.SaveOptions(save_debug_info=show_debug_info)
+ tf.saved_model.save(
+ create_module_fn(), save_model_path, options=save_options)
+ logging.info('Saved model to: %s', save_model_path)
+- os.close(fd)
+ mlir = pywrap_mlir.experimental_convert_saved_model_to_mlir(
+ save_model_path, ','.join(exported_names), show_debug_info)
+ # We don't strictly need this, but it serves as a handy sanity check
+
+From 59623c8a8c90ca6de6a7f0554d11b6d71deae6ad Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Thu, 10 Dec 2020 11:09:13 +0100
+Subject: [PATCH 10/12] Try with byte
+
+---
+ .../compiler/mlir/tensorflow/tests/tf_saved_model/common.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
+index 47f6b88125217..5989509bc30e8 100644
+--- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
++++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
+@@ -79,7 +79,7 @@ def app_main(argv):
+ if FLAGS.save_model_path:
+ save_model_path = FLAGS.save_model_path
+ else:
+- save_model_path = tempfile.mkdtemp(suffix='.saved_model')
++ save_model_path = tempfile.mkdtemp(suffix=b'.saved_model')
+ save_options = tf.saved_model.SaveOptions(save_debug_info=show_debug_info)
+ tf.saved_model.save(
+ create_module_fn(), save_model_path, options=save_options)
+
+From 12fa0161f9d8584ba68bb266127b52939d6092d1 Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Thu, 10 Dec 2020 11:21:59 +0000
+Subject: [PATCH 11/12] print debug info
+
+---
+ .../compiler/mlir/tensorflow/tests/tf_saved_model/common.py | 2 +-
+ tensorflow/python/pywrap_mlir.py | 4 ++++
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
+index 5989509bc30e8..47f6b88125217 100644
+--- a/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
++++ b/tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/common.py
+@@ -79,7 +79,7 @@ def app_main(argv):
+ if FLAGS.save_model_path:
+ save_model_path = FLAGS.save_model_path
+ else:
+- save_model_path = tempfile.mkdtemp(suffix=b'.saved_model')
++ save_model_path = tempfile.mkdtemp(suffix='.saved_model')
+ save_options = tf.saved_model.SaveOptions(save_debug_info=show_debug_info)
+ tf.saved_model.save(
+ create_module_fn(), save_model_path, options=save_options)
+diff --git a/tensorflow/python/pywrap_mlir.py b/tensorflow/python/pywrap_mlir.py
+index 6db68f0e581eb..098cdc1108b2b 100644
+--- a/tensorflow/python/pywrap_mlir.py
++++ b/tensorflow/python/pywrap_mlir.py
+@@ -37,6 +37,10 @@ def import_function(concrete_function, pass_pipeline):
+
+ def experimental_convert_saved_model_to_mlir(saved_model_path, exported_names,
+ show_debug_info):
++ print(saved_model_path)
++ print(str(saved_model_path).encode('utf-8'))
++ print(exported_names)
++ print(str(exported_names).encode('utf-8'))
+ return ExperimentalConvertSavedModelToMlir(
+ str(saved_model_path).encode('utf-8'),
+ str(exported_names).encode('utf-8'), show_debug_info)
+
+From 928116bb70f07e9197e87db0d22866bc43ad8ef9 Mon Sep 17 00:00:00 2001
+From: bhack <bhack at users.noreply.github.com>
+Date: Thu, 10 Dec 2020 13:04:08 +0000
+Subject: [PATCH 12/12] Remove debug print
+
+---
+ tensorflow/python/pywrap_mlir.py | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/tensorflow/python/pywrap_mlir.py b/tensorflow/python/pywrap_mlir.py
+index 098cdc1108b2b..6db68f0e581eb 100644
+--- a/tensorflow/python/pywrap_mlir.py
++++ b/tensorflow/python/pywrap_mlir.py
+@@ -37,10 +37,6 @@ def import_function(concrete_function, pass_pipeline):
+
+ def experimental_convert_saved_model_to_mlir(saved_model_path, exported_names,
+ show_debug_info):
+- print(saved_model_path)
+- print(str(saved_model_path).encode('utf-8'))
+- print(exported_names)
+- print(str(exported_names).encode('utf-8'))
+ return ExperimentalConvertSavedModelToMlir(
+ str(saved_model_path).encode('utf-8'),
+ str(exported_names).encode('utf-8'), show_debug_info)
More information about the arch-commits
mailing list