Text classification with Transformer - Keras
keras.io › text_classification_with_transformerMay 10, 2020 · Transformer layer outputs one vector for each time step of our input sequence. Here, we take the mean across all time steps and use a feed forward network on top of it to classify text. embed_dim = 32 # Embedding size for each token num_heads = 2 # Number of attention heads ff_dim = 32 # Hidden layer size in feed forward network inside transformer inputs = layers .
tensorflow - How to use Transformers for text classification ...
stackoverflow.com › questions › 58123393Sep 26, 2019 · For more details, you can go through the article: http://jalammar.github.io/illustrated-transformer/ How to use this transformer for text classification - Since in text classification our output is a single number not a sequence of numbers or vectors so we can remove the decoder part and just use the encoder part. The output of the encoder is a set of vectors, the same in number as the number of words in the input sentence.