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

[ASK] Unexpected Behavior with LightGCN Model When Loading Saved Files #2095

Open
HenryWu01 opened this issue May 8, 2024 · 1 comment
Open
Labels
help wanted Need help from developers

Comments

@HenryWu01
Copy link

HenryWu01 commented May 8, 2024

Description

I am currently using the LightGCN model for predictions on my own dataset. The regular workflow, including initializing the model, model.fit(), and model.recommend_k_items(), functions without any issues.

However, after I use model.load() to restore the model from previously saved data, model.recommend_k_items() throws an error:

---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
File ~\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\client\session.py:1402, in BaseSession._do_call(self, fn, *args)
   1401 try:
-> 1402   return fn(*args)
   1403 except errors.OpError as e:

File ~\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\client\session.py:1385, in BaseSession._do_run.<locals>._run_fn(feed_dict, fetch_list, target_list, options, run_metadata)
   1384 self._extend_graph()
-> 1385 return self._call_tf_sessionrun(options, feed_dict, fetch_list,
   1386                                 target_list, run_metadata)

File ~\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\client\session.py:1478, in BaseSession._call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata)
   1476 def _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list,
   1477                         run_metadata):
-> 1478   return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict,
   1479                                           fetch_list, target_list,
   1480                                           run_metadata)

InvalidArgumentError: Cannot multiply A and B because inner dimension does not match: 2160 vs. 2162.  Did you forget a transpose?  Dimensions of A: [2160, 2160).  Dimensions of B: [2162,64]
	 [[{{node SparseTensorDenseMatMul/SparseTensorDenseMatMul}}]]

Please assist in resolving this issue. Thank you!

Other Comments

@HenryWu01 HenryWu01 added the help wanted Need help from developers label May 8, 2024
@HenryWu01
Copy link
Author

HenryWu01 commented May 8, 2024

Update: Ignore this, it does not work at all.

For those who encounter this issue, you have to restore the model like this:

model.saver = tf.compat.v1.train.import_meta_graph('./model/lightgcn.meta')
model.saver.restore(model.sess, tf.train.latest_checkpoint('./model'))

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

No branches or pull requests

1 participant