Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TF 2 Implementation error #183

Open
Ankan1998 opened this issue Jan 29, 2021 · 3 comments
Open

TF 2 Implementation error #183

Ankan1998 opened this issue Jan 29, 2021 · 3 comments

Comments

@Ankan1998
Copy link

2021-01-29 15:28:13.823161: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.d
ll not found
2021-01-29 15:28:13.831735: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-01-29 15:28:19.039282: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)
to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-01-29 15:28:19.058589: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found

2021-01-29 15:28:19.068296: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-01-29 15:28:19.079502: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-ALGRPUI
2021-01-29 15:28:19.086903: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-ALGRPUI
2021-01-29 15:28:19.093464: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-01-29 15:28:19,101 root INFO phase: train
2021-01-29 15:28:19,103 root INFO model_dir: ./checkpoints
2021-01-29 15:28:19,103 root INFO load_model: False
2021-01-29 15:28:19,105 root INFO output_dir: ./results
2021-01-29 15:28:19,105 root INFO steps_per_checkpoint: 100
2021-01-29 15:28:19,107 root INFO batch_size: 65
2021-01-29 15:28:19,107 root INFO learning_rate: 1.000000
2021-01-29 15:28:19,109 root INFO reg_val: 0
2021-01-29 15:28:19,109 root INFO max_gradient_norm: 5.000000
2021-01-29 15:28:19,110 root INFO clip_gradients: True
2021-01-29 15:28:19,111 root INFO max_image_width 160.000000
2021-01-29 15:28:19,111 root INFO max_prediction_length 8.000000
2021-01-29 15:28:19,112 root INFO channels: 3
2021-01-29 15:28:19,112 root INFO target_embedding_size: 10.000000
2021-01-29 15:28:19,112 root INFO attn_num_hidden: 128
2021-01-29 15:28:19,113 root INFO attn_num_layers: 2
2021-01-29 15:28:19,113 root INFO visualize: False
C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\legacy_tf_layers\normalization.py:308: UserWarning: tf.layers.batch_n ormalization is deprecated and will be removed in a future version. Please use tf.keras.layers.BatchNormalization instead. In particular, tf.control_dependencies( tf.GraphKeys.UPDATE_OPS) should not be used (consult the tf.keras.layers.BatchNormalization documentation).
'tf.layers.batch_normalization is deprecated and '
C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\base_layer_v1.py:1719: UserWarning: layer.apply is deprecated
and will be removed in a future version. Please use layer.__call__ method instead.
warnings.warn('layer.apply is deprecated and '
C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\layers\legacy_rnn\rnn_cell_impl.py:702: UserWarning: tf.nn.rnn_cell.B asicLSTMCell is deprecated and will be removed in a future version. This class is equivalent as tf.keras.layers.LSTMCell, and will be replaced by that in Tensorflo
w 2.0.
warnings.warn("tf.nn.rnn_cell.BasicLSTMCell is deprecated and will be "
C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\keras\engine\base_layer_v1.py:1727: UserWarning: layer.add_variable is dep
recated and will be removed in a future version. Please use layer.add_weight method instead.
warnings.warn('layer.add_variable is deprecated and '
2021-01-29 15:28:35,726 root INFO Created model with fresh parameters.
<tensorflow.python.framework.ops.Graph object at 0x0000018CA3C23748>
2021-01-29 15:28:36.129245: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:196] None of the MLIR optimization passes are enabled (registered 0 passes)
Traceback (most recent call last):
File "C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1375, in _do_call
return fn(*args)
File "C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1358, in _run_fn
self._extend_graph()
File "C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1398, in _extend_graph
tf_session.ExtendSession(self._session)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'MutableDenseHashTableV2' used by {{node MutableDenseHashTable}
} with these attrs: [initial_num_buckets=131072, shared_name="", use_node_name_sharing=true, key_dtype=DT_INT64, container="", value_shape=[], value_dtype=DT_STRING,
max_load_factor=0.8]
Registered devices: [CPU]
Registered kernels:
device='CPU'; key_dtype in [DT_INT32]; value_dtype in [DT_DOUBLE]
device='CPU'; key_dtype in [DT_INT32]; value_dtype in [DT_FLOAT]
device='CPU'; key_dtype in [DT_INT32]; value_dtype in [DT_INT32]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_BOOL]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_DOUBLE]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_FLOAT]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_INT32]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_INT64]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_VARIANT]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_BOOL]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_DOUBLE]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_FLOAT]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_INT32]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_INT64]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_RESOURCE]

     [[MutableDenseHashTable]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 286, in
main()
File "main.py", line 254, in main
reg_val=0
File "C:\Users\Ankan\Desktop\AOCR_TF2\aocr\model\model.py", line 301, in init
self.sess.run(tf.compat.v1.global_variables_initializer())
File "C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 968, in run
run_metadata_ptr)
File "C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1191, in _run
feed_dict_tensor, options, run_metadata)
File "C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1369, in _do_run
run_metadata)
File "C:\Users\Ankan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1394, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: No OpKernel was registered to support Op 'MutableDenseHashTableV2' used by node MutableDenseHashTable (d
efined at C:\Users\Ankan\Desktop\AOCR_TF2\aocr\model\model.py:185) with these attrs: [initial_num_buckets=131072, shared_name="", use_node_name_sharing=true, key_dty
pe=DT_INT64, container="", value_shape=[], value_dtype=DT_STRING, max_load_factor=0.8]
Registered devices: [CPU]
Registered kernels:
device='CPU'; key_dtype in [DT_INT32]; value_dtype in [DT_DOUBLE]
device='CPU'; key_dtype in [DT_INT32]; value_dtype in [DT_FLOAT]
device='CPU'; key_dtype in [DT_INT32]; value_dtype in [DT_INT32]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_BOOL]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_DOUBLE]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_FLOAT]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_INT32]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_INT64]
device='CPU'; key_dtype in [DT_INT64]; value_dtype in [DT_VARIANT]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_BOOL]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_DOUBLE]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_FLOAT]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_INT32]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_INT64]
device='CPU'; key_dtype in [DT_STRING]; value_dtype in [DT_RESOURCE]

     [[MutableDenseHashTable]]

I tried using different table instead of
"tf.contrib.lookup.MutableHashTable"

But everything is giving error. i used then
tf.lookup.experimental.DenseHashTable.
But it is giving these error.

Any help is highly appreciable

@khu834
Copy link

khu834 commented Feb 23, 2021

Have you tried tf.raw_ops.MutableHashTable?
https://www.tensorflow.org/api_docs/python/tf/raw_ops/MutableHashTable

The interface seems like it should do the same as tf.contrib.lookup.MutableHashTable

@mjpieters
Copy link
Contributor

mjpieters commented Oct 20, 2023

In my minimal TF2 PR (#198) I successfully used tf.lookup.experimental.MutableHashTable. This uses one of tf.raw_ops.AnonymousMutableHashTable, tf.raw_ops.AnonymousMutableHashTableOfTensors, tf.raw_ops.MutableHashTableV2 or tf.raw_ops.MutableHashTableOfTensorsV2 under the hood based on wether or not the table is anonymous and the number of dimensions needed.

For how attention-ocr uses this, that'd be tf.raw_ops.MutableHashTableV2.

@emedvedev
Copy link
Owner

Merged @mjpieters's PR: #198. Should support TF2 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants