Closed bavaria95 closed 2 years ago
For saving, we need a file opened in binary mode rather than text mode - so you need to pass the b
mode to the open call :
# write out the model to a binary file object
with open('test.mdl', 'wb') as f:
model.save(f)
# alternatively, can just specify the path
model.save("filename")
To load up a model, you need to use the subclass to load up from a file:
model = implicit.cpu.als.AlternatingLeastSquares.load("filename")
@benfred
hi,
model = AlternatingLeastSquares(
factors=10,
regularization=0.1,
iterations=1,
# use_gpu=False,
num_threads=0
)
# Fit the model to the ratings data
model.fit(csr)
model.save('model.mdl')
I use implicit version is
implicit 0.5.2 py310h80e0b47_1 conda-forge
but. The error is comming
'AlternatingLeastSquares' object has no attribute 'save'
why?..
and I want to update implict version latest(0.6.2) But this tag is not found.
conda install implict=0.6.2
Hey!
Trying to run the following code:
It fails with the following error:
Then, I'm able to save it to a byte stream:
But then it's not clear how to load it. In #577 the loading functionality has been moved into
RecommenderBase
. So trying to load it with this fails: