Closed kerstenj closed 5 years ago
Had to change
def compute_output_shape(self, input_shape):
return (input_shape[0], self.output_size)
to
def compute_output_shape(self, input_shape):
return (input_shape[0][0], self.output_size)
I would like to use BERT for a multi-class multi-task classification. For each sentence (let's say with a fixed number of n tokens) to classify, BERT would (when I got it right) provide a vector of 768 elements, i.e., (n,768). When batches are involved, I would expect to have (None, n, 768). With keras-bert, I obtain ((None, n), 768). For feeding this tensor to keras' text YoonKimCNN, I have to add a further dimension here, but the nested structure remains, so that also the final layer have this ((None, n), m), even though I would expect to obtain (None,m) in the end. Structure:
This looks different from what we can see here. Any suggestions how to get rid of the nested structure are welcome.