CNNのPytorch実装
![person holding apple keyboard](https://i0.wp.com/vasteelab.com/wp-content/uploads/2022/06/pexels-photo.jpg?resize=150%2C150&ssl=1)
PyTorchを使用したCNNの実装は、以下の手順で行うことができます。
必要なライブラリをインポートします。import torchimport torch.nn as nnimport torch.optim as ...
PyTorchによるrandnでの乱数固定
![Thumbnail of post image 200](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/cropped-mockaroon-bzLhhI3MpYY-unsplash.jpg?resize=150%2C150&ssl=1)
乱数を発生させる前にtorch.manual_seedを置く
# 直前に置くtorch.manual_seed(42)nn.Parameter(torch.randn(1, 50 + 1, 768))>>Parameter co ...Pytorchでモデルを実装する際のベース [自分用メモ]
![Thumbnail of post image 112](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/cropped-mockaroon-bzLhhI3MpYY-unsplash.jpg?resize=150%2C150&ssl=1)
BERTをfine-tuningする際のTips [自分用メモ]
![Thumbnail of post image 154](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/samuel-yongbo-kwon-wrQsfMKwElI-unsplash.jpg?resize=150%2C150&ssl=1)
AI SHIFT様が作成されたブログ記事が分かりやすかったので、筆者としての解釈を自分用メモとして残すことにする。
Kaggleで学んだBERTをfine-tuningする際のTips①〜学習効率化編〜 | 株式会社AI ...
MLP-Mixerに関する検証用コード
![Thumbnail of post image 199](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/bram-van-oost-6WvZo5FOxww-unsplash.jpg?resize=150%2C150&ssl=1)
MLP-Mixerに関して、GitHub – rishikksh20/MLP-Mixer-pytorch: Unofficial implementation of MLP-Mixer: An all-MLP Archit ...
Weight Sharering (重み共有)の実装方法 [Pytorch]
![Thumbnail of post image 188](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/cropped-danielle-macinnes-IuLgi9PWETU-unsplash.jpg?resize=150%2C150&ssl=1)
Pytorchのチュートリアルから、weight sharering(重み共有)の実装方法を紹介する。
今回扱うのは以下のチュートリアルである。
Learning PyTorch with Examples — ...
ImportError: cannot import name ‘SAVE_STATE_WARNING’ from ‘torch.optim.lr_scheduler’
![Thumbnail of post image 083](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/brooke-lark-HlNcigvUi4Q-unsplash.jpg?resize=150%2C150&ssl=1)
!pip install torch==1.4.0
ImportError: cannot import name deepcopy のエラーはcopy.pyが原因
![Thumbnail of post image 187](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/samuel-yongbo-kwon-wrQsfMKwElI-unsplash.jpg?resize=150%2C150&ssl=1)
pytorchのモデルを書いていて、何度かテストしていたのだが、突然、ImportError: cannot import name deepcopy というエラーがでて戸惑う。「torch ImportError: cannot i ...
Pytorchでのログの取り方
![Thumbnail of post image 003](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/erik-dungan-MQyCrJVFG8U-unsplash.jpg?resize=150%2C150&ssl=1)
学習しているとエポックごとの誤差やテストデータセットでのF1 scoreなどを継続的に記録したいと思うことがある.
こんなときにはwriter.add_scalarを使うのが良い.
下記にサンプルコードを載せる ...
UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
![Thumbnail of post image 015](https://i0.wp.com/vasteelab.com/wp-content/uploads/2020/07/brooke-lark-nTZOILVZuOg-unsplash.jpg?resize=150%2C150&ssl=1)
nn.functional.sigmoidは重複しているため、現在のPytorch APIではサポートしていませんよ、という警告。
import torch.nn.functional as Fでインポートし、F.sigmoi ...