How to solve the error when my all the code test are passed, but when I submit, in the grade section it throws error.

I have enrolled in Deep Learning course by Andrew Ng. In Convolutional Neural Network course in week 2. I have passed all the tests in the lab notebook but when I submit it, in the grade section it gives an error and I am unable to submit it. In the grader output it shows error:

Cell [#UNQ_C2](javascript:void(0);). Can’t compile the student’s code. Error: SyntaxError(“unmatched ‘)’”, (‘/tmp/student_solution_cells/cell_16.py’, 40, 5, ’ )'))

Traceback (most recent call last):

File “/home/www/app/grading/exceptions.py”, line 112, in handle_solution_errors

yield {}

File “/home/www/app/grading/abstract.py”, line 393, in _grade

context = compiled_code.run(cell_index=cell.index)

File “/home/www/app/grading/submission/compiled_code.py”, line 195, in run

return list(self._code_items.values())[cell_num - 1].run()

File “/home/www/app/grading/submission/compiled_code.py”, line 54, in run

return import_module(self.import_statement, items)

File “/usr/local/lib/python3.8/importlib/init.py”, line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File “”, line 1014, in _gcd_import

File “”, line 991, in _find_and_load

File “”, line 975, in _find_and_load_unlocked

File “”, line 671, in _load_unlocked

File “”, line 839, in exec_module

File “”, line 976, in get_code

File “”, line 906, in source_to_code

File “”, line 219, in _call_with_frames_removed

File “/tmp/student_solution_cells/cell_16.py”, line 40

)

^

SyntaxError: unmatched ‘)’

But there is no parenthesis error in the code. And even while running the code it isn’t throwing any error.

Hi @Garv.it

Please take a look at these similar posts:

If your problem remains unsolved, you can share your notebook with me, so we can look for possible issues together!

Hope it helps!

Something in your notebook has broken the grader. Likely it has been modified in an unintended manner. For example, using a different platform to modify the notebook, deleting or adding cells, modifying the notebook metadata, etc.

I recommend you delete your notebook and get a fresh copy and start over. That’s the simplest way to proceed. Debugging grader issues is very difficult.

Does anyone know how to solve this problem?
I’ve tried resetting the kernels, downloading a copy and reloading it and nothing. And I don’t know what else to try

@MG03000, what is the detailed feedback you get from the grader? Please post a screen capture image.

Hi @TMosh!!, I have already solved the problem, it turns out that I had a part of the alpaca model function wrong, but the grader was passing the tests.
Thank you very much for your attention and help
Best regards
Mario

Can you forward me an image that shows the part of the code that was wrong? I’d like to improve the tests to catch whatever the error was.

[quote=“TMosh, post:7, topic:722920, full:true”]
Can you forward me an image that shows the part of the code that was wrong? I’d like to improve the tests to catch whatever the error was.
[/quote] Hi @TMosh sorry for the delay in replying to the message, I hadn’t seen it. I can’t send you the exact screenshot of the error but I can send you the part of the code that produced it, which is the following:

GRADED FUNCTION: data_augmenter

def data_augmenter():
‘’’
Create a Sequential model composed of 2 layers for data augmentation:
- Random horizontal flipping
- Random rotation
Returns:
tf.keras.Sequential
‘’’
data_augmentation = tf.keras.Sequential([
RandomFlip(‘horizontal’), # Flip images horizontally
RandomRotation(0.2) # Randomly rotate images by 20%
])

return data_augmentation

I hope you find it helpful,
best regards and
happy new year.
Mario