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,260 points
3,333 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.

Ready to dive into the world of machine learning? Supercharge your career and join our comprehensive Machine Learning Course today!

answered Jul 15, 2020 by MD
• 95,460 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.
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,460 points
800 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, 2022 in Machine Learning by Dev
• 6,000 points
544 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, 2022 in Machine Learning by Dev
• 6,000 points
630 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,460 points
14,099 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,460 points
4,931 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,460 points
1,957 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,460 points
6,360 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,460 points
1,902 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP