Submit Search
[DLHacks]pytorch - segmentation を TPU で実行してみた / pytorch - lightning で書き換えてみた
Download as PPTX, PDF
2 likes
1,784 views
Deep Learning JP
2019/08/19 Deep Learning JP: http://deeplearning.jp/hacks/
Technology
Related topics:
Deep Learning
Read more
1 of 23
Download now
Download to read offline
1
2
Most read
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
More Related Content
PPTX
【DL輪読会】Contrastive Learning as Goal-Conditioned Reinforcement Learning
Deep Learning JP
PDF
最新リリース:Optuna V3の全て - 2022/12/10 Optuna Meetup #2
Preferred Networks
PPTX
PyCUDAの紹介
Yosuke Onoue
PDF
学位論文の書き方メモ (Tips for writing thesis)
Nobuyuki Umetani
PDF
最適輸送の解き方
joisino
PPTX
[DL輪読会]Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
Deep Learning JP
PDF
PyData.Tokyo Meetup #21 講演資料「Optuna ハイパーパラメータ最適化フレームワーク」太田 健
Preferred Networks
PDF
Vision and Language(メタサーベイ )
cvpaper. challenge
【DL輪読会】Contrastive Learning as Goal-Conditioned Reinforcement Learning
Deep Learning JP
最新リリース:Optuna V3の全て - 2022/12/10 Optuna Meetup #2
Preferred Networks
PyCUDAの紹介
Yosuke Onoue
学位論文の書き方メモ (Tips for writing thesis)
Nobuyuki Umetani
最適輸送の解き方
joisino
[DL輪読会]Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
Deep Learning JP
PyData.Tokyo Meetup #21 講演資料「Optuna ハイパーパラメータ最適化フレームワーク」太田 健
Preferred Networks
Vision and Language(メタサーベイ )
cvpaper. challenge
What's hot
(20)
PDF
Kaggle Happywhaleコンペ優勝解法でのOptuna使用事例 - 2022/12/10 Optuna Meetup #2
Preferred Networks
PDF
【DL輪読会】A Path Towards Autonomous Machine Intelligence
Deep Learning JP
PDF
カスタムSIで使ってみよう ~ OpenAI Gym を使った強化学習
Hori Tasuku
PDF
SLAM開発における課題と対策の一例の紹介
miyanegi
PDF
不老におけるOptunaを利用した分散ハイパーパラメータ最適化 - 今村秀明(名古屋大学 Optuna講習会)
Preferred Networks
PDF
【DL輪読会】NeRF in the Palm of Your Hand: Corrective Augmentation for Robotics vi...
Deep Learning JP
PDF
[DL輪読会]Factorized Variational Autoencoders for Modeling Audience Reactions to...
Deep Learning JP
PPTX
多目的強凸最適化のパレート集合のトポロジー
KLab Inc. / Tech
PDF
QGISセミナー中級編(V2.4)
IWASAKI NOBUSUKE
PDF
SSII2021 [TS1] Visual SLAM ~カメラ幾何の基礎から最近の技術動向まで~
SSII
PDF
PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...
NTT DATA Technology & Innovation
PPTX
backbone としての timm 入門
Takuji Tahara
PDF
JupyterLabを中心とした快適な分析生活
Classi.corp
PDF
Tech-Circle #18 Pythonではじめる強化学習 OpenAI Gym 体験ハンズオン
Takahiro Kubo
PPTX
[DL輪読会]Pay Attention to MLPs (gMLP)
Deep Learning JP
PPTX
強化学習初心者が強化学習でニューラルネットワークの設計を自動化してみたい
Takuma Wakamori
PDF
LightGBM: a highly efficient gradient boosting decision tree
Yusuke Kaneko
PDF
Deeplearning bank marketing dataset
TellSun
PPTX
物体検出の歴史(R-CNNからSSD・YOLOまで)
HironoriKanazawa
PDF
【メタサーベイ】基盤モデル / Foundation Models
cvpaper. challenge
Kaggle Happywhaleコンペ優勝解法でのOptuna使用事例 - 2022/12/10 Optuna Meetup #2
Preferred Networks
【DL輪読会】A Path Towards Autonomous Machine Intelligence
Deep Learning JP
カスタムSIで使ってみよう ~ OpenAI Gym を使った強化学習
Hori Tasuku
SLAM開発における課題と対策の一例の紹介
miyanegi
不老におけるOptunaを利用した分散ハイパーパラメータ最適化 - 今村秀明(名古屋大学 Optuna講習会)
Preferred Networks
【DL輪読会】NeRF in the Palm of Your Hand: Corrective Augmentation for Robotics vi...
Deep Learning JP
[DL輪読会]Factorized Variational Autoencoders for Modeling Audience Reactions to...
Deep Learning JP
多目的強凸最適化のパレート集合のトポロジー
KLab Inc. / Tech
QGISセミナー中級編(V2.4)
IWASAKI NOBUSUKE
SSII2021 [TS1] Visual SLAM ~カメラ幾何の基礎から最近の技術動向まで~
SSII
PGOを用いたPostgreSQL on Kubernetes入門(Open Source Conference 2023 Online/Hokkaido...
NTT DATA Technology & Innovation
backbone としての timm 入門
Takuji Tahara
JupyterLabを中心とした快適な分析生活
Classi.corp
Tech-Circle #18 Pythonではじめる強化学習 OpenAI Gym 体験ハンズオン
Takahiro Kubo
[DL輪読会]Pay Attention to MLPs (gMLP)
Deep Learning JP
強化学習初心者が強化学習でニューラルネットワークの設計を自動化してみたい
Takuma Wakamori
LightGBM: a highly efficient gradient boosting decision tree
Yusuke Kaneko
Deeplearning bank marketing dataset
TellSun
物体検出の歴史(R-CNNからSSD・YOLOまで)
HironoriKanazawa
【メタサーベイ】基盤モデル / Foundation Models
cvpaper. challenge
More from Deep Learning JP
(20)
PPTX
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
Deep Learning JP
PPTX
【DL輪読会】事前学習用データセットについて
Deep Learning JP
PPTX
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
Deep Learning JP
PPTX
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
Deep Learning JP
PPTX
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
Deep Learning JP
PPTX
【DL輪読会】マルチモーダル LLM
Deep Learning JP
PDF
【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
Deep Learning JP
PPTX
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
Deep Learning JP
PDF
【DL輪読会】Can Neural Network Memorization Be Localized?
Deep Learning JP
PPTX
【DL輪読会】Hopfield network 関連研究について
Deep Learning JP
PPTX
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
Deep Learning JP
PDF
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
Deep Learning JP
PDF
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
Deep Learning JP
PPTX
【DL輪読会】"Language Instructed Reinforcement Learning for Human-AI Coordination "
Deep Learning JP
PPTX
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
Deep Learning JP
PDF
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
Deep Learning JP
PPTX
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
Deep Learning JP
PDF
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
Deep Learning JP
PDF
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
Deep Learning JP
PPTX
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...
Deep Learning JP
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
Deep Learning JP
【DL輪読会】事前学習用データセットについて
Deep Learning JP
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
Deep Learning JP
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
Deep Learning JP
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
Deep Learning JP
【DL輪読会】マルチモーダル LLM
Deep Learning JP
【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
Deep Learning JP
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
Deep Learning JP
【DL輪読会】Can Neural Network Memorization Be Localized?
Deep Learning JP
【DL輪読会】Hopfield network 関連研究について
Deep Learning JP
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
Deep Learning JP
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
Deep Learning JP
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
Deep Learning JP
【DL輪読会】"Language Instructed Reinforcement Learning for Human-AI Coordination "
Deep Learning JP
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
Deep Learning JP
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
Deep Learning JP
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
Deep Learning JP
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
Deep Learning JP
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
Deep Learning JP
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...
Deep Learning JP
[DLHacks]pytorch - segmentation を TPU で実行してみた / pytorch - lightning で書き換えてみた
1.
pytorch-segmentationを TPUで実行してみた/ pytorch-lightningで書き換えてみた 東京大学大学院 情報理工学系研究科 電子情報学専攻 坂井・入江研
D1 谷合 廣紀
2.
今日の内容 • セマンティックセグメンテーションを題材に • PyTorchでTPUを使ってみる •
pytorch-lightningで学習コードを書き直す
3.
pytorch-segmentation • https://github.com/nyoki-mtl/pytorch-segmentation • PyTorchで書いたセマンティックセグメンテーション用のコード •
Deeplab V3+, MobileNet V2, Unetなどが使える
4.
TPUで実行してみた
5.
TPUとは • Googleが開発したディープラーニング用のプロセッサ • Google
ColaboratoryやGoogle Cloud Platformで使える • フレームワークとしえはKeras/Tensorflowが対応
6.
PyTorchからもTPUを使ってみたい • 去年10月くらいにPyTorchも今後TPUに対応していくことが発表された • https://cloud.google.com/blog/products/ai-machine- learning/introducing-pytorch-across-google-cloud •
https://github.com/pytorch/xla で開発が進められている • XLA(Accelerated Linear Algebra)はTensorflow用のコンパイラ • XLAでコンパイルした中間言語はTPUで実行可能
7.
pytorch/xla • githubのページに行くとチュートリアルがある • 実行してみよう!
8.
環境 • Google Cloud
Platformで実験 • インスタンス • TPU v3x8 (第三世代のTPUが8台) • n1-standard-16 (vCPU x16, Memory 60GB)
9.
TPUの起動 (コマンド例) $ gcloud
compute tpus create tpu- node1 --zone=us-central1-a --network=default --range=10.0.101.0 --version=pytorch-0.1 --accelerator-type=v3-8 Pytorch用のソフトウェア
10.
CPUの起動 (コマンド例) $ gcloud
compute instances create master- vm --zone=us-central1-a --machine-type=n1-standard-16 --image=debian-9-torch-xla- v20190817 --image-project=ml-images --boot-disk-size=100GB --boot-disk-type=pd-ssd Pytorch用のイメージ
11.
MNIST実行 $ gcloud compute
ssh master-vm (vm)$ export XRT_TPU_CONFIG="tpu_worker;0;10.0.101.2:8470“ (vm)$ conda activate pytorch-0.1 (pytorch-0.1)$ cd /usr/share/torch-xla-0.1/pytorch/xla (pytorch-0.1)$ python test/test_train_mnist.py
12.
pytorch-segmentationを書き換える • もとのコード https://github.com/nyoki-mtl/pytorch-segmentation/blob/master/src/train.py • TPU用のコード https://github.com/nyoki-mtl/pytorch-segmentation/blob/tpu/src/train_tpu.py •
UNetでcityscapesを学習させてみる
13.
ライブラリ • TPU用の環境変数 • torch-xlaのインポート
14.
TPUの設定 • 使用するデバイスの設定 • max_devices:
TPUをいくつ使うか指定でき、Noneなら全部使う
15.
モデルの並列化 • Train • Valid
16.
Train loop
17.
所感 • 思ったより簡単にTPU実行可能なコードに書き換えることができた • まだできていない部分も多い •
Dilated convが実行できなかったので、deeplab v3+は動かせなかった • model.eval()をするとBatchNormの挙動がおかしくなっているように感じた • 学習に時間がかかる • NVIDIA TITAN Vで3分の学習がTPU v3x8で20分ほどかかった • TPUの強みを活かせていない or 別のところにボトルネックがあるかも
18.
pytorch-lightningに 書き換えてみた
19.
pytorch-lightningとは • PyTorchのラッパーで効率的に実験コードを書くことができるライブラリ • Tensorflowにおけるkerasのような立ち位置 •
最近、Pytorch公式のエコシステムのひとつに
20.
pytorch-lightningの書き方 • pl.LightningModuleを継承したモデルを書いて
21.
pytorch-lightningの書き方 • Trainerで学習を回すだけ
22.
pytorch-segmentationを書き換える • もとのコード • https://github.com/nyoki-mtl/pytorch-segmentation/blob/master/src/train.py •
Pytorch-lightningのコード • https://github.com/nyoki-mtl/pytorch-segmentation/blob/pytorch-lightning/src/pl_model.py • https://github.com/nyoki-mtl/pytorch-segmentation/blob/pytorch-lightning/src/pl_train.py • Deeplabv3+でcityscapesを学習させてみる
23.
所感 • コードがきれいにまとまって可読性が向上した • 機能が多い •
簡単にマルチGPUや混合精度演算を実行できる • Tensorboardでログを出力できる • 簡潔に書ける一方でカスタマイズ性も高い
Download