Flairで自前のELMoモデルを読み込む方法[Flair]

7月 26, 2020

    from flair.embeddings import ELMoEmbeddings
from flair.data import Sentence
sentence = Sentence(phrase)
# Preparating ELMo
options = './elmo_options.json'
weights = './elmo_weights.hdf5'
embedding = ELMoEmbeddings('custom', options_file = options, weight_file = weights)
embedding.embed(sentence)

Flair

Posted by vastee