Cant store Tflearn Model into MongoDB document

29 views Asked by At

I cant store my model into my Mongo Database. I read that i can use a pickle file and then parse it to Binary but it didint work. The error that return "cannot pickle '_thread.RLock' object" This is my code:

model = tflearn.DNN(net)

model.fit(training, output, n_epoch=1000, batch_size=8, show_metric=True)
model.save("./model/model.tflearn")

pickled_model = pickle.dumps(model)

try:
    database.dataModel.insert_one(
    {
        "model_json": Binary(pickled_model),
    }
)
except Exception:
    print("Unable to connect to the MongoDB server.")
0

There are 0 answers