C3 W2 A2: I got an error after submitting my assignment

Hi,
After submitting “Deep Learning for Content-Based Filtering” , I got these errors:
you can find the code block down below

{moderator edit: code removed}

Cell #UNQ_C1. Can’t compile the student’s code. Error: NameError(“name ‘Model’ is not defined”)
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.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/tmp/student_solution_cells/cell_10.py”, line 47, in
model = Model([input_user, input_item], output)
NameError: name ‘Model’ is not defined

I believe you may have modified the model = Model(...) line.
Try using tf.keras.Model(...) intead.

1 Like

Also, please in the future do not post your code on the forum. That’s not allowed by the Code of Conduct.

If a mentor needs to see your code, we will contact you with instructions.

You can post your error messages or asserts, that’s fine. Please use a screen capture image for that (instead of a text copy-and-paste).

1 Like

It still gets error!!!
what should I do?

When you run all of the cells in the notebook, does your code pass all of the tests, and give all of the expected results, without throwing any errors or asserts?

yes!
I can run it without any errors but after submitting, I get the errors below:

Cell #16. Can’t compile the student’s code. Error: TypeError(“predict_uservec() got an unexpected keyword argument ‘scaledata’”)
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.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/tmp/student_solution_cells/cell_16.py”, line 23, in
scaler, scalerUser, scalerItem, scaledata=scaledata)
TypeError: predict_uservec() got an unexpected keyword argument ‘scaledata’

Does your notebook use the word “scaledata”?

yes

Check whether you are using the current version of the notebook.