adapt() makes a Keras preprocessing layer learn data-dependent state from input data. For TextVectorization, it iterates over a dataset to learn its vocabulary before encoding text. section 14.4.1
Learning an IMDb vocabulary
Create a TextVectorization layer with a 20,000-word limit, remove labels from the training dataset, and call adapt(text_vectorization, train_ds_no_labels). Apply the adapted layer to training, validation, and test datasets to produce multi-hot vectors. section 14.4.1
