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 15, 2020 in Machine Learning by akhtar
• 38,230 points
1,947 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 15, 2020 by MD
• 95,360 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
• 340 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 17, 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 17, 2020 in Machine Learning by MD
• 95,360 points
259 views
0 votes
1 answer

How to perform regression algorithm on a textual data(IMDB reviews)?

You can use either word2vec or tf-idf ...READ MORE

answered Mar 30 in Machine Learning by Dev
• 6,000 points
53 views
0 votes
1 answer

How to use ICD10 Code in a regression model in R?

Using the concept of comorbidities is a ...READ MORE

answered Apr 12 in Machine Learning by Dev
• 6,000 points
45 views
0 votes
1 answer
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,360 points
6,867 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,360 points
2,251 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,360 points
1,114 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,360 points
3,848 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,360 points
1,094 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP