Closed adamfils closed 3 years ago
with open('....model_name....', 'wb') as file:
pickle.dump(model.copy(), file)
this creates the file to write bytes(wb) of the class (strategy) to the file as the python standard pickle file.
Thanks
How do we save and load tf sessions so we don't have to retrain the model every time. Note that tf models are thread locked so you can't pickle them. Is there a code on how to export into .pb or pbtxt and maintain accuracy?
unless you are using the same random seed across your sessions then accuracy cannot be guaretted. As far saving your model goes, you can either convert to keras model and create a custom callback, or since each layer of the tf model is callable you can convert to numpy and save the weights of each layer/variable..... there are multiple ways to approach this problem. I converted mine to tf 2.0 which has eager execution disabled and no need to worry about sessions as a whole....
unless you are using the same random seed across your sessions then accuracy cannot be guaretted. As far saving your model goes, you can either convert to keras model and create a custom callback, or since each layer of the tf model is callable you can convert to numpy and save the weights of each layer/variable..... there are multiple ways to approach this problem. I converted mine to tf 2.0 which has eager execution disabled and no need to worry about sessions as a whole....
Hey @IISuperluminaLII would you be able to share part your code where you load the model and predict? I'm still new to tf. I have enough compute to train once or twice a day but cannot train each time. Thanks!
which model are you talking about? it is implementation dependent as layer names and layer configurations are different across the models.
I'm using the LSTM.
Can please provide like a code snippet to do that? It will be super help full Thanks🙏