shenweichen / DeepMatch

A deep matching model library for recommendations & advertising. It's easy to train models and to export representation vectors which can be used for ANN search.
https://deepmatch.readthedocs.io/en/latest/
Apache License 2.0
2.24k stars 534 forks source link

sparsefeature,以传入vocabulary_path的方式做hash,报错 #84

Open LitteleStar opened 2 years ago

LitteleStar commented 2 years ago

当我用vocabulary_path的方式做hash,如下: VarLenSparseFeat(SparseFeat('short_item', vocabulary_size=100, embedding_dim=8,use_hash=True,vocabulary_path=index,dtype='int32',embeddings_initializer='uniform', embedding_name='item'), 4,'mean', length_name="short_sess_length")

就会有报错: File "/root/python_proj/song_matching/models/utils.py", line 342, in check_model model.fit(x, y, batch_size=10, epochs=2, validation_split=0.5) File "/root/anaconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/keras/engine/training_v1.py", line 809, in fit use_multiprocessing=use_multiprocessing) File "/root/anaconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 666, in fit steps_name='steps_per_epoch') File "/root/anaconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/keras/engine/training_arrays.py", line 386, in model_iteration batch_outs = f(ins_batch) File "/root/anaconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/keras/backend.py", line 3825, in call run_metadata=self.run_metadata) File "/root/anaconda3/envs/tf2/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1472, in call run_metadata_ptr) tensorflow.python.framework.errors_impl.FailedPreconditionError: Table not initialized. [[{{node hash/hash_table_Lookup/hash_table_Lookup/LookupTableFindV2}}]]

zhuchenxi commented 1 year ago

同问