I also faced the similar problem and though @soundaryasundari’s solution helped a little bit, it is not complete. So, I thought I should share mine.
First, we need to convert the DatasetDict Object to Pandas DataFrame. For that, dataset.set_format() and dataset.with_format() should work. But unfortunately, they don’t. We need to manually convert them as follows:
#Convert the dataset to DataFrame
pd_data = pd.DataFrame(dataset["train"])
#Now, convert it back to the DatasetDict object
from datasets import Dataset
ds_data = Dataset.from_pandas(pd_data)
Now, it can be converted to tf.data object.