The InvalidArgumentError has occurred because of stateful scikit-learn objects (MinMaxScaler, PolynomialFeatures) within your tf.data.Dataset generator, causing race conditions. To fix this, replace these with stateless TensorFlow operations or tf.py_function for robust, parallel processing. Please refer to this gist where I addressed the issue with dummy data.