バッチサイズ
· ☕ 1 min read
バッチサイズが大きいと, 入力パラメタが平均化されるので, 個々のデータの特徴が失われる可能性がある かといって, バッチサイズが小さい方が良いというわけでもなく, 学習率とバッチサイズをうまく調整する必要がある Don’t Decay the Learning Rate, Increase the Batch Size https://arxiv.org/abs/1711.00489 This procedure is successful for stochastic gradient descent (SGD), SGD with momentum, Nesterov momentum, and Adam ノイズスケール $g$には $g = \epsilon(\frac{N}{B}-1)$ という関係がある Nはサンプル数, Bは ...

【論文メモ】ViLBERT
· ☕ 1 min read
BERT同様, 転移学習モデル なので, IMGトークンやCLSトークンを導入する 画像の埋め込みはどういう実装…? 例えばViTだと, 普通に行列 $E$を掛け合わせている or ResNetを用いる (これをハイブリット方式と呼ぶ) 各パッチをEで埋め込み、CLSトークンを連結したのち、位置エンコーディングEposを加算して ...


Focal Loss
· ☕ 1 min read
局在損失 うまく識別できているクラスは軽視 現時点で識別に苦労しているクラスを重視 ...

シード42
· ☕ 1 min read
なぜシードは42が使われるのか? ダグラス・アダムスのSF小説「銀河ヒッチハイク・ガイド」に由来 Seven and a half million years later…. Fook and Lunkwill are long gone, but their descendants continue what they started “All right,” said Deep Thought. “The Answer to the Great Question…” “Yes..!” “Of Life, the Universe and Everything…” said Deep Thought. “Yes…!” “Is…” said Deep Thought, and paused. “Yes…!” “ ...

Transformer
· ☕ 3 min read
encoder: self-attention → feed-forward NN decoder: self-atteiont → multi-head attention → feed-forward NN self-attention K,V,Qをsource内部で学習 attention K,V,Qをsource-target間で学習 multi-head 各単語ごとにK,V,Qを計算するのではなく, ヘッドの数だけ小さいK,V,Qを計算してconcat. 出力時に重みWをかけて次元を調整 学習対象は各ヘッドの重みW_Q, W_K, W_V と出力W_O attention機構自体には ...


BERT
· ☕ 1 min read
BERTの新規性はMasked LM(事前学習タスク) 事前に行うタスク=「事前学習タスク(pre-training task)」 解きたかったタスク=「下流タスク(downstream task)」 渡されたパラメータを下流タスクの学習の際に固定するかしないか 固定するなら「特徴量ベースのアプローチ」 固定されたパラメータを持つモデ ...

PyTorchとメモリ
· ☕ 1 min read
必要なメモリ量 必要メモリ量(byte) = (ニューロンの数 × Batch Size + パラメータ数) × 2 (data & grad) × 4(byte) https://nori-life-log.com/nnの学習で必要なgpuメモリを算出する 重みを固定(freeze) 1 2 3 # freeze all layers for param in model.parameters(): param.requires_grad = False ...

np.float32
· ☕ 1 min read
pythonのfloatはCでいうdouble np.float32はCのfloatと同じ 一方, np.float64はpythonのfloat float in Py == double in C == np.float64 == 8バイト np.float32 === float in C == 4バイト ...