How to train a Keras model on multiple GPUs

0 votes

Hi Guys,

I am new to Keras. I want to run the Mask-RCNN model using the Keras module. But it is taking lots of time to execute the code. Is there any way so that I can train the Keras model on Multiple GPUs?

Jul 14, 2020 in Machine Learning by akhtar
• 38,180 points
568 views

3 answers to this question.

0 votes

Hi@akhtar,

There are two ways to run a single model on multiple GPUs, data parallelism and device parallelism. In most cases, what you need is most likely data parallelism.

1) Data parallelism

Data parallelism consists of replicating the target model once on each device and using each replica to process a different fraction of the input data. The best way to do data parallelism with Keras models is to use the tf.distribute API.

2) Model parallelism

Model parallelism consists of running different parts of the same model on different devices. It works best for models that have a parallel architecture, e.g. a model with two branches. This can be achieved by using TensorFlow device scopes.

You can also go through the below link for more information.

https://keras.io/getting_started/faq/#how-can-i-train-a-keras-model-on-multiple-gpus-on-a-single-machine

answered Jul 14, 2020 by MD
• 95,140 points
0 votes
Hello,

One of the biggest hangups with Keras is that it can be a pain to perform multi-GPU training. Between the boilerplate code and configuring TensorFlow it can be a bit of a process…

…but not anymore.

With the latest commit and release of Keras (v2.0.9) it’s now extremely easy to train deep neural networks using multiple GPUs.

In fact, it’s as easy as a single function call!

Thanks.
answered Jul 16, 2020 by Suhana
• 320 points

reshown Jul 16, 2020 by Suhana
0 votes

Hello there,

With the latest commit and release of Keras (v2.0.9) it’s now extremely easy to train deep neural networks using multiple GPUs.
You can refer  -https://www.pyimagesearch.com/2017/10/30/how-to-multi-gpu-training-with-keras-python-and-deep-learning/  .

Thank you,hope my answer will help.

answered Jul 16, 2020 by Lily
• 260 points

Related Questions In Machine Learning

0 votes
1 answer

How can I train a model and calculate the accuracy of CBR algorithm?

Hi@Abubakar, You can find lots of documents on ...READ MORE

answered Oct 16, 2020 in Machine Learning by MD
• 95,140 points
101 views
0 votes
1 answer
0 votes
0 answers

How to know if a problem is solvable by machine learning?

I have recently started learning the machine. ...READ MORE

Nov 21, 2019 in Machine Learning by Hannah
• 18,550 points
209 views
0 votes
1 answer

How to save machine learning model?

Hi@akhtar, To save your Machine Learning model, you ...READ MORE

answered Apr 13, 2020 in Machine Learning by MD
• 95,140 points
243 views
0 votes
1 answer

What is h5 model in Keras?

Hi@akhtar, H5 is a file format to store ...READ MORE

answered Jul 14, 2020 in Machine Learning by MD
• 95,140 points
1,994 views
0 votes
1 answer

ImportError: `load_weights` requires h5py.

Hi@akhtar, You are trying to use pre-created weight of ...READ MORE

answered May 18, 2020 in Machine Learning by MD
• 95,140 points
705 views
0 votes
1 answer
0 votes
1 answer

How to save CNN model in keras?

Hi@akhtar, You can save your CNN model in keras. For ...READ MORE

answered May 19, 2020 in Machine Learning by MD
• 95,140 points
550 views
0 votes
1 answer

How to load a model from an HDF5 file in Keras?

Hi@akhtar, If you stored the complete model, not ...READ MORE

answered Jul 14, 2020 in Machine Learning by MD
• 95,140 points
1,615 views
+1 vote
1 answer

How to load CNN model in keras?

Hi@akhtar, You can load your pre-created model in ...READ MORE

answered May 18, 2020 in Machine Learning by MD
• 95,140 points
587 views