Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise ValueError(f"Unrecognized data type: x={x} (of type {type(x)})") #456

Open
Danielrcnn opened this issue Oct 16, 2024 · 2 comments
Open

Comments

@Danielrcnn
Copy link

I've been having this problem for over a week. I was developing the algorithm on my laptop, but I had to switch computers, and now I'm getting this error. I'm also encountering the same error when using Google Colab. The algorithm used to work without any issues on my old computer.

The error occurs when running the model.fit cell.

history_Micro_0 = model.fit(loader_tr_Micro_0.load(), steps_per_epoch=loader_tr_Micro_0.steps_per_epoch, epochs=epocas, validation_data=loader_va_Micro_0.load(), validation_steps=loader_va_Micro_0.steps_per_epoch, callbacks=[callback], verbose=2)

{
"name": "ValueError",
"message": "Unrecognized data type: x=<spektral.data.loaders.BatchLoader object at 0x00000218FBD8DA90> (of type <class 'spektral.data.loaders.BatchLoader'>)",
"stack": "---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[16], line 1
----> 1 history_Micro_0 = model.fit(loader_tr_Micro_0.load(), steps_per_epoch=loader_tr_Micro_0.steps_per_epoch, epochs=epocas, validation_data=loader_va_Micro_0, validation_steps=loader_va_Micro_0.steps_per_epoch, callbacks=[callback], verbose=2)

File c:\Users\danie\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\utils\traceback_utils.py:122, in filter_traceback..error_handler(*args, **kwargs)
119 filtered_tb = _process_traceback_frames(e.traceback)
120 # To get the full stack trace, call:
121 # keras.config.disable_traceback_filtering()
--> 122 raise e.with_traceback(filtered_tb) from None
123 finally:
124 del filtered_tb

File c:\Users\danie\AppData\Local\Programs\Python\Python311\Lib\site-packages\keras\src\trainers\data_adapters\init.py:120, in get_data_adapter(x, y, sample_weight, batch_size, steps_per_epoch, shuffle, class_weight)
112 return GeneratorDataAdapter(x)
113 # TODO: should we warn or not?
114 # warnings.warn(
115 # "shuffle=True was passed, but will be ignored since the "
(...)
118 # )
119 else:
--> 120 raise ValueError(f"Unrecognized data type: x={x} (of type {type(x)})")

ValueError: Unrecognized data type: x=<spektral.data.loaders.BatchLoader object at 0x00000218FBD8DA90> (of type <class 'spektral.data.loaders.BatchLoader'>)"
}

@danielegrattarola
Copy link
Owner

Most likely, Spektral is not well supported by the new version of Keras.
Could you try downgrading to an older version and see if the problem persists?

@Danielrcnn
Copy link
Author

Hello, Daniele.

In fact, I downgraded some versions and it worked. Only Keras didn't work; I had to change the TensorFlow and Keras versions to 2.14.0.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants