Skip to content

Commit

Permalink
Allow pickle when loading model
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Pillac committed Nov 18, 2019
1 parent efccdf0 commit b5c80d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyrec/implicit/als.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def save(self, base_name, user_factors=False, compress=False):

def load_recommender(als_model_file: str, index_file: str, item_feature_file: str = None, **kwargs) -> ImplicitRecommender:
log.info("Loading als model")
data = np.load(als_model_file)
data = np.load(als_model_file, allow_pickle=True)
model = AlternatingLeastSquares(factors=data['model.item_factors'].shape[1])
model.item_factors = data['model.item_factors']
model.YtY # This will initialize the _YtY instance variable which is used directly in internal methods
Expand Down

0 comments on commit b5c80d6

Please sign in to comment.