Movatterモバイル変換


[0]ホーム

URL:


Deep Learning JP, profile picture
Uploaded byDeep Learning JP
PPTX, PDF1,790 views

[DLHacks]pytorch - segmentation を TPU で実行してみた / pytorch - lightning で書き換えてみた

2019/08/19Deep Learning JP: http://deeplearning.jp/hacks/

Related topics:

Embed presentation

Download to read offline
pytorch-segmentationをTPUで実行してみた/pytorch-lightningで書き換えてみた東京大学大学院 情報理工学系研究科電子情報学専攻 坂井・入江研 D1谷合 廣紀
今日の内容• セマンティックセグメンテーションを題材に• PyTorchでTPUを使ってみる• pytorch-lightningで学習コードを書き直す
pytorch-segmentation• https://github.com/nyoki-mtl/pytorch-segmentation• PyTorchで書いたセマンティックセグメンテーション用のコード• Deeplab V3+, MobileNet V2, Unetなどが使える
TPUで実行してみた
TPUとは• Googleが開発したディープラーニング用のプロセッサ• Google ColaboratoryやGoogle Cloud Platformで使える• フレームワークとしえはKeras/Tensorflowが対応
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で実行可能
pytorch/xla• githubのページに行くとチュートリアルがある• 実行してみよう!
環境• Google Cloud Platformで実験• インスタンス• TPU v3x8 (第三世代のTPUが8台)• n1-standard-16 (vCPU x16, Memory 60GB)
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-8Pytorch用のソフトウェア
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-ssdPytorch用のイメージ
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
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を学習させてみる
ライブラリ• TPU用の環境変数• torch-xlaのインポート
TPUの設定• 使用するデバイスの設定• max_devices: TPUをいくつ使うか指定でき、Noneなら全部使う
モデルの並列化• Train• Valid
Train loop
所感• 思ったより簡単にTPU実行可能なコードに書き換えることができた• まだできていない部分も多い• Dilated convが実行できなかったので、deeplab v3+は動かせなかった• model.eval()をするとBatchNormの挙動がおかしくなっているように感じた• 学習に時間がかかる• NVIDIA TITAN Vで3分の学習がTPU v3x8で20分ほどかかった• TPUの強みを活かせていない or 別のところにボトルネックがあるかも
pytorch-lightningに書き換えてみた
pytorch-lightningとは• PyTorchのラッパーで効率的に実験コードを書くことができるライブラリ• Tensorflowにおけるkerasのような立ち位置• 最近、Pytorch公式のエコシステムのひとつに
pytorch-lightningの書き方• pl.LightningModuleを継承したモデルを書いて
pytorch-lightningの書き方• Trainerで学習を回すだけ
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を学習させてみる
所感• コードがきれいにまとまって可読性が向上した• 機能が多い• 簡単にマルチGPUや混合精度演算を実行できる• Tensorboardでログを出力できる• 簡潔に書ける一方でカスタマイズ性も高い

Recommended

PDF
Transformer 動向調査 in 画像認識(修正版)
PPTX
CatBoost on GPU のひみつ
PPTX
[DL輪読会]A closer look at few shot classification
PDF
Marp Tutorial
PDF
Point net
PPTX
[DL輪読会]Set Transformer: A Framework for Attention-based Permutation-Invariant...
PPTX
Tensor コアを使った PyTorch の高速化
PPTX
[DL輪読会]Graph R-CNN for Scene Graph Generation
PDF
ゼロから始める転移学習
PPTX
[解説スライド] NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
PDF
Generative Models(メタサーベイ )
PPTX
【DL輪読会】High-Resolution Image Synthesis with Latent Diffusion Models
PPTX
パワポ版の落合先生流論文要旨のテンプレートを作ったので配布する
PDF
[DL輪読会]SlowFast Networks for Video Recognition
PDF
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
PDF
画像キャプションと動作認識の最前線 〜データセットに注目して〜(第17回ステアラボ人工知能セミナー)
PDF
Cvpr 2021 manydepth
PDF
SSII2018TS: 3D物体検出とロボットビジョンへの応用
 
PDF
3次元レジストレーションの基礎とOpen3Dを用いた3次元点群処理
PDF
ELBO型VAEのダメなところ
PPTX
SSII2020SS: 微分可能レンダリングの最新動向 〜「見比べる」ことによる3次元理解 〜​
 
PDF
[DL輪読会]画像を使ったSim2Realの現況
PDF
MLP-Mixer: An all-MLP Architecture for Vision
PPTX
画像キャプションの自動生成
PDF
ガイデットフィルタとその周辺
PDF
最近のKaggleに学ぶテーブルデータの特徴量エンジニアリング
PDF
【DL輪読会】Novel View Synthesis with Diffusion Models
PDF
【DL輪読会】CLIPORT: What and Where Pathways for Robotic Manipulation (CoRL 2021)
PPTX
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
PPTX
【DL輪読会】事前学習用データセットについて

More Related Content

PDF
Transformer 動向調査 in 画像認識(修正版)
PPTX
CatBoost on GPU のひみつ
PPTX
[DL輪読会]A closer look at few shot classification
PDF
Marp Tutorial
PDF
Point net
PPTX
[DL輪読会]Set Transformer: A Framework for Attention-based Permutation-Invariant...
PPTX
Tensor コアを使った PyTorch の高速化
PPTX
[DL輪読会]Graph R-CNN for Scene Graph Generation
Transformer 動向調査 in 画像認識(修正版)
CatBoost on GPU のひみつ
[DL輪読会]A closer look at few shot classification
Marp Tutorial
Point net
[DL輪読会]Set Transformer: A Framework for Attention-based Permutation-Invariant...
Tensor コアを使った PyTorch の高速化
[DL輪読会]Graph R-CNN for Scene Graph Generation

What's hot

PDF
ゼロから始める転移学習
PPTX
[解説スライド] NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
PDF
Generative Models(メタサーベイ )
PPTX
【DL輪読会】High-Resolution Image Synthesis with Latent Diffusion Models
PPTX
パワポ版の落合先生流論文要旨のテンプレートを作ったので配布する
PDF
[DL輪読会]SlowFast Networks for Video Recognition
PDF
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
PDF
画像キャプションと動作認識の最前線 〜データセットに注目して〜(第17回ステアラボ人工知能セミナー)
PDF
Cvpr 2021 manydepth
PDF
SSII2018TS: 3D物体検出とロボットビジョンへの応用
 
PDF
3次元レジストレーションの基礎とOpen3Dを用いた3次元点群処理
PDF
ELBO型VAEのダメなところ
PPTX
SSII2020SS: 微分可能レンダリングの最新動向 〜「見比べる」ことによる3次元理解 〜​
 
PDF
[DL輪読会]画像を使ったSim2Realの現況
PDF
MLP-Mixer: An all-MLP Architecture for Vision
PPTX
画像キャプションの自動生成
PDF
ガイデットフィルタとその周辺
PDF
最近のKaggleに学ぶテーブルデータの特徴量エンジニアリング
PDF
【DL輪読会】Novel View Synthesis with Diffusion Models
PDF
【DL輪読会】CLIPORT: What and Where Pathways for Robotic Manipulation (CoRL 2021)
ゼロから始める転移学習
[解説スライド] NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis
Generative Models(メタサーベイ )
【DL輪読会】High-Resolution Image Synthesis with Latent Diffusion Models
パワポ版の落合先生流論文要旨のテンプレートを作ったので配布する
[DL輪読会]SlowFast Networks for Video Recognition
[DL輪読会]Pervasive Attention: 2D Convolutional Neural Networks for Sequence-to-...
画像キャプションと動作認識の最前線 〜データセットに注目して〜(第17回ステアラボ人工知能セミナー)
Cvpr 2021 manydepth
SSII2018TS: 3D物体検出とロボットビジョンへの応用
 
3次元レジストレーションの基礎とOpen3Dを用いた3次元点群処理
ELBO型VAEのダメなところ
SSII2020SS: 微分可能レンダリングの最新動向 〜「見比べる」ことによる3次元理解 〜​
 
[DL輪読会]画像を使ったSim2Realの現況
MLP-Mixer: An all-MLP Architecture for Vision
画像キャプションの自動生成
ガイデットフィルタとその周辺
最近のKaggleに学ぶテーブルデータの特徴量エンジニアリング
【DL輪読会】Novel View Synthesis with Diffusion Models
【DL輪読会】CLIPORT: What and Where Pathways for Robotic Manipulation (CoRL 2021)

More from Deep Learning JP

PPTX
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
PPTX
【DL輪読会】事前学習用データセットについて
PPTX
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
PPTX
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
PPTX
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
PPTX
【DL輪読会】マルチモーダル LLM
PDF
【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
PPTX
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
PDF
【DL輪読会】Can Neural Network Memorization Be Localized?
PPTX
【DL輪読会】Hopfield network 関連研究について
PPTX
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
PDF
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
PDF
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
PPTX
【DL輪読会】"Language Instructed Reinforcement Learning for Human-AI Coordination "
PPTX
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
PDF
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
PPTX
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
PDF
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
PDF
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
PPTX
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
【DL輪読会】事前学習用データセットについて
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
【DL輪読会】マルチモーダル LLM
【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
【DL輪読会】Can Neural Network Memorization Be Localized?
【DL輪読会】Hopfield network 関連研究について
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
【DL輪読会】"Language Instructed Reinforcement Learning for Human-AI Coordination "
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...

[DLHacks]pytorch - segmentation を TPU で実行してみた / pytorch - lightning で書き換えてみた


[8]ページ先頭

©2009-2025 Movatter.jp