# C2W2\_Assignment execution is too long

**URL:** <https://community.deeplearning.ai/t/c2w2-assignment-execution-is-too-long/395641>\
**Category:** Convolutional Neural Networks in TensorFlow\
**Tags:** week-module-2\
**Created:** [July 24, 2023, 3:50pm UTC](https://community.deeplearning.ai/t/c2w2-assignment-execution-is-too-long/395641 "2023-07-24T15:50:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![YevhenH](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@YevhenH](https://community.deeplearning.ai/u/YevhenH)\
**Post date:** [July 24, 2023, 3:50pm UTC](https://community.deeplearning.ai/t/c2w2-assignment-execution-is-too-long/395641/1 "2023-07-24T15:50:02Z")

</div>

Hi all  
Could you help me to identify why my model.fit runs too long. 15 epochs run in 4+ hours in colab.  
I’m not sure if it’s ok.  
Thanks

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [July 24, 2023, 8:26pm UTC](https://community.deeplearning.ai/t/c2w2-assignment-execution-is-too-long/395641/2 "2023-07-24T20:26:02Z")

</div>

Is the runtime set to GPU?

Runtime \> Change runtime type  
 ![image](https://global.discourse-cdn.com/dlai/original/3X/8/5/85921859933fc6fe81de967f5b7c94f7cd499b6a.png)

---

<div class="post-metadata">

**Author:** ![YevhenH](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@YevhenH](https://community.deeplearning.ai/u/YevhenH)\
**Post date:** [July 24, 2023, 8:51pm UTC](https://community.deeplearning.ai/t/c2w2-assignment-execution-is-too-long/395641/3 "2023-07-24T20:51:10Z")

</div>

It’s GPU already ((

 ![image](https://global.discourse-cdn.com/dlai/original/3X/a/0/a0745b6ac79da43b39b9f46fccc6638167b507f3.png)

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [July 25, 2023, 11:53am UTC](https://community.deeplearning.ai/t/c2w2-assignment-execution-is-too-long/395641/4 "2023-07-25T11:53:08Z")

</div>

Please click my name and message your notebook as an attachment.

---

<div class="post-metadata">

**Author:** ![balaji.ambresh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/balaji.ambresh/32/128697_2.png) [@balaji.ambresh](https://community.deeplearning.ai/u/balaji.ambresh)\
**Post date:** [July 25, 2023, 5:28pm UTC](https://community.deeplearning.ai/t/c2w2-assignment-execution-is-too-long/395641/5 "2023-07-25T17:28:11Z")

</div>

Here are a couple of tips to make the training faster:

1. Change network architecture. Remember that the number of parameters of Conv2D layers orders of magnitude lower than the dense layer that follows a flatten layer.
2. Leave the batch size at the default value i.e. 32 when possible. When GPU doesn’t have enough memory for training the dataset i.e. out of memory error is raised, reduce batch size to smaller values.
3. Read [this](https://community.deeplearning.ai/t/training-accuracy-86-validation-94-required-training-accuracy-99-validation-accuracy-95/356763) topic.
4. Although time per epoch is unaffected by choice of learning rate, convergence of the model is influenced by this parameter. Values lower than 1e-3 better be tested on the dataset before using them as your final choice. Consider taking `deep learning specialization` to learn more about tuning the learning rate.
5. Change the GPU allocated for you if you find the performance unacceptable. Execute `!nvidia-smi` on a notebook cell to find the compute capability of the GPU.

---

<div class="post-metadata">

**Author:** ![YevhenH](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@YevhenH](https://community.deeplearning.ai/u/YevhenH)\
**Post date:** [July 25, 2023, 6:22pm UTC](https://community.deeplearning.ai/t/c2w2-assignment-execution-is-too-long/395641/6 "2023-07-25T18:22:51Z")

</div>

Thanks for recomendations
