

TITLE
error while finetuning for Regression task.

COMMENTS
5

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
Hi I was trying to perform finetuning regression task . below is my network.

```
from transformers import TFBertForSequenceClassification
# model initialization
base_model = TFBertForSequenceClassification.from_pretrained('bert-base-uncased')
base_model.bert.trainable=False
model=tf.keras.Sequential(base_model)
model.add(tf.keras.Input(shape=[720895,7],name='Input_1'))
model.add(tf.keras.layers.Dense(1,activation='linear'))
optimizer = tf.keras.optimizers.RMSprop(learning_rate=1e-4)

model.compile(loss='mse',
                  optimizer=optimizer,
                  metrics=['mae', 'mse'])
model.fit(train_seq,train_labels,epochs=10)
```
error is 

`
    TypeError: Failed to convert 'TFSequenceClassifierOutput(loss=None, logits=TensorShape([None, 2]), hidden_states=None, attentions=None)' to a shape: ''logits''could not be converted to a dimension. A shape should either be single dimension (e.g. 10), or an iterable of dimensions (e.g. [1, 10, None]).`


Can you please help me with this.