{"id":2027,"date":"2019-06-25T09:05:35","date_gmt":"2019-06-25T09:05:35","guid":{"rendered":"https:\/\/www.codeastar.com\/?p=2027"},"modified":"2019-06-25T09:29:11","modified_gmt":"2019-06-25T09:29:11","slug":"save-and-load-your-rnn-model","status":"publish","type":"post","link":"https:\/\/www.codeastar.com\/save-and-load-your-rnn-model\/","title":{"rendered":"Save and Load your RNN model"},"content":{"rendered":"\n

In this blog, we tasted different kinds of machine learning projects so far. Our projects included prediction on stock price<\/a>, image recognizer on hand writing<\/a>, NLP on comment classification<\/a> and others. There was one thing in common — we used long time to train a model. It is okay to use several hours for model training in research projects. But what if we want to use it as a production service? It doesn’t make sense to tell our clients, “please wait a few more hours, we are training the model”. Don’t worry, we have a solution. Do you remember how do we handle word embedding<\/a> with 600 billion tokens? Yes, we didn’t train it, we use the pre-trained model. So this is our answer, we train a model, save and load it then use it in production.<\/p>\n\n\n\n

Train and Save RNN model<\/h3>\n\n\n\n

Before we use a pre-trained model, we need to train a mode. Let’s use the toxic comment classification project that we did last time as our material. Therefore, we use Recurrent Neural Network (RNN)<\/a> and word embedding<\/a> to find out toxic comments. For technical details om RNN and word embedding, please read our posts: NLP and Python Part 1<\/a> and Part 2<\/a>. In this post, we focus on how to save and load the RNN model.<\/p>\n\n\n\n

In addition to start saving our model, remember to: <\/p>\n\n\n\n