SlideShare a Scribd company logo
Chainer feature introduction
Training and dataset abstraction
5th Oct. 2016
GTC Japan @ Tokyo
Preferred Networks, Inc.
Kenta Oono
oono@preferred.jp
Trainer and Dataset abstraction
• New feature from v1.11.0
ü Free users from implementing training loops by themselves.
ü Support most of typical training procedures.
ü Easy to customize and extend.
• Note: We can also write manually training loops without this feature, as we
did in the examples of the previous versions.
2
Target Link
Dataset
Optimizer
Iterator
Main modules
• Dataset, Iterator: extract mini batches by iterating over datasets
• Trainer, Updater, Extension: customize the training loop with low cost
• Reporter: to collect statistics from inside of the models
3
Trainer
Extension
Extension
Extension
Updater Optimizer
Optimizer
Target Link
Target Link
Iterator
Iterator
Dataset
Dataset
We often use only one
optimizer and one
dataset. This diagram
shows a general case.
MNIST classification by
MLP with Trainer
class MLP(Link):
def __int__(self):
super(MLP, self).__init__(
l1=Linear(784, 1000),
l2=Linear(1000, 1000),
l3=Linear(1000, 10))
def __call__(x):
h1 = F.relu(self.l1(x))
h2 = F.relu(self.l2(l1))
return self.l3(h2)
Linear l1
x
W bias
5
ReLU
Linear l2
h1
W bias
ReLU
Linear l3
h2
W bias
4
# Prepare datasets and their iterators
train, test = get_mnist()
train_iter = SerialIterator(train, 128)
test_iter = SerialIterator(test, 128, repeat=False,
shuffle=False)
# Prepare links and their optimizers
model = L.Classifier(MLP())
optimizer = Adam()
optimizer.setup(model)
# Prepare trainer
updater = StandardUpdater(train_iter, optimizer)
trainer = Trainer(updater, (10, 'epoch'))
5
# Add extensions to augment trainer
trainer.extend(Evaluator(test_iter, model))
trainer.extend(dump_graph('main/loss'))
trainer.extend(snapshot())
trainer.extend(LogReport())
trainer.extend(PrintReport(
'epoch', 'main/accuracy',
'validation/main/accuracy']))
trainer.extend(ProgressBar())
# Execute
trainer.run()
6
Pseudo code of training loop abstraction
For each extension e:
Invoke e if specified
Until stop_trigger is fired:
Invoke updater
for each extension e:
if e’s trigger is fired:
Invoke e
For each extension e:
Finalize e
Finalize updater
7
• Trainer has stop trigger to determine
when to stop the training loop
• Each extension have a trigger to
determine when to invoke
8
Trainer-related modules
• Updater
– Fetch a mini-batch using Iterator, and update parameters using
Optimizer
– You can customize the update routine
– Built-in updater: StandardUpdater, ParallelUpdater
• Extension
– It adds an extra routine to the training loop
– Basic extensions are built-in:
Evaluator, LogReport, PrintReport, ProgressBar
snapshot, snapshot_object, ExponentialDecay,
LinearShift, dump_graph
– You can write your own extensions
9
Dataset-related modules
• Dataset is just a sequence of data points (a.k.a. examples)
• Iterator defines how to iterate over the dataset
• Built-in iterators:
– SerialIterator
– MultiprocessIterator
10

More Related Content

PDF
Introduction to Chainer
PDF
Differences of Deep Learning Frameworks
PDF
Introduction to Chainer 11 may,2018
PDF
Common Design of Deep Learning Frameworks
PDF
Chainer v2 alpha
PDF
Overview of Chainer and Its Features
PPTX
Deep parking
PPT
Notes from 2016 bay area deep learning school
Introduction to Chainer
Differences of Deep Learning Frameworks
Introduction to Chainer 11 may,2018
Common Design of Deep Learning Frameworks
Chainer v2 alpha
Overview of Chainer and Its Features
Deep parking
Notes from 2016 bay area deep learning school

What's hot (20)

PPTX
Chainer v3
PDF
Chainer v2 and future dev plan
PDF
Chainer Update v1.8.0 -> v1.10.0+
PDF
Tokyo Webmining Talk1
PDF
Introduction to Chainer: A Flexible Framework for Deep Learning
PDF
Chainer ui v0.3 and imagereport
PDF
Comparison of deep learning frameworks from a viewpoint of double backpropaga...
PDF
IIBMP2019 講演資料「オープンソースで始める深層学習」
PDF
CuPy: A NumPy-compatible Library for GPU
PDF
Chainer v4 and v5
PDF
Distributed implementation of a lstm on spark and tensorflow
PDF
Introduction to Chainer
PDF
Deep learning for molecules, introduction to chainer chemistry
PDF
FCN-Based 6D Robotic Grasping for Arbitrary Placed Objects
PPTX
An Introduction to TensorFlow architecture
PDF
Introduction to Chainer
PDF
Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...
PPTX
Explore Deep Learning Architecture using Tensorflow 2.0 now! Part 2
PDF
Kaggle Lyft Motion Prediction for Autonomous Vehicles 4th Place Solution
PPTX
Learn about Tensorflow for Deep Learning now! Part 1
Chainer v3
Chainer v2 and future dev plan
Chainer Update v1.8.0 -> v1.10.0+
Tokyo Webmining Talk1
Introduction to Chainer: A Flexible Framework for Deep Learning
Chainer ui v0.3 and imagereport
Comparison of deep learning frameworks from a viewpoint of double backpropaga...
IIBMP2019 講演資料「オープンソースで始める深層学習」
CuPy: A NumPy-compatible Library for GPU
Chainer v4 and v5
Distributed implementation of a lstm on spark and tensorflow
Introduction to Chainer
Deep learning for molecules, introduction to chainer chemistry
FCN-Based 6D Robotic Grasping for Arbitrary Placed Objects
An Introduction to TensorFlow architecture
Introduction to Chainer
Alex Smola, Professor in the Machine Learning Department, Carnegie Mellon Uni...
Explore Deep Learning Architecture using Tensorflow 2.0 now! Part 2
Kaggle Lyft Motion Prediction for Autonomous Vehicles 4th Place Solution
Learn about Tensorflow for Deep Learning now! Part 1
Ad

Viewers also liked (20)

PDF
Introduction to Chainer and CuPy
PDF
On the benchmark of Chainer
PDF
情報幾何学の基礎、第7章発表ノート
PDF
VAE-type Deep Generative Models
PDF
Deep Learning技術の最近の動向とPreferred Networksの取り組み
PDF
提供AMIについて
PDF
2015年9月18日 (GTC Japan 2015) 深層学習フレームワークChainerの導入と化合物活性予測への応用
PDF
Learning Image Embeddings using Convolutional Neural Networks for Improved Mu...
PDF
Introduction to Chainer (LL Ring Recursive)
PDF
Encode勉強会:GENCODE: The reference human genome annotation for The ENCODE Proje...
PDF
日本神経回路学会セミナー「DeepLearningを使ってみよう!」資料
PDF
ディープラーニング最近の発展とビジネス応用への課題
PDF
Development and Experiment of Deep Learning with Caffe and maf
PDF
最先端NLP勉強会 “Learning Language Games through Interaction” Sida I. Wang, Percy L...
PDF
深層学習による機械とのコミュニケーション
PDF
How to Develop Experiment-Oriented Programs
PDF
集中不等式のすすめ [集中不等式本読み会#1]
PDF
Caffeインストール
PDF
大規模データ時代に求められる自然言語処理 -言語情報から世界を捉える-
PDF
Techtalk:多様体
Introduction to Chainer and CuPy
On the benchmark of Chainer
情報幾何学の基礎、第7章発表ノート
VAE-type Deep Generative Models
Deep Learning技術の最近の動向とPreferred Networksの取り組み
提供AMIについて
2015年9月18日 (GTC Japan 2015) 深層学習フレームワークChainerの導入と化合物活性予測への応用
Learning Image Embeddings using Convolutional Neural Networks for Improved Mu...
Introduction to Chainer (LL Ring Recursive)
Encode勉強会:GENCODE: The reference human genome annotation for The ENCODE Proje...
日本神経回路学会セミナー「DeepLearningを使ってみよう!」資料
ディープラーニング最近の発展とビジネス応用への課題
Development and Experiment of Deep Learning with Caffe and maf
最先端NLP勉強会 “Learning Language Games through Interaction” Sida I. Wang, Percy L...
深層学習による機械とのコミュニケーション
How to Develop Experiment-Oriented Programs
集中不等式のすすめ [集中不等式本読み会#1]
Caffeインストール
大規模データ時代に求められる自然言語処理 -言語情報から世界を捉える-
Techtalk:多様体
Ad

Similar to GTC Japan 2016 Chainer feature introduction (20)

PPTX
AWS re:Invent 2018 - AIM401 - Deep Learning using Tensorflow
PDF
Start machine learning in 5 simple steps
PDF
Hot sos em12c_metric_extensions
PDF
implementing _Training_Neural_Network_with_PyTorch .pdf
PPTX
Understanding GBM and XGBoost in Scikit-Learn
PPT
myslide6
PPT
NewSeriesSlideShare
PPT
myslide1
PDF
Training Deep Networks with Backprop (D1L4 Insight@DCU Machine Learning Works...
PDF
K-Fashion 경진대회 3등 수상자 솔루션
PDF
Compiler Design- Machine Independent Optimizations
PDF
A Tour of Tensorflow's APIs
PDF
MLPerf an industry standard benchmark suite for machine learning performance
PPTX
Employee Salary Presentation.l based on data science collection of data
PDF
ECET 360 help A Guide to career/Snaptutorial
PDF
ECET 360 help A Guide to career/Snaptutorial
PDF
Understand and Harness the Capabilities of Intel® Xeon Phi™ Processors
PDF
Horovod ubers distributed deep learning framework by Alex Sergeev from Uber
PDF
Inference accelerators
PDF
Uber's Journey in Distributed Deep Learning
AWS re:Invent 2018 - AIM401 - Deep Learning using Tensorflow
Start machine learning in 5 simple steps
Hot sos em12c_metric_extensions
implementing _Training_Neural_Network_with_PyTorch .pdf
Understanding GBM and XGBoost in Scikit-Learn
myslide6
NewSeriesSlideShare
myslide1
Training Deep Networks with Backprop (D1L4 Insight@DCU Machine Learning Works...
K-Fashion 경진대회 3등 수상자 솔루션
Compiler Design- Machine Independent Optimizations
A Tour of Tensorflow's APIs
MLPerf an industry standard benchmark suite for machine learning performance
Employee Salary Presentation.l based on data science collection of data
ECET 360 help A Guide to career/Snaptutorial
ECET 360 help A Guide to career/Snaptutorial
Understand and Harness the Capabilities of Intel® Xeon Phi™ Processors
Horovod ubers distributed deep learning framework by Alex Sergeev from Uber
Inference accelerators
Uber's Journey in Distributed Deep Learning

More from Kenta Oono (10)

PDF
Minimax statistical learning with Wasserstein distances (NeurIPS2018 Reading ...
PDF
Overview of Machine Learning for Molecules and Materials Workshop @ NIPS2017
PDF
深層学習フレームワーク概要とChainerの事例紹介
PDF
20170422 数学カフェ Part2
PDF
20170422 数学カフェ Part1
PDF
Stochastic Gradient MCMC
PDF
Chainer Contribution Guide
PDF
Chainerインストール
PDF
NIPS2013読み会:Inverse Density as an Inverse Problem: The Fredholm Equation Appr...
PDF
NIPS2013読み会:Inverse Density as an Inverse Problem: The Fredholm Equation Appr...
Minimax statistical learning with Wasserstein distances (NeurIPS2018 Reading ...
Overview of Machine Learning for Molecules and Materials Workshop @ NIPS2017
深層学習フレームワーク概要とChainerの事例紹介
20170422 数学カフェ Part2
20170422 数学カフェ Part1
Stochastic Gradient MCMC
Chainer Contribution Guide
Chainerインストール
NIPS2013読み会:Inverse Density as an Inverse Problem: The Fredholm Equation Appr...
NIPS2013読み会:Inverse Density as an Inverse Problem: The Fredholm Equation Appr...

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
KodekX | Application Modernization Development
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
sap open course for s4hana steps from ECC to s4
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation theory and applications.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Empathic Computing: Creating Shared Understanding
PPT
Teaching material agriculture food technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Cloud computing and distributed systems.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Network Security Unit 5.pdf for BCA BBA.
Spectral efficient network and resource selection model in 5G networks
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KodekX | Application Modernization Development
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
sap open course for s4hana steps from ECC to s4
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation theory and applications.pdf
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Empathic Computing: Creating Shared Understanding
Teaching material agriculture food technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Cloud computing and distributed systems.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf

GTC Japan 2016 Chainer feature introduction

  • 1. Chainer feature introduction Training and dataset abstraction 5th Oct. 2016 GTC Japan @ Tokyo Preferred Networks, Inc. Kenta Oono oono@preferred.jp
  • 2. Trainer and Dataset abstraction • New feature from v1.11.0 ü Free users from implementing training loops by themselves. ü Support most of typical training procedures. ü Easy to customize and extend. • Note: We can also write manually training loops without this feature, as we did in the examples of the previous versions. 2
  • 3. Target Link Dataset Optimizer Iterator Main modules • Dataset, Iterator: extract mini batches by iterating over datasets • Trainer, Updater, Extension: customize the training loop with low cost • Reporter: to collect statistics from inside of the models 3 Trainer Extension Extension Extension Updater Optimizer Optimizer Target Link Target Link Iterator Iterator Dataset Dataset We often use only one optimizer and one dataset. This diagram shows a general case.
  • 4. MNIST classification by MLP with Trainer class MLP(Link): def __int__(self): super(MLP, self).__init__( l1=Linear(784, 1000), l2=Linear(1000, 1000), l3=Linear(1000, 10)) def __call__(x): h1 = F.relu(self.l1(x)) h2 = F.relu(self.l2(l1)) return self.l3(h2) Linear l1 x W bias 5 ReLU Linear l2 h1 W bias ReLU Linear l3 h2 W bias 4
  • 5. # Prepare datasets and their iterators train, test = get_mnist() train_iter = SerialIterator(train, 128) test_iter = SerialIterator(test, 128, repeat=False, shuffle=False) # Prepare links and their optimizers model = L.Classifier(MLP()) optimizer = Adam() optimizer.setup(model) # Prepare trainer updater = StandardUpdater(train_iter, optimizer) trainer = Trainer(updater, (10, 'epoch')) 5
  • 6. # Add extensions to augment trainer trainer.extend(Evaluator(test_iter, model)) trainer.extend(dump_graph('main/loss')) trainer.extend(snapshot()) trainer.extend(LogReport()) trainer.extend(PrintReport( 'epoch', 'main/accuracy', 'validation/main/accuracy'])) trainer.extend(ProgressBar()) # Execute trainer.run() 6
  • 7. Pseudo code of training loop abstraction For each extension e: Invoke e if specified Until stop_trigger is fired: Invoke updater for each extension e: if e’s trigger is fired: Invoke e For each extension e: Finalize e Finalize updater 7 • Trainer has stop trigger to determine when to stop the training loop • Each extension have a trigger to determine when to invoke
  • 8. 8
  • 9. Trainer-related modules • Updater – Fetch a mini-batch using Iterator, and update parameters using Optimizer – You can customize the update routine – Built-in updater: StandardUpdater, ParallelUpdater • Extension – It adds an extra routine to the training loop – Basic extensions are built-in: Evaluator, LogReport, PrintReport, ProgressBar snapshot, snapshot_object, ExponentialDecay, LinearShift, dump_graph – You can write your own extensions 9
  • 10. Dataset-related modules • Dataset is just a sequence of data points (a.k.a. examples) • Iterator defines how to iterate over the dataset • Built-in iterators: – SerialIterator – MultiprocessIterator 10