Week4-Mistakes in Ungraded Lab One

Dear Sir or Madam,

There seems to be a mistake in the Ungraded Lab, and this is really confusing. This is when one implement a simplified version of efficient_attention.

Here is the error message.

<ipython-input-7-595686129cc1> in <module>
     16         dropout=0.0,
     17         rng=rng_attend,
---> 18         verbose=True,
     19     )
     20 print(o, "\n", logits)

<ipython-input-5-5e57c9b13d0e> in our_simple_attend(q, k, v, mask_fn, q_info, kv_info, dropout, rng, verbose, passthrough)
     46     dots = None
     47     if verbose:
---> 48         print("Our attend dots", dots.shape)
     50     # Masking

AttributeError: 'NoneType' object has no attribute 'shape'

I have also attached the code.

C4_W4_Ungraded_Lab_1_Reformer_LSH.ipynb (86.1 KB)

Hey @R_Wang,
In this ungraded lab, you have to get your hands dirty, unlike the previous ungraded labs :joy: There are instructions mentioned wherever you need to fill some code, for instance, in this case, above this code cell. I hope this helps.

P.S. - There is no need to use Sir/Mam. All the mentors here are also learners just like you.


1 Like

Hi @R_Wang,

As @Elemento, mentioned, there is missing code in the lab which you are expected to complete. Please read the instructions.

As a rule of thumb, whenever the error output mentions NoneType, it means that there was a None which was supposed to be replaced by some code. For example, the error you have shared above, if you trace it back, it is coming from here:

As you can see, you have to initialise the value for dots. And since, currently it is None, so later when dots.shape is used, since None has no shape, you get the above error, AttributeError: 'NoneType' object has no attribute 'shape'.

If you are unable to figure it out, at the end of every exercise you’ll see this option:
Screenshot 2023-02-14 at 1.41.54 PM

You can click that to reveal the correct code. Or if you want to attempt them, you can check your code against the expected output as well.


1 Like

Hi @Mubsi! I am really sorry for the stupid mistake. Previously I remember all the ungraded labs are actually completed.