-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Issues in Tensorflow model training #69984
Comments
@myh1234567 |
the following is the code snippent, import tensorflow as tf physical_device = tf.config.list_physical_devices("GPU") def convert_sparse_matrix_to_sparse_tensor(X) -> tf.SparseTensor: X_transformed_train_db = sp.rand(100, 1000, density=0.1, format='coo') gpus = tf.config.list_logical_devices("GPU") with strategy.scope(): history_db = model_db.fit(X_transformed_train_db, y_train_db_, epochs=3) tensorflow 2.16.1 thank you |
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
No
Source
source
TensorFlow version
tf 2.16.1
Custom code
Yes
OS platform and distribution
linux
Mobile device
x86_64
Python version
3.12
Bazel version
No response
GCC/compiler version
No response
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
With the same code and the same data, I had no issues training under Python 3.9 with TensorFlow 2.11.
However, after updating to Python 3.12 with TensorFlow 2.16, I encountered errors.
The error messages are as follows:
Traceback (most recent call last):
File "/home/train_model", line 379, in
history_db = model_db.fit(X_transformed_train_db, y_train_db_, epochs=3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/miniconda3/lib/python3.12/site-packages/keras/utils/traceback_utils.py", line 123, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/miniconda3/lib/python3.12/site-packages/keras/trainers/data_adapters/init.py", line 113, in get_data_adapter
raise ValueError(f"Unrecognized data type: x={x} (of type {type(x)})")
ValueError: Unrecognized data type: x=SparseTensor(indices=tf.Tensor(
[[ 0 11068]
[ 0 16849]
[ 0 35681]
...
[8563599 29603]
[8563599 31778]
[8563599 38279]], shape=(41839230, 2), dtype=int64), values=tf.Tensor([0.52680086 0.59266628 0.42937609 ... 0.27554394 0.25317136 0.33879793], shape=(41839230,), dtype=float64), dense_shape=tf.Tensor([8563600 40000], shape=(2,), dtype=int64)) (of type <class 'tensorflow.python.framework.sparse_tensor.SparseTensor'>)
Standalone code to reproduce the issue
Relevant log output
No response
The text was updated successfully, but these errors were encountered: