Ways to Speed Up Training on Local Environment


I was doing the second PA of week 2. Though the writeup says the training process will take about 5 minutes, it took my MacBook Pro M1 5 minutes to run the first 100 epochs. I guess it’s the difference between CPU and GPU? Are there any ways where I can train on GPU with local environment? Thanks!

Another question: for section 2.4, there is one line of code in the unit test:
assert type(model) == Functional, "Make sure you have correctly created Model instance which converts \"sentence_indices\" into \"X\"".

As I print the type of the model, it gives me <class 'keras.src.engine.functional.Functional'>. Therefore, I think the assert will always fail. I commented this line out and I passed all other tests. The autograder also gives me 100/100.

I am away from my computer to experience this. Maybe other mentor will comment on this.

Are you referring to your local environment or Coursera environment?

Thanks for your reply!

I ran the model with my computer and it took me 20 minutes to finish 400 default iterations. I tried on Coursera environment and it’s also taking 5+ minutes to run the first 100 iterations.

I noticed the accuracy increased to 96.2% after 100 epochs and achieved 100% after 200 epochs, so I assume it’s not the environment issue, but the default number of iterations was accidentally modified? Anyway, a more general question is if we can train models more efficiently locally. Thank you!

Some ideas on distribution strategies you can explore here:

Let us know what you find?