Thread tf_data_private_threadpool creation via pthread_create() failed. with Tensorflow

Tensorflow: 2.9.0rc2

When I am running code from Fine-tuning Wav2Vec2 with an LM head  |  TensorFlow Hub I get the following error:

2022-05-14 01:29:34.559913: I tensorflow/core/common_runtime/placer.cc:114] FakeSink1: (Identity): /job:localhost/replica:0/task:0/device:CPU:0
identity_RetVal: (_Retval): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.559923: I tensorflow/core/common_runtime/placer.cc:114] identity_RetVal: (_Retval): /job:localhost/replica:0/task:0/device:CPU:0
identity_1_RetVal: (_Retval): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.559933: I tensorflow/core/common_runtime/placer.cc:114] identity_1_RetVal: (_Retval): /job:localhost/replica:0/task:0/device:CPU:0
args_0: (_Arg): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.562563: I tensorflow/core/common_runtime/placer.cc:114] args_0: (_Arg): /job:localhost/replica:0/task:0/device:CPU:0
PyFunc: (PyFunc): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.562581: I tensorflow/core/common_runtime/placer.cc:114] PyFunc: (PyFunc): /job:localhost/replica:0/task:0/device:CPU:0
NoOp: (NoOp): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.562597: I tensorflow/core/common_runtime/placer.cc:114] NoOp: (NoOp): /job:localhost/replica:0/task:0/device:CPU:0
Identity: (Identity): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.562607: I tensorflow/core/common_runtime/placer.cc:114] Identity: (Identity): /job:localhost/replica:0/task:0/device:CPU:0
FakeSink0: (Identity): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.562617: I tensorflow/core/common_runtime/placer.cc:114] FakeSink0: (Identity): /job:localhost/replica:0/task:0/device:CPU:0
identity_RetVal: (_Retval): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.562627: I tensorflow/core/common_runtime/placer.cc:114] identity_RetVal: (_Retval): /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.565827: I tensorflow/core/common_runtime/eager/execute.cc:1320] Executing op AnonymousIteratorV3 in device /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.566006: I tensorflow/core/common_runtime/eager/execute.cc:1320] Executing op MakeIterator in device /job:localhost/replica:0/task:0/device:CPU:0
2022-05-14 01:29:34.566508: F tensorflow/core/platform/default/env.cc:73] Check failed: ret == 0 (11 vs. 0)Thread tf_data_private_threadpool creation via pthread_create() failed.
Aborted (core dumped)

I understood that the following error causes from line history = model.fit(train_dataset, validation_data=val_dataset, epochs=3)

It is related to kernel’s settings of threads as I could understand, but I need more professional look on the issue and direction to solve it.

Hi @yehors

Welcome to the TensorFlow Forum!

The above mentioned code is working fine. Please refer to this replicated gist for the same.

One thing I have observed in the error log that you are executing this code in CPU mode while its mentioned in the Fine-tuning Wav2Vec2 with an LM head doc to enable the GPU before executing the given code which might be causing the above error. Please try again executing the code in GPU mode and let us know if the issue still persists. Thank you.