Flair,NLP

Thumbnail of post image 063

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

BERT,Flair

Thumbnail of post image 106

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

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

Flair,Optuna,Python

Thumbnail of post image 050

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

Em ...

Flair,Python

Thumbnail of post image 035

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

Flair,Python

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

Flair,Python

Thumbnail of post image 196

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

Flair

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

Flair

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

Flair

Thumbnail of post image 126

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

Flair

Thumbnail of post image 131

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