THUDM / ComiRec

Source code and dataset for KDD 2020 paper "Controllable Multi-Interest Framework for Recommendation"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

save model for predicting user embeddings

linWujl opened this issue · comments

commented

How to save model for predicting.
I do the follow:
def save_user_model(self, sess, path): builder = tf.compat.v1.saved_model.Builder(path) sig_def = tf.compat.v1.saved_model.predict_signature_def( inputs={'mid_his_batch_ph': self.mid_his_batch_ph, 'mask': self.mask}, outputs={'output': self.user_eb} ) builder.add_meta_graph_and_variables( sess, tags=['serve'], signature_def_map={ tf.compat.v1.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY: sig_def } ) builder.save()

it outputs different user embedding for the same input.