Cell #UNQ_C2. Can't compile the student's code

Outograder keeps giving same error
ive beein trying to solve CNN week 2 lab and i am getting same error again and again even after fixing it . i tried rebooting and downloading -solving in vs code then uploading , it still giving same error despite that i passed all tests . error as follows .
“Cell #UNQ_C2. Can’t compile the student’s code. Error: SyntaxError(“unmatched ‘)’”, (‘/tmp/student_solution_cells/cell_16.py’, 36, 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 36
)
^
SyntaxError: unmatched ‘)’”
Reminder : theres no syntax error ive checked several times

  • coursera-platform

This problem has been encountered a lot recently. Here’s what the template code looks like that was given to you in the alpaca_model function:

### START CODE HERE
    
    base_model_path="imagenet_base_model/without_top_mobilenet_v2_weights_tf_dim_ordering_tf_kernels_1.0_160_no_top.h5"
    
    base_model = tf.keras.applications.MobileNetV2(input_shape=None,
                                                   include_top=None, # <== Important!!!!
                                                   weights=base_model_path)
    
    # freeze the base model by making it non trainable
    base_model.trainable = None

If when you fill in the code, you also rewrite it to look like this, then you’ll get that error from the grader:

### START CODE HERE
    
    base_model_path="imagenet_base_model/without_top_mobilenet_v2_weights_tf_dim_ordering_tf_kernels_1.0_160_no_top.h5"
    
    base_model = tf.keras.applications.MobileNetV2(input_shape=None,
                                                   include_top=None, # <== Important!!!!
                                                   weights=base_model_path
    )
    
    # freeze the base model by making it non trainable
    base_model.trainable = None

Please check your code and if you’ve done it that way, restore the close paren to be at the end of the previous line.

You’re right that your syntax is supported by python, but it causes problems for the grader and there’s no reason why you need to do it that way.

If that’s not what’s going on in your case, please let us know.

1 Like

solved my issue. thank you Paul

1 Like