Skip to Content
Deep Learning 向けの PyTorch プログラミング
book

Deep Learning 向けの PyTorch プログラミング

by Ian Pointer
May 2025
Intermediate to advanced
220 pages
3h 27m
Japanese
O'Reilly Media, Inc.
Content preview from Deep Learning 向けの PyTorch プログラミング

第7章. PyTorchモデルをデバッグする

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

本書ではこれまで多くのモデルを作成してきたが、この章ではそれらをインタプリタし、その下で何が起こっているのかを簡単に見ていく。デバッグのためにPyTorchをGoogleのTensorBoardに接続する方法を決定するモデルのフォーカスを決定するために、クラスアクティベーションマッピングをPyTorchフックと一緒に使う方法を見ていく。変換と学習パイプラインのボトルネックを特定するためにフレームグラフを使用する方法と、遅い変換を高速化する例を示す。最後に、チェックポインティングを使って大規模なモデルを処理する際に、計算量をメモリと交換する方法を紹介する。最初に、データについて簡単に説明しよう。

午前3時。あなたのデータは何をしているのか?

TensorBoardや勾配チェックポインティングのような、1つのGPUで大規模なモデルを使用するためのピカピカ光るものを掘り下げる前に、こう自問してみよう:自分のデータを理解しているか?入力を分類している場合、利用可能なすべてのラベルにわたってバランスの取れたサンプルを持っているだろうか?トレーニングセット、検証セット、テストセットにおいて?

さらに、のラベルは本当に正しいのだろうか? MNISTやCIFAR-10 (Canadian Institute for Advanced Research)のような重要な画像ベースのデータセットには、誤ったラベルが含まれていることが知られている。特に、犬の品種や植物の品種のように、カテゴリーが互いに似ている場合は、自分のものをチェックすべきである。例えば、あるラベルのカテゴリーには小さな画像しかないのに、他のカテゴリーには大きな解像度の例がある、というようなことがわかった場合、データをチェックするだけで、多くの時間を節約できるかもしれない。

データが良い条件付きであることを確認したら、そうだ、TensorBoardに向かい、モデルの可能性のある問題をチェックし始めよう。

テンソルボード

TensorBoardは、ニューラルネットワークの様々な側面を視覚化するために設計されたウェブアプリケーションだ。精度や損失活性化値などの統計情報を簡単にリアルタイムで見ることができる。TensorFlowを念頭において書かれたものではあるが、PyTorchでの作業はTensorFlowでの使用方法とそれほど変わらないほど、不可知論的でかなり単純なAPIを持っている。早速インストールして、モデルについての洞察を得るためにどのように使えるか見てみよう。

PyTorchについて読み進めると、FacebookのTensorBoardの代替である Visdomというアプリケーションの呼び出しに出くわすだろう。PyTorch v1.1以前は、ビジュアライゼーションをサポートする方法として、VisdomをPyTorchと一緒に使う方法があったが、TensorBoardと統合するために、tensorboardX のようなサードパーティのライブラリが利用可能だった。Visdomは継続的にメンテナンスされているが、v1.1以降で公式のTensorBoardインテグレーションが含まれていることは、PyTorchの開発者がTensorBoardが事実上のニューラルネットビジュアライザツールであることを認識していることを示唆している。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

生成 Deep Learning 第2版 ―絵を描き、物語や音楽を作り、ゲームをプレイする

生成 Deep Learning 第2版 ―絵を描き、物語や音楽を作り、ゲームをプレイする

David Foster, 松田 晃一, 小沼 千絵
直感 Deep Learning ―Python×Kerasでアイデアを形にするレシピ

直感 Deep Learning ―Python×Kerasでアイデアを形にするレシピ

Antonio Gulli, Sujit Pal, 大串 正矢, 久保 隆宏, 中山 光樹

Publisher Resources

ISBN: 9798341650367