ELMo-BiLSTM-CNN-CRF Training System

From GM-RKB
Jump to navigation Jump to search

An ELMo-BiLSTM-CNN-CRF Training System is a Deep Bidirectional LSTM-CNN Training System that uses ELMo Word Representation.

def create_elmo_embeddings(elmo, documents, max_sentences = 1000):

(...)

return embeddings, labels

elmo = ElmoEmbedder(cuda_device=1) #Set cuda_device to the ID of your GPU if you have one

train_x, train_y = create_elmo_embeddings(elmo, train_data, 1000)

test_x, test_y = create_elmo_embeddings(elmo, test_data, 1000)



References

2018a

2018b

2018c

Computing the embeddings once in the pre-processing significantly reduces the overall computational time. Otherwise, they would be computed for each epoch. However, this requires that enough memory is available, as our transformed dataset will constist of [math]\displaystyle{ \text{number_of_tokens} \cdot 1024 }[/math] float32 numbers.

Note: Our simple tokenization process ignores sentence boundaries and the complete document is fed as one single sentence to the ElmoEmbedder. As the ELMo embeddings are defined sentence wise, it would be better to first identify the sentences in a document and to process the document sentence by sentence to get the correct embeddings.