Open BraidenKirkland opened 3 years ago
They show an example with the following example token which was trained using 5 epochs.
sample_tokens = vectorize_layer(["I have watched this [mask] and it was awesome"])
The masked sequence was {'input_text': 'i have watched this [mask] and it was awesome'}
Result: ['movie', 'film', 'was', 'is', 'series'] = [0.4759983, 0.18642229, 0.045611132, 0.028308254, 0.027862877]
This was the result after the 3rd epoch. See the link for the print out of results after each epoch. You can see the probability of 'movie' increase between each epoch.
This result makes sense, although I am surprised that 'was' and 'is' were predicted with higher probability than 'series'.
After this they fine-tuned the sentiment classification model by adding a pooling layer and a dense
layer on top of the pretrained BERT features. For optimization it looks like they used adam
with binary cross-entropy loss
and evaluated based on accuracy
.
optimizer = keras.optimizers.Adam()
classifer_model.compile(
optimizer=optimizer, loss="binary_crossentropy", metrics=["accuracy"]
)
Finally, they created an end-to-end model that accepts raw strings as its input.
I will use the structure in this article and the jupyter notebook example BERT Fine-Tuning Sentence Classification putting it here so I don't lose the link again
Thank you. I will take a look through those articles.
This paper proposes a new neural network architecture called the Transformer which is based solely on attention mechanisms. The result is a model of superior quality that requires much less training time because it allows for significantly less parallelization. This is an improvement over recurrent models which are constrained by sequential computation.
Structure of most neural sequence transduction models. X -> Encoder -> Z -> Decoder -> Y
BERT
Training
Two Phases
Pretraining Learns by training on two unsupervised tasks simultaneously. This steps helps BERT to understand bidirectional context within a sentence.
Fine Tuning How do we use language for a specific task?
BERT Video BERT Article Google Paper