LibRecommender icon indicating copy to clipboard operation
LibRecommender copied to clipboard

Error when running model.fit() a second time

Open tscheidt opened this issue 3 years ago • 1 comments

When running the 'pure collaborative-filtering example' , it only works on the first run. When rerunning the code I get the error message 'ValueError: Variable bu_var already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at: ...'. Is there a simple fix for this problem? I need to rerun the algorithm a few times and can't open a new console every time. I am using python 3.8 and Tensorflow 2.3.

tscheidt avatar Jun 18 '21 13:06 tscheidt

Just call tf.compat.v1.reset_default_graph() before rerunning.

>>> svdpp = SVDpp(...)
>>> svdpp.fit(...)
>>> tf.reset_default_graph()
>>> svdpp = SVDpp(...)
>>> svdpp.fit(...)

massquantity avatar Jun 18 '21 16:06 massquantity