Assignment for week 4: ValueError: Failed to find data adapter that can handle input:

After running:

hist = train_happy_sad_model(gen)

I get the following:


ValueError Traceback (most recent call last)
in
----> 1 hist = train_happy_sad_model(gen)

in train_happy_sad_model(train_generator)
34 # Your model should achieve the desired accuracy in less than 15 epochs.
35 # You can hardcode up to 20 epochs in the function below but the callback should trigger before 15.
—> 36 history = model.fit(x=train_happy_sad_model,
37 steps_per_epoch=8,
38 epochs=20,

/opt/conda/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.traceback)
—> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb

/opt/conda/lib/python3.8/site-packages/keras/engine/data_adapter.py in select_data_adapter(x, y)
986 if not adapter_cls:
987 # TODO(scottzhu): This should be a less implementation-specific error.
→ 988 raise ValueError(
989 "Failed to find data adapter that can handle "
990 “input: {}, {}”.format(

ValueError: Failed to find data adapter that can handle input: <class ‘function’>, <class ‘NoneType’>

Any ideas what the issue could be?

The error is here: history = model.fit(x=train_happy_sad_model.

Please fit the model using the generator. Using a function as x does no good.

@balaji.ambresh, great, thanks, I’ll try it!