You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a recommendation system using lightFM on Google Colab. I want to deploy this model using Node JS. I read this article and tried the method recommended here. It recommended using tensorflow.js. For that the model needed to be saved and this is where the problem arose since I wrote my model using lightFM.
This gave rise to following error:
`
AttributeError Traceback (most recent call last)
in
----> 1 model.save("model.h5")
AttributeError: 'LightFM' object has no attribute 'save'
`
What is the alternative to model.save in lightfm? How can we deploy model written in lightfm using node js?
The text was updated successfully, but these errors were encountered:
You can save the model using the serialization library called pickle and load the model too.
import pickle
from lightfm import LightFM
# instantiate model
# train your LightFM model here
# Save the trained model to a pickle file
with open("./model_file.pkl", "wb") as file:
pickle.dump(model, file)
and load the model:
import pickle
from lightfm import LightFM
# read the pickle file
with open("./model_file.pkl", "rb") as file:
model = pickle.load(file)
I hope this will help to load and save the model. Thank you!
I created a recommendation system using lightFM on Google Colab. I want to deploy this model using Node JS. I read this article and tried the method recommended here. It recommended using tensorflow.js. For that the model needed to be saved and this is where the problem arose since I wrote my model using lightFM.
This gave rise to following error:
`
AttributeError Traceback (most recent call last)
in
----> 1 model.save("model.h5")
AttributeError: 'LightFM' object has no attribute 'save'
`
What is the alternative to model.save in lightfm? How can we deploy model written in lightfm using node js?
The text was updated successfully, but these errors were encountered: