Open justinvyu opened 1 year ago
Actually, this was a result of me calling len(ray_ds.to_tf(...)), not model.fit. Maybe we could set the cardinality of the tf dataset to the ray_ds.count() in to_tf?
@justinvyu this is expected since the tensorflow dataset is created from a generator. Calculating the length would require iterating through the entire dataset. See https://discuss.tensorflow.org/t/typeerror-dataset-length-is-unknown-tensorflow/948/2 for more info.
It is recommended to use dataset.count()
beforehand which can return the count from metadata, without executing it.
What is the use case?
What happened + What you expected to happen
Converting a Ray dataset to a
tf.data.Dataset
throughray_ds.to_tf(...)
, then passing it into a Kerasmodel.fit()
runs into an error.Workaround
Versions / Dependencies
2.3.0
Reproduction script
Issue Severity
Medium: It is a significant difficulty but I can work around it.