Closed lavarthan closed 3 years ago
I found the solution. You can save the model using Pickle
import pickle
# model
bm25 = bm25 = BM25Okapi(tok_text)
# save model
file_name = "model.pkl"
with open(file_name, 'wb') as file:
pickle.dump(bm25, file)
then you can load it using pickle as well
# load model
with open(file_name, 'rb') as file:
model = pickle.load(file)
How we can save the trained model and load it?