Flair,NLP

Thumbnail of post image 197

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

BERT,Flair

Thumbnail of post image 168

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

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

Flair,Optuna,Python

Thumbnail of post image 174

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

Em ...

Flair,Python

Thumbnail of post image 042

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

Flair,Python

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

Flair,Python

Thumbnail of post image 166

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

Flair

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

Flair

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

Flair

Thumbnail of post image 074

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

Flair

Thumbnail of post image 197

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