Mobilenet v2 issues

Cell #UNQ_C2. Can't compile the student's code. Error: SyntaxError("unmatched ')'", ('/tmp/student_solution_cells/cell_16.py', 39, 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 "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 839, in exec_module
  File "<frozen importlib._bootstrap_external>", line 976, in get_code
  File "<frozen importlib._bootstrap_external>", line 906, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmp/student_solution_cells/cell_16.py", line 39
    )
    ^
SyntaxError: unmatched ')'

{edited by mentor}
but the code works perfectly fine

Hello, @Yashjhota,

If you could run the 16th cell without any error reported, it could be that the autograder was looking at an earlier version of your assignment. I suggest you to try the notebook’s save button and then make another submission.

Cheers,
Raymond

PS: we shouldn’t share our work publicly, but please don’t worry as I am going to remove it for you. :wink:

2 Likes

Note that you cannot grade a notebook that has been renamed.

1 Like

Here’s the template code that was given to you in alpaca_model:

base_model = tf.keras.applications.MobileNetV2(input_shape=None,
                                                   include_top=None, # <== Important!!!!
                                                   weights=base_model_path)

When you filled in the required parts, you also changed the close paren to be the equivalent of this (without your other changes):

base_model = tf.keras.applications.MobileNetV2(input_shape=None,
                                                   include_top=None, # <== Important!!!!
                                                   weights=base_model_path
)

That is legal python syntax, but it confuses the grader for some reason.

Also note that you added a bunch of unnecessary “import” statements. I don’t think those cause any problems, but they are a mistake. If something shows as not imported, that means you forgot to run the earlier cells in the notebook. You need to do that every time you restart or reopen the notebook.

1 Like

Note that the cell numbers in the grader feedback typically do not refer to the student’s notebook. They refer to a notebook that the grader uses to test the learner’s code.

For the record, recently another student had a similar issue with this assignment. In that case it was due to the single ‘)’ being indented to align below the function parameters.

In that case, the error was regarding “unexpected indent”, instead of “unmatched )”.

It appears the grader does not correctly handle a close-paren that is preceded by whitespace.

Sir Very Very Thanks for helping me so smartly

1 Like