Grader can't import package used in course-provided code

I completed the cats vs. dogs assignment and achieved 97.29% training accuracy with an 85.96% validation accuracy by the 15th epoch. However, when I submitted, I got the following error with my submission:

There was a problem compiling the code from your notebook. Details:
No module named 'keras.optimizers.legacy'; 'keras.optimizers' is not a package

I believe the objectionable code was:

from keras.optimizers.legacy.rmsprop import RMSProp

I also tried a variation that didn’t depend upon the legacy package -

from keras.optimizers.rmsprop import RMSprop as RMSProp

and this time got a final result of training accuracy: 99.31% and validation accuracy of 86.96%. But still received the same error from the grader (this was, perhaps, predictable, since I was still treating keras.optimizers as a package).

However, the original import statement:

from keras.optimizers.legacy.rmsprop import RMSProp
was supplied as part of the project.

How should I compensate for the fact that the grading software can’t seem to perform that import, even though it works when I run in the given Colab environment?

Grader Result:

Output from Colab:

Can you send me the code for


GRADED FUNCTION: create_model

def create_model():

via personal DM. Click on my name and then message.

Probably the optimizer or the class_mode might be creating this error. or better share your notebook, so that I can see why your grader must have failed.

Based on orignial import cell
only has these two packages related tensorflow and keras

import tensorflow as tf

from tensorflow.keras.preprocessing.image import ImageDataGenerator

Where did you find those two packages in your assignment. Can you share the screenshot??

To be more direct I would suggest you to go back and check these grader cells where you can modify or look into your codes to pass the grader assessment.

Probably one of the grader cell is not passing the grader as per the grader assessment.

Please see this reply regarding the tensorflow version used by the grader.

Use this: from tensorflow.keras.optimizers import RMSprop