I just trained my fasttext model and I am trying to pin it using pins https://pypi.org/project/pins/ and vetiver https://pypi.org/project/vetiver/ for version control.
However, for that to happen I need to pickle the fasttext object/model. And that is where I am struggling.
PS: When I save the fasttext model to disk, it saves as a .bin or a binary file.
Here is how the code looks, when using pins:
import pins
import fasttext
board = pins.board_temp(allow_pickle_read = True)
board.pin_write(ft_model, "ft_model", type="joblib") #ft_model is a fasttext model I already trained
The error code I get for running these ^ lines is :
cannot pickle 'fasttext_pybind.fasttext' object
The same happens when I use vetiver:
import vetiver
import fasttext
import pins
class FasttextHandler(BaseHandler):
def __init__(self, model, ptype_data):
super().__init__(model, ptype_data)
handled_model = FasttextHandler(model = ft_model, ptype_data = None )
vetiver_fasttext_model = vetiver.VetiverModel(model = handled_model, model_name = "model")
ft_board = board_temp(allow_pickle_read = True)
vetiver.vetiver_pin_write(ft_board, vetiver_fasttext_model)
Again, the error code I get for this snippet ^ of code is cannot pickle 'fasttext_pybind.fasttext' object
I appreciate any help or any tips,
Thank you kindly!
Jamal