ichou1のブログ

主に音声認識、時々、データ分析のことを書く

XLNet

Kerasメモ(XLNet)その4

前回の続き。PositionalEmbeddingレイヤを見てみる。 keras_xlnet/xlnet.py def build_xlnet(...): ... pos_embed = PositionalEmbedding( output_dim=units, clamp_len=clamp_len, directional=attention_type == 'uni', name='Embed-Pos', )([token_embed,…

Kerasメモ(XLNet)その3

前回の続き。AttentionレイヤがBERTとどう変わるのか見てみる。 work-in-progress.hatenablog.com前々回のmodel.summaryの抜粋 model.summary Layer (type) Output Shape Param # Connected to ======================= ===================== ======== ====…

Kerasメモ(XLNet)その2

前回のつづき。Memoryレイヤについて確認してみる。このレイヤが生まれた背景となる問題点と、その利点については、Transformer-XLの論文で以下のとおり述べられている。問題点。 事前定義された長さを超えるコンテキストを扱えない。 As a consequence of t…

Kerasメモ(XLNet)その1

XLNetのKeras実装を試してみる。keras-xlnet · PyPIload_trained_model_from_checkpoint関数でpre-trainedモデルをロードする。 BaseとLargeの両方のモデルに対応。 cased_L-12_H-768_A-12 cased_L-24_H-1024_A-16 モデルの構成は、"in_train_phase"パラメー…