Summary: | sci-libs/tensorflow-2.5.0-r1: won't load model (TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorflow.TensorShapeProto got tensorflow.TensorShapeProto.) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Oscar <oscar.mueller> |
Component: | Current packages | Assignee: | Jason Zaman <perfinion> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | kfm, sam, shuber |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Oscar
2021-08-05 13:44:09 UTC
Same here, but with -cuda # emerge -pv sci-libs/tensorflow These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ~] sci-libs/tensorflow-2.5.0-r1::gentoo USE="python xla -cuda -mpi" CPU_FLAGS_X86="avx avx2 fma3 sse sse2 sse3 sse4_1 sse4_2 -fma4" PYTHON_TARGETS="python3_9 -python3_8" 218739 KiB Testing with a very simple python script from tutorials: import tensorflow as tf model = tf.keras.models.Sequential([ tf.keras.layers.Flatten(input_shape=(28, 28)), tf.keras.layers.Dense(128, activation='relu'), tf.keras.layers.Dropout(0.2), tf.keras.layers.Dense(10) ]) /usr/lib/python3.9/site-packages/tensorflow/python/ops/resource_variable_ops.py in _variable_handle_from_shape_and_dtype(shape, dtype, shared_name, name, graph_mode, initial_value) 175 handle_data.is_set = True 176 handle_data.shape_and_type.append( --> 177 cpp_shape_inference_pb2.CppShapeInferenceResult.HandleShapeAndType( 178 shape=shape.as_proto(), dtype=dtype.as_datatype_enum)) 179 TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorflow.TensorShapeProto got tensorflow.TensorShapeProto. Hi, I recompiled tensorflow without cuda, same issue. However, there was a warning that could coincide with a falsely shaped object. WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.devtools.build.lib.unsafe.StringUnsafe (file:/media/k/portage_temp/portage/sci-libs/tensorflow-2.5.0-r1/homedir/.cache/bazel/_bazel_portage/install/341df59e96c2ce6bbd8b0149edb7cbee/A-server.jar) to constructor java.lang.String(byte[],byte) WARNING: Please consider reporting this to the maintainers of com.google.devtools.build.lib.unsafe.StringUnsafe WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release import tensorflow as tf m = tf.keras.Sequential() Traceback: File "/simple.py", line 2, in <module> m = tf.keras.Sequential() File "/usr/lib/python3.9/site-packages/tensorflow/python/training/tracking/base.py", line 522, in _method_wrapper result = method(self, *args, **kwargs) File "/usr/lib/python3.9/site-packages/tensorflow/python/keras/engine/sequential.py", line 114, in __init__ super(functional.Functional, self).__init__( # pylint: disable=bad-super-call File "/usr/lib/python3.9/site-packages/tensorflow/python/training/tracking/base.py", line 522, in _method_wrapper result = method(self, *args, **kwargs) File "/usr/lib/python3.9/site-packages/tensorflow/python/keras/engine/training.py", line 318, in __init__ self._init_batch_counters() File "/usr/lib/python3.9/site-packages/tensorflow/python/training/tracking/base.py", line 522, in _method_wrapper result = method(self, *args, **kwargs) File "/usr/lib/python3.9/site-packages/tensorflow/python/keras/engine/training.py", line 326, in _init_batch_counters self._train_counter = variables.Variable(0, dtype='int64', aggregation=agg) File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/variables.py", line 262, in __call__ return cls._variable_v2_call(*args, **kwargs) File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/variables.py", line 244, in _variable_v2_call return previous_getter( File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/variables.py", line 237, in <lambda> previous_getter = lambda **kws: default_variable_creator_v2(None, **kws) File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/variable_scope.py", line 2662, in default_variable_creator_v2 return resource_variable_ops.ResourceVariable( File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/variables.py", line 264, in __call__ return super(VariableMetaclass, cls).__call__(*args, **kwargs) File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1584, in __init__ self._init_from_args( File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 1738, in _init_from_args handle = eager_safe_variable_handle( File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 237, in eager_safe_variable_handle return _variable_handle_from_shape_and_dtype(shape, dtype, shared_name, name, File "/usr/lib/python3.9/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 177, in _variable_handle_from_shape_and_dtype cpp_shape_inference_pb2.CppShapeInferenceResult.HandleShapeAndType( TypeError: Parameter to MergeFrom() must be instance of same class: expected tensorflow.TensorShapeProto got tensorflow.TensorShapeProto. mentioned here: https://github.com/tensorflow/tensorflow/issues/42596 installing protobuf as user "solves" the issue: pip install --user --force --no-deps protobuf I've followed the link from Oscar and came across this PR https://github.com/tensorflow/tensorflow/pull/51450 I added that as a patch and rebuild the package, the weird error have gone away. Definitely the way to go. Works fine here, too. *** Bug 817140 has been marked as a duplicate of this bug. *** Fixed in 08fd73895803f777a23820de619412ac3e03c68a Bumped to tf-2.5.0-r2 thanks for tracking down the fix :) |