Flair,NLP

Thumbnail of post image 128

NLPフレームワークのFlairでELMoの言語モデルを使おうとすると、from flair.embeddings import ELMoEmbeddingsをして関数を呼び出す必要があるのだが、allennlpがインストールされてい ...

BERT,Flair

Thumbnail of post image 113

Hugging FaceのTransformersを使って,事前学習済モデルを読み込んで推定させるとタイトルのようなエラーがでることがある.

このエラーはBERTにおけるトークン(サブワード)の最大長512を超えた文が入力 ...

Flair,Optuna,Python

Thumbnail of post image 179

とある仕事で,固有表現抽出器の性能をぎりぎりまで向上させる必要があったため,自作のコーパスに対してFlairでNERを学習し,Optunaでハイパーパラメータチューニングを行なった.本記事ではそのときのコードを示す.

Em ...

Flair,Python

Thumbnail of post image 003

FlairでNERを実施した際,training.logというのが出力されるのだが,これにはmicro F1は載っているが,micro recallとprecisionは載っていない.このため,ログファイルからTP, FP, FNを読 ...

Flair,Python

Thumbnail of post image 020
from flair.data import Corpusfrom flair.datasets import ColumnCorpusfrom flair.models import SequenceTaggerfrom flair.tr ...

Flair,Python

Thumbnail of post image 138

“””
Trains any class that implements the flair.nn.Model interface.
:param base_path: Main p ...

Flair

Thumbnail of post image 102
from flair.data import Sentencefrom flair.embeddings import CharacterEmbeddings# init embeddingembedding = CharacterEmbe ...

Flair

Thumbnail of post image 105
from flair.data import Corpusfrom flair.embeddings import TokenEmbeddings, WordEmbeddings, StackedEmbeddingsfrom flair.d ...

Flair

Thumbnail of post image 184

datapath = "/path/to/BIO" # train.tsv, test.tsv, devel.tsvが入っているフォルダcorpus: Corpus = loadCorpus(datapath)tag_type = "ner ...

Flair

Thumbnail of post image 160

from flair.embeddings import ELMoEmbeddingsfrom flair.data import Sentence# ELMoのモデルは各自で用意options = '/home/ubuntu/elmo-e ...