shenweichen / DeepCTR

Easy-to-use,Modular and Extendible package of deep-learning based CTR models .
https://deepctr-doc.readthedocs.io/en/latest/index.html
Apache License 2.0
7.52k stars 2.21k forks source link

run_classification_criteo遇到TypeError: Cannot convert a symbolic Keras input/output to a numpy array.问题 #462

Closed VinnyHu closed 1 year ago

VinnyHu commented 2 years ago

在运行run_classification_criteo.py 测试DeepFM模型时,遇到了TypeError: Cannot convert a symbolic Keras input/output to a numpy array. This error may indicate that you're trying to pass a symbolic value to a NumPy call, which is not supported. Or, you may be trying to pass Keras symbolic inputs/outputs to a TF API that does not register dispatching, preventing Keras from automatically converting the API call to a lambda layer in the Functional Model.

先是指出 run_classification_criteo.py中的 model = DeepFM(linear_feature_columns, dnn_feature_columns, task='binary') 然后指出 deepctr/models/deepfm.py中的 dnn_logit = tf.keras.layers.Dense(1, use_bias=False, kernel_initializer=tf.keras.initializers.glorot_normal(seed=seed))(dnn_output)

tf版本为2.6

请问这个可能是什么原因引起的?

cservan commented 2 years ago

Dear All, I have the same issue with the example "run_regression_movielens.py"... Any idea to solve it?

Best

shenweichen commented 2 years ago

This is due to version incompatibility of numpy , you can use pip install numpy==1.19.5 to reinstall