I want to add additional Dense layer after pretrained TFDistilBertModel, TFXLNetModel and TFRobertaModel Huggingface models. I have already seen how I can do this with the TFBertModel, e.g. in this notebook:
output = bert_model([input_ids,attention_masks])
output = output[1]
output = tf.keras.layers.Dense(32,activation='relu')(output)
So, here I need to use the second item(i.e. item with index 1) of the BERT output tuple. According to the docs TFBertModel has pooler_output at this tuple index. But the other three models don't have pooler_output.
So, how can I add additional layers to the other three model outputs?