Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Is it possible to implement dist-keras and run in local machine for this Keras Model #72

Open
mohaimenz opened this issue Jul 11, 2018 · 1 comment

Comments

@mohaimenz
Copy link

Hi @JoeriHermans,
I am reading the documentation of this repository. My experimental setup runs on Theano for accuracy reproducibility. Now, I need to train my model in distributed fashion on multiple nodes. I tried ELEPHAS as it asks for least amount of change and it also runs on Theano. However, I failed to run my experiment with that. Now, I am looking at your API and it seems that I will have to rewrite my whole experiment. I am putting my model here. It would be great to have your suggestion in this regard. I also would like to know if it is possible to run the dist-keras implementation in my local machine. My local machine has 8 cores and one 4GB NVIDIA GPU.

model = Sequential();
model.add(Dropout(0.2, input_shape=(122,)));
model.add(Dense(150, kernel_initializer='normal', activation='relu', kernel_constraint=maxnorm(3)));
model.add(Dropout(0.5));
model.add(Dense(120, kernel_initializer='normal', activation='relu', kernel_constraint=maxnorm(3)));
model.add(Dropout(0.5));
model.add(Dense(50, kernel_initializer='normal', activation='relu', kernel_constraint=maxnorm(3)));
model.add(Dropout(0.5));
model.add(Dense(2, kernel_initializer='normal', activation='sigmoid'));

sgd = SGD(lr=0.1, momentum=0.9, decay=1e-6, nesterov=True);
model.compile(loss='mean_squared_error', optimizer=sgd, metrics=['accuracy']);
###trainX, trainY, testX, testY are all numpy variables where categorical values are discretized by one-hot ###encoding and normalized using z-score normalization using sklearn.preprocessing
model.fit(trainX, trainY, epochs=50, batch_size=32, shuffle=True, verbose=1);
testYPredicted = model.predict(testX, batch_size=32);
@anishsharma
Copy link

You can run it in local but use SingleTrainer train() instead model.fit() for that purpose. He has various examples you can follow to get the idea.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants