Error: TypeError("__init__() missing 2 required positional arguments: 'op' and 'message'",)

I am able to run the complete notebook including the optional evaluation step.
However, my grader is failing with this-
Cell #3. Can’t compile the student’s code. Error: TypeError(“init() missing 2 required positional arguments: ‘op’ and ‘message’”,)

Any clues?

5 Likes

This error means that you instantiate a class you should provide 2 parameters to create the object.

Yes, thanks for the clarification and I understand the error.

What I am not able to figure is that how is my code causing this specially when I am able to run the notebook end-to-end without any errors.

Is there any way to debug this?
Or, just reset the notebook?

1 Like

I tried to use the force_refresh=True method to update (and then delete) the notebook hoping that it will get refreshed in the next iteration but it is gone and I am getting a 404 now. :upside_down_face:

Can you please help me get back my notebook?

1 Like

It should not happen, try again and if its still a pro lem you should contact coursera, they manage that system.

thanks - will do.

Can you confirm something?
There is an ID in my lab url between these 2 parts of the url-
Coursera | Online Courses & Credentials From Top Educators. Join for Free | Coursera
+
“/[ID]/”
+
“/tfds-with-rock-paper-and-scissors/lab?path=%2Fnotebooks%2FTFDS-V2-Week1.ipynb”

Is that a unique id for me?

I dont have access to any of coursera’s mediums at all!

I was able to recover the file by uploading it again. Thanks for your patience with that.

I am still seeing the original problem and I am able to identify that it happening here-
train_data = tfds.load(…)
val_data = tfds.load(…)

After some google search, this seems to be a problem with TFDS version 3.2.0 as outlined here-

The code is running fine in the jupyter notebook but it is the grader that throws the error.
I was able to confirm that the notebook runtime is using TFDS version 3.2.1 (which doesn’t have the problem).

How can I check which version of TFDS is used by the grader?
or, can you check that for me? if it is using 3.2.0, that would explain the problem and we need to either upgrade or downgrade that.

Thanks.

I dont have access to this particular specialization neither have a I done it myself but if you believe the problem is there you can do the following:

!pip install tensorflow_datasets==3.2.1

to change the installed version on the notebook and this command to check the version installed:

tfds.__version__

@gent.spah - thanks for the suggestion.
I was able to test that the live notebook is running with version 3.2.1 of TFDS by dumping the version. My notebook is working fine on the live system (jupyter).

I am not sure how to find the TFDS version number for the offline grading system as I don’t have any access to that except for the “submit” button. Also, it is the grader that is throwing the init() error which makes me suspicious that it has the wrong TDFS version.

Given that nobody else has complained about this, I also feel that it must be me who is doing something wrong here. Can you confirm if others were able to complete this lab without any errors?

Thanks.

1 Like

!pip install tensorflow_datasets==3.2.1
I can do this on the jupyter terminal but it already has 3.2.1 installed.

I want to figure the version number for the grader system and upgrade it, if possible.

1 Like

I was finally able to get this to work by specifying the data_dir parameter while using tfds.load()

It shouldn’t be this hard though to get through this lab.
I still believe that the grader is running a different version of TDFS compared to the online version and that made it so much harder to debug stuff. It would be nice if someone can look into this and fix the version mismatch so others wouldn’t have to face the same issue.

Thanks again for all the help, @gent.spah

4 Likes

I am glad you sorted it out, I haven’t heard anyone else had this problem!

Facing the same issue, but i was already using data_dir so that does not look to be the key change that makes it pass

Asked for support but did not get anything yet.

Any clues on how to get a fuller output from the grader anyo ne ?

2 Likes

@Olivier_van_de_Wiel, can you check that all tfds.load calls have data_dir parameter passed?

I was finally able to get this to work by specifying the data_dir parameter while using tfds.load()

1 Like

@yurij , I have the same issue but adding data_dir parameter does not solve the problem in my case.
Do you have any suggestion?

2 Likes

Getting the same errors even after attempting said solutions.

2 Likes

I faced the same issue even after using data_dir parameter. Using the variable defined above (instead of the actual path) solved it for me.

Also, the grader graded within 3 minutes compared to the 10+ minutes it took earlier.

2 Likes

Same here. Added data_dir, but that didn’t solve it

1 Like

Does anyone know a solution to this one?

1 Like