Open yixuantang opened 5 months ago
Hi thanks for the library!
When loading the saved model YouTubeRetrieval I encountered this:
FileNotFoundError Traceback (most recent call last) Cell In[62], line 2 1 loaded_data_info = DataInfo.load("", model_name="youtube_retrieval") ----> 2 loaded_model = YouTubeRetrieval.load("output", model_name="youtube_retrieval", data_info=loaded_data_info) File /usr/local/lib/python3.8/dist-packages/libreco/bases/dyn_embed_base.py:319, in DynEmbedBase.load(cls, path, model_name, data_info, **kwargs) 316 @classmethod 317 def load(cls, path, model_name, data_info, **kwargs): 318 model = load_tf_variables(cls, path, model_name, data_info) --> 319 embeddings = np.load(os.path.join(path, f"{model_name}.npz")) 320 model.user_embeds_np = embeddings["user_embed"] 321 model.item_embeds_np = embeddings["item_embed"] File /usr/local/lib/python3.8/dist-packages/numpy/lib/npyio.py:417, in load(file, mmap_mode, allow_pickle, fix_imports, encoding) 415 own_fid = False 416 else: --> 417 fid = stack.enter_context(open(os_fspath(file), "rb")) 418 own_fid = True 420 # Code to distinguish from NumPy binary files and pickles. FileNotFoundError: [Errno 2] No such file or directory: 'output/youtube_retrieval.npz'
Here's my code to save the model:
data_info.save(path='',model_name = 'youtube_retrieval') ytb_retrieval.save(path='output',model_name='youtube_retrieval')
Looking at the output files there's no youtube_retrieval.npz saved, is it an issue with the save function in youtube_retrieval? Or could you please help where I missed, thank you!
youtube_retrieval.npz
The save/load API is used for inference, so u should pass inference=True in the ytb_retrieval.save method. See Save/Load
inference=True
ytb_retrieval.save
Got you, it worked, thank you for the speedy reply!
Hi thanks for the library!
When loading the saved model YouTubeRetrieval I encountered this:
Here's my code to save the model:
Looking at the output files there's no
youtube_retrieval.npz
saved, is it an issue with the save function in youtube_retrieval? Or could you please help where I missed, thank you!