I’m trying to use a generator- based data set:
def gen():
    return zip(samples,feature)
ds = tf.data.Dataset.from_generator(gen,output_types=tf.dtypes.float32)


model.fit(ds,
          epochs=150,
          #callbacks=[tensorboard_callback]
          )
model.save("/sda/anyone/imagenet-in-np/transformer")

whereas feature is  numpy.ndarray (2D array)
whereas feature is  numpy.ndarray (4D array)
And I get the following error:
TypeError: Target data is missing. Your model has `loss`: BinaryCrossentropy, and therefore expects target data to be passed in `fit()`.

which is strange, as the target data is actually present.
Whenever I separate the dataset to two
def gen():
    return samples
ds = tf.data.Dataset.from_generator(gen,output_types=tf.dtypes.float32)

def gen2():
    return feature
ds2= tf.data.Dataset.from_generator(gen2,output_types=tf.dtypes.float32)

model.fit(ds,ds2,
          epochs=150,
          #callbacks=[tensorboard_callback]
          )
model.save("/sda/anyone/imagenet-in-np/transformer")

I get:
    raise ValueError("`y` argument is not supported when using "
ValueError: `y` argument is not supported when using dataset as input.

Which means that TF doesn’t accept this split.
I tried
def gen():
    for element in zip(samples,feature):
        yield element
ds = tf.data.Dataset.from_generator(gen(),output_types=tf.dtypes.float32)

I get
TypeError: generator must be a Python callable.
So I tried to swap it to :
def gen():
    for element in zip(samples,feature):
        yield element
ds = tf.data.Dataset.from_generator(gen,output_types=tf.dtypes.float32)

I get again:
    TypeError: Target data is missing. Your model has `loss`: BinaryCrossentropy, and therefore expects target data to be passed in `fit()`.
python-BaseException

So how should I use the generator API?