-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Advanced Natural Language Processing with TensorFlow 2
By :
Implementing a BiLSTM network with CRFs requires adding a CRF layer on top of the BiLSTM network developed above. However, a CRF is not a core part of the TensorFlow or Keras layers. It is available through the tensorflow_addons or tfa package. The first step is to install this package:
!pip install tensorflow_addons==0.11.2
There are many sub-packages, but the convenience functions for the CRF are in the tfa.text subpackage:
Figure 3.3: tfa.text methods
While low-level methods for implementing the CRF layer are provided, a high-level layer-like construct is not provided. The implementation of a CRF requires a custom layer, a loss function, and a training loop. Post training, we will look at how to implement a customized inference function that will use Viterbi decoding.
Similar to the flow above, there will be an embedding layer and a BiLSTM layer. The output of the BiLSTM needs...
Change the font size
Change margin width
Change background colour