C1_W1_Lab04 Overflow Error

I downloaded the files for the code for C1_W1_Lab04 Gradient_Descent_Soln.ipynb
In Coursera’s onlye Jupyter notebook runtime environment everything works fine, but in my local computer I get this error. Can someone explain why this is? I am using a 1 year old Acer laptop, 16G ram, 64bit architecture, Windows 11. Thanks.

Hi @blabla
Welcome to the Community!

Personally it’s the first time to face this issue but I search about it and found that the error raise once your numbers are greater than sys.maxsize in this post the solution


I suspect you have an incompatible set of tool versions.

There are instructions in the FAQ for setting up the notebook for local use.

See item C.4.

thank you for your help.

were you able to resolve this? I am facing the same issue. I am guessing that dtype=np.int64 needs to be added for one of the arrays defined in plt_divergence in lab_utils_uni, but I haven’t figured out which one yet.

UPDATE: please disregard, I figured out what needed updating.

Hey, what was that update you did as I am facing the same problem. @Haluin

Hi @Jeevesh_Banchhor , in lab_utils_uni.py I added the dtype on the following lines:

301 cost = np.zeros_like(w_array, dtype=np.int64)
319 z=np.zeros_like(tmp_b, dtype=np.int64)

Glad you answered, it really helped and solved my problem.