I was wondering if it was possible to save a partly trained Keras model and continue the training after loading the model again.
The reason for this is that I will have more... moreI was wondering if it was possible to save a partly trained Keras model and continue the training after loading the model again.
The reason for this is that I will have more training data in the future and I do not want to retrain the whole model again.
The functions which I am using are:
#Partly train model
model.fit(first_training, first_classes, batch_size=32, nb_epoch=20)
#Save partly trained model
model.save('partly_trained.h5')
#Load partly trained model
from keras.models import load_model
model = load_model('partly_trained.h5')
#Continue training
model.fit(second_training, second_classes, batch_size=32, nb_epoch=20)
Edit 1: added fully working example
With the first dataset after 10 epochs the loss of the last epoch will be 0.0748 and the accuracy 0.9863.
After saving, deleting and reloading the model the loss and accuracy of the model trained on the second dataset will be 0.1711 and 0.9504 respectively.
Is this caused by the new training data or by a completely re-trained model?
"""
Model... less
We have been training a neural net on the AI engine with a data-set consisting of 96 000 000 data points. The neural net was trained in a distributed manner, and as customary we... moreWe have been training a neural net on the AI engine with a data-set consisting of 96 000 000 data points. The neural net was trained in a distributed manner, and as customary we used 20 % of the data-set as evaluation data. In order to train distributed we used TensorFlow estimators and the method tf.estimator.train_and_evaluate. Since our data-set is very large, our evaluation set is also quite large. Looking into the cpu usage of the master vs the workers nodes, and testing with an evaluation data-set consisting of only 100 samples, it appears as though the evaluation is not distributed and happens only on the master node. This makes the amount of ML units consumed increase by a factor of approximately 5 between having the standard size evaluation data (20 % of the total data) and only having 100 data points for evaluation, while the amount of training data is the same.We see two possible solutions to this problem:Doing also the evaluation distributed, but is that technically possible on the AI... less
I'm building a RNN model to do the image classification. I used a pipeline to feed in the data. However it returnsValueError: Variable rnn/rnn/basic_rnn_cell/weights already... moreI'm building a RNN model to do the image classification. I used a pipeline to feed in the data. However it returnsValueError: Variable rnn/rnn/basic_rnn_cell/weights already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:I wonder what can I do to fix this since there are not many examples of implementing RNN with an input pipeline. I know it would work if I use the placeholder, but my data is already in the form of tensors. Unless I can feed the placeholder with tensors, I prefer just to use the pipeline.def RNN(inputs):with tf.variable_scope('cells', reuse=True): basic_cell = tf.contrib.rnn.BasicRNNCell(num_units=batch_size)with tf.variable_scope('rnn'): outputs, states = tf.nn.dynamic_rnn(basic_cell, inputs, dtype=tf.float32)fc_drop = tf.nn.dropout(states, keep_prob)logits = tf.contrib.layers.fully_connected(fc_drop, batch_size, activation_fn=None)return logits#Trainingwith tf.name_scope("cost_function") as scope: cost =... less
Im trying to write NN from scratch to better understand what is going on underneath Keras API. And now I have got problem with applying gradinets to my loss. I believe there is some problem with architecture and my understanding of TF. Basically line with grads returns Nones and hence code returns:
ValueError: No gradients provided for any variable: .
Here is my code. Its very straightforward but I want to do it simply before warping it into model class.
input_shape = x_train.shape
n_hidden_1 = 32
n_hidden_2 = 8
output_shape = 1
epochs = 1
TensorFlow always (pre-)allocates all free memory (VRAM) on my graphics card, which is ok since I want my simulations to run as fast as possible on my... more
TensorFlow always (pre-)allocates all free memory (VRAM) on my graphics card, which is ok since I want my simulations to run as fast as possible on my workstation.
However, I would like to log how much memory (in sum) TensorFlow really uses. Additionally it would be really nice, if I could also log how much memory single tensors use.
This information is important to measure and compare the memory size that different ML/AI architectures need.
Any tips?
I am attacking a combinatorial optimization problem similar to the multi-knapsack problem. The problem has an optimal solution, and i prefer not to settle for an approximate... moreI am attacking a combinatorial optimization problem similar to the multi-knapsack problem. The problem has an optimal solution, and i prefer not to settle for an approximate solution.
Are there any recommended tutorials regarding the quick prototyping and deployment of combinatorial optimization solutions (for senior software engineers that are also Big Data newbies)? I want to move quickly from prototype to deployment onto a docker cluster or AWS.
My background is in distributed systems (a focus on .NET, java, kafka, docker containers, etc...), thus I'm typically inclined to solve complex problems by parallel processing across a cluster of machines (via scaling on a docker cluster or AWS). However, this particular problem can NOT be solved in a brute force manner as the problem space is too large (roughly 100^1000 combinations are possible).
I've limited experience with “big data”, but I'm studying up on knapsack solvers, genetic algorithms, reinforcement learning, and some other AI/ML... less
Using IBM Watson I can create and deploy the ML model either using its Auto AI platform or the Jupyter notebook. Once, my model is deployed then how can I download/export the ML... moreUsing IBM Watson I can create and deploy the ML model either using its Auto AI platform or the Jupyter notebook. Once, my model is deployed then how can I download/export the ML model on which the predictions are done i.e. how can I get the final sklearn model (.pkl file), Tensorflow model (.pb file) or the other supported ML models on my local machine?
I am using pixellib fot training custom image instance segmentation. I have created a dataset whiche can be seen below in link.... moreI am using pixellib fot training custom image instance segmentation. I have created a dataset whiche can be seen below in link. Dataset:https://drive.google.com/drive/folders/1MjpDNZtzGRNxEtCDcTmrjUuB1ics_3Jk?usp=sharing the code which I used to make a custom model is
I am using pixellib fot training custom image instance segmentation. I have created a dataset whiche can be seen below in link. Dataset:https://drive.google.com/drive/folders/1MjpDNZtzGRNxEtCDcTmrjUuB1ics_3Jk?usp=sharing the code which I used to make a custom model is
import pixellib
from pixellib.custom_train import instance_custom_training
I ran the following code to
W = tf.Variable(tf.zeros(), dtype=tf.float32, name="W")
B = tf.constant(, dtype=tf.float32, name="B")
act = tf.add(W,... moreI ran the following code to
W = tf.Variable(tf.zeros(), dtype=tf.float32, name="W")
B = tf.constant(, dtype=tf.float32, name="B")
act = tf.add(W, B)
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
sess.run(act)
writer = tf.summary.FileWriter("./graphs", sess.graph)
writer.close()
And verified it with tensorboard:
What confuses me is the read operation and the operation prior to that which is denoted as (W). Constant B is directed straight to the Add operation while tf.variable has all these operation nodes inside. Here are my questions:What is (W) operation? Constant B is a regular circle which denotes a constant. Oval shaped nodes denote Operation node. (W) doesn't seem like any operation yet it is denoted with the same oval shaped node? What is that node's job?Add node explicitly reads (W) node with a read operation as opposed to constant node B. Why is read necessary for variable nodes? less
Does tensorflow have something similar to scikit learn's one hot encoder for processing categorical data? Would using a placeholder of tf.string behave as categorical data?
I... moreDoes tensorflow have something similar to scikit learn's one hot encoder for processing categorical data? Would using a placeholder of tf.string behave as categorical data?
I realize I can manually pre-process the data before sending it to tensorflow, but having it built in is very convenient.
I have been using the introductory example of matrix multiplication in TensorFlow.
matrix1 = tf.constant()
matrix2 = tf.constant(,)
product = tf.matmul(matrix1,... moreI have been using the introductory example of matrix multiplication in TensorFlow.
matrix1 = tf.constant()
matrix2 = tf.constant(,)
product = tf.matmul(matrix1, matrix2)
When I print the product, it is displaying it as a Tensor object:
<tensorflow.python.framework.ops.Tensor object at 0x10470fcd0>
But how do I know the value of product?The following doesn't help:
print product
Tensor("MatMul:0", shape=TensorShape(), dtype=float32)
I know that graphs run on Sessions, but isn't there any way I can check the output of a Tensor object without running the graph in a session? less
If I want to use the BatchNormalization function in Keras, then do I need to call it once only at the beginning?
I read this documentation for... moreIf I want to use the BatchNormalization function in Keras, then do I need to call it once only at the beginning?
I read this documentation for it: http://keras.io/layers/normalization/
I don't see where I'm supposed to call it. Below is my code attempting to use it:
model = Sequential()
keras.layers.normalization.BatchNormalization(epsilon=1e-06, mode=0, momentum=0.9, weights=None)
model.add(Dense(64, input_dim=14, init='uniform'))
model.add(Activation('tanh'))
model.add(Dropout(0.5))
model.add(Dense(64, init='uniform'))
model.add(Activation('tanh'))
model.add(Dropout(0.5))
model.add(Dense(2, init='uniform'))
model.add(Activation('softmax'))