TFBertModel ValueError: Tried to convert 'dims' to a tensor and failed. Error: Cannot convert a partially known TensorShape to a Tensor
The code below was fine when transformers 2.1.1

but after I update to transformers 2.2.0
```
model = TFBertForSequenceClassification.from_pretrained('bert-base-chinese', num_labels=5)
model.summary()

optimizer = tf.keras.optimizers.Adam(learning_rate=3e-5, epsilon=1e-08, clipnorm=1.0)
loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
metric = tf.keras.metrics.SparseCategoricalAccuracy('accuracy')
model.compile(optimizer=optimizer, loss=loss, metrics=[metric])

model_fit = model.fit(train_input_ids, train_label, 
                      batch_size=8, epochs=1, 
                    validation_data=(validation_input_ids, validation_label)
                   )
```
```
ValueError: Tried to convert 'dims' to a tensor and failed. 
Error: Cannot convert a partially known TensorShape to a Tensor: (None, 512)
```
> The code below was fine when transformers 2.1.1
> 
> but after I update to transformers 2.2.0
> 
> ```
> model = TFBertForSequenceClassification.from_pretrained('bert-base-chinese', num_labels=5)
> model.summary()
> 
> optimizer = tf.keras.optimizers.Adam(learning_rate=3e-5, epsilon=1e-08, clipnorm=1.0)
> loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
> metric = tf.keras.metrics.SparseCategoricalAccuracy('accuracy')
> model.compile(optimizer=optimizer, loss=loss, metrics=[metric])
> 
> model_fit = model.fit(train_input_ids, train_label, 
>                       batch_size=8, epochs=1, 
>                     validation_data=(validation_input_ids, validation_label)
>                    )
> ```
> 
> ```
> ValueError: Tried to convert 'dims' to a tensor and failed. 
> Error: Cannot convert a partially known TensorShape to a Tensor: (None, 512)
> ```

The problem seem to cause by  input's shape.

For transformers 2.2.0
I fix it myself by modifying file "transformers/modeling_tf_albert.py"
On line 648, I change:
input_shape = input_ids.shape
Into:
input_shape = tf.shape(input_ids)
Then the problem fixed.

Feel free to leave a comment if it work for you.<|||||>@billpku 
Sorry to test it so lately.

It did fix my problem above.
but it didn't fix the code below which worked fine in 2.1.1 for custom the layer.

```
input_layer = Input(shape = (512,), dtype='int64') 
bert = TFBertModel.from_pretrained('bert-base-chinese')(input_layer)
bert = bert[0]     
dropout = Dropout(0.1)(bert)
flat = Flatten()(dropout)
classifier = Dense(units=5)(flat)                
model = Model(inputs=input_layer, outputs=classifier)
model.summary()
```
```
ValueError: Tried to convert 'dims' to a tensor and failed. 
Error: Cannot convert a partially known TensorShape to a Tensor: (None, 512)
```<|||||>Facing the same issue here.

![Screenshot 2019-12-02 at 4 44 02 PM](https://user-images.githubusercontent.com/30196810/69955180-10e98700-1523-11ea-9002-f78ea0d58c78.png)
<|||||>@AmalVijayan 
I just checked my problem was fixed somehow.

How's yours now?


> ```
> input_layer = Input(shape = (512,), dtype='int64') 
> bert = TFBertModel.from_pretrained('bert-base-chinese')(input_layer)
> bert = bert[0]     
> dropout = Dropout(0.1)(bert)
> flat = Flatten()(dropout)
> classifier = Dense(units=5)(flat)                
> model = Model(inputs=input_layer, outputs=classifier)
> model.summary()
> ```

