SlideShare a Scribd company logo
How to deploy a new model in production without overhead
How to deploy a new model in
production without overhead
Laura Calem - AI in Production meetup - 12.10.18
Train Prod
Train Prod
Dataset
Versionning
Reproducibility
Actual training
Train Prod
Deployment
Scalability
Visibility
Resources access
Train Prod
Train Prod
Train Prod
How to deploy a new model in production without overhead
Use Docker
1
How to deploy a new model in production without overhead
How to deploy a new model in production without overhead
How to deploy a new model in production without overhead
How to deploy a new model in production without overhead
New models
2
2.1
Have an external
module with a
Batcher class
2.1
Have an external
module with a
Batcher class
Mother class
2.1
Have an external
module with a
Batcher class
Mother class
ZMQ server
2.1
Have an external
module with a
Batcher class
Mother class
ZMQ server
Will handle receiving data
2.1
Have an external
module with a
Batcher class
Mother class
ZMQ server
Will handle receiving data
Call a process_batch class
2.1
Have an external
module with a
Batcher class
Mother class
ZMQ server
Will handle receiving data
Call a process_batch class
Handle sending response
2.1 Batcher mother class
2.1 Batcher mother class
class Batcher(object):
def __init__(self):
…
2.1 Batcher mother class
class Batcher(object):
def __init__(self):
…
def get_parser(self):
…
2.1 Batcher mother class
class Batcher(object):
def __init__(self):
…
def get_parser(self):
…
def run_server(self):
…
2.1 Batcher mother class
class Batcher(object):
def __init__(self):
2.1 Batcher mother class
class Batcher(object):
def __init__(self):
parser = self.get_parser()
self.args = parser.parse_args()
# augment args if needed
2.1 Batcher mother class
class Batcher(object):
def __init__(self):
parser = self.get_parser()
self.args = parser.parse_args()
# augment args if needed
self.batcher_init() # will be redefined
self.host = self.args.host
self.port = self.args.port
2.1 Batcher mother class
class Batcher(object):
def run_server(self):
2.1 Batcher mother class
class Batcher(object):
def run_server(self):
self.context = zmq.Context()
self.server = self.context.socket(zmq.REP)
2.1 Batcher mother class
class Batcher(object):
def run_server(self):
self.context = zmq.Context()
self.server = self.context.socket(zmq.REP)
zmq_bind_addr = "%s:%s" % (self.host, self.port)
self.server.bind(zmq_bind_addr)
2.1 Batcher mother class
class Batcher(object):
def run_server(self):
self.context = zmq.Context()
self.server = self.context.socket(zmq.REP)
zmq_bind_addr = "%s:%s" % (self.host, self.port)
self.server.bind(zmq_bind_addr)
while True:
2.1 Batcher mother class
class Batcher(object):
def run_server(self):
self.context = zmq.Context()
self.server = self.context.socket(zmq.REP)
zmq_bind_addr = "%s:%s" % (self.host, self.port)
self.server.bind(zmq_bind_addr)
while True:
message = self.server.recv()
2.1 Batcher mother class
class Batcher(object):
def run_server(self):
self.context = zmq.Context()
self.server = self.context.socket(zmq.REP)
zmq_bind_addr = "%s:%s" % (self.host, self.port)
self.server.bind(zmq_bind_addr)
while True:
message = self.server.recv()
response = self.handle_request(message)
2.1 Batcher mother class
class Batcher(object):
def run_server(self):
self.context = zmq.Context()
self.server = self.context.socket(zmq.REP)
zmq_bind_addr = "%s:%s" % (self.host, self.port)
self.server.bind(zmq_bind_addr)
while True:
message = self.server.recv()
response = self.handle_request(message)
self.server.send(response)
2.1 Batcher mother class
class Batcher(object):
def handle_request(self, message):
2.1 Batcher mother class
class Batcher(object):
def handle_request(self, message):
# handle message as images / filter / etc
batch = self.create_batch(message)
2.1 Batcher mother class
class Batcher(object):
def handle_request(self, message):
# handle message as images / filter / etc
batch = self.create_batch(message)
result = self.process_batch(batch) # will be redefined
2.1 Batcher mother class
class Batcher(object):
def handle_request(self, message):
# handle message as images / filter / etc
batch = self.create_batch(message)
result = self.process_batch(batch) # will be redefined
# format result into zmq response
return self.format_result(result)
2.1 Batcher mother class
class Batcher(object):
def __init__(self):
…
def get_parser(self):
…
def run_server(self):
…
2.2
Derive Batcher
class in your new
module
2.2
Derive Batcher
class in your new
module
batcher_init
2.2
Derive Batcher
class in your new
module
batcher_init
process_batch
2.2
Derive Batcher
class in your new
module
batcher_init
process_batch
entrypoint
2.2 Batcher child class
2.2 Batcher child class
class MyBatcher(Batcher):
def batcher_init(self):
2.2 Batcher child class
class MyBatcher(Batcher):
def batcher_init(self):
# extract model config from args
config = self.make_config(self.args)
2.2 Batcher child class
class MyBatcher(Batcher):
def batcher_init(self):
# extract model config from args
config = self.make_config(self.args)
self.model = MyModel(config)
2.2 Batcher child class
class MyBatcher(Batcher):
def process_batch(self, batch):
2.2 Batcher child class
class MyBatcher(Batcher):
def process_batch(self, batch):
pred = self.model.predict(batch)
2.2 Batcher child class
class MyBatcher(Batcher):
def process_batch(self, batch):
tic = time.time()
pred = self.model.predict(batch)
toc = time.time()
pred_time = toc - tic
2.2 Batcher child class
class MyBatcher(Batcher):
def process_batch(self, batch):
tic = time.time()
pred = self.model.predict(batch)
toc = time.time()
pred_time = toc - tic
return self.format_result(pred, pred_time)
2.2 Batcher child class - Entrypoint
if __name__ == "__main__":
2.2 Batcher child class - Entrypoint
if __name__ == "__main__":
batcher = MyBatcher()
batcher.run_server()
Production pipeline
3
How to deploy a new model in production without overhead
How to deploy a new model in production without overhead
How to deploy a new model in production without overhead
How to deploy a new model in production without overhead
One api to rule
them all
One api to rule
them all
docker compose
One api to rule
them all
docker compose
api waits for every container
One api to rule
them all
docker compose
api waits for every container
api gets inference requests
One api to rule
them all
docker compose
api waits for every container
api gets inference requests
api talks to containers
How to deploy a new model in production without overhead
Final words
How to deploy a new model in production without overhead
lvl 1
lvl 1
Manual training
lvl 1
Manual training
Script for inference
lvl 1
Manual training
Script for inference
No real prod
lvl 1
Manual training
Script for inference
No real prod
lvl 2
lvl 1
Manual training
Script for inference
No real prod
lvl 2
lvl 1
Manual training
Script for inference
No real prod
lvl 2
Manual training
lvl 1
Manual training
Script for inference
No real prod
lvl 2
Manual training
Prod pipeline
lvl 1
Manual training
Script for inference
No real prod
lvl 2
Manual training
Prod pipeline
Fixed
lvl 1
Manual training
Script for inference
No real prod
lvl 2
Manual training
Prod pipeline
Fixed
lvl 3
lvl 1
Manual training
Script for inference
No real prod
lvl 2
Manual training
Prod pipeline
Fixed
lvl 3
Training pipeline
lvl 1
Manual training
Script for inference
No real prod
lvl 2
Manual training
Prod pipeline
Fixed
lvl 3
Training pipeline
Prod pipeline
lvl 1
Manual training
Script for inference
No real prod
lvl 2
Manual training
Prod pipeline
Fixed
lvl 3
Training pipeline
Prod pipeline
Distributed
lvl 1
Manual training
Script for inference
No real prod
lvl 2
Manual training
Prod pipeline
Fixed
lvl 3
Training pipeline
Prod pipeline
Distributed
Celery
MRQ
Python RQ
Thank you!

More Related Content

PPTX
SCWCD : Thread safe servlets : CHAP : 8
PDF
Why Task Queues - ComoRichWeb
PDF
Steady with ruby
PDF
Celery with python
PDF
Automated master failover
PDF
Event Driven Javascript
PDF
Node Boot Camp
PDF
Bring your infrastructure under control with Infrastructor
SCWCD : Thread safe servlets : CHAP : 8
Why Task Queues - ComoRichWeb
Steady with ruby
Celery with python
Automated master failover
Event Driven Javascript
Node Boot Camp
Bring your infrastructure under control with Infrastructor

What's hot (20)

PDF
Advanced task management with Celery
PDF
Indic threads pune12-java ee 7 platformsimplification html5
PDF
Data processing with celery and rabbit mq
PDF
Apache Cassandra in Bangalore - Cassandra Internals and Performance
PDF
Testing Your Application On Google App Engine
PDF
Rails on Oracle 2011
PDF
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
PPTX
SERVIET
PDF
Hopping in clouds: a tale of migration from one cloud provider to another
PDF
React Native Evening
KEY
Writing robust Node.js applications
PDF
RubyEnRails2007 - Dr Nic Williams - Keynote
PPT
RESTful API In Node Js using Express
PDF
Why Every Tester Should Learn Ruby
PDF
RubyEnRails2007 - Dr Nic Williams - DIY Syntax
PDF
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
KEY
Puppet for Java developers - JavaZone NO 2012
PDF
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
PPTX
Configuration Management and Provisioning Are Different
PDF
Dynamo: Not Just For Datastores
Advanced task management with Celery
Indic threads pune12-java ee 7 platformsimplification html5
Data processing with celery and rabbit mq
Apache Cassandra in Bangalore - Cassandra Internals and Performance
Testing Your Application On Google App Engine
Rails on Oracle 2011
Rails-like JavaScript Using CoffeeScript, Backbone.js and Jasmine
SERVIET
Hopping in clouds: a tale of migration from one cloud provider to another
React Native Evening
Writing robust Node.js applications
RubyEnRails2007 - Dr Nic Williams - Keynote
RESTful API In Node Js using Express
Why Every Tester Should Learn Ruby
RubyEnRails2007 - Dr Nic Williams - DIY Syntax
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Puppet for Java developers - JavaZone NO 2012
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Configuration Management and Provisioning Are Different
Dynamo: Not Just For Datastores
Ad

Similar to How to deploy a new model in production without overhead (20)

PDF
MLSEV Virtual. From my First BigML Project to Production
PDF
A journey through the machine learning model deployment to production
PDF
Journey through the ML model deployment to production @DSC5
PDF
DutchMLSchool 2022 - Automation
PDF
Clipper: A Low-Latency Online Prediction Serving System
PPTX
Clipper at UC Berkeley RISECamp 2017
PDF
Journey through the ML model deployment to production by Stanko Kuveljic
PDF
Building an ML Platform with Ray and MLflow
PDF
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
PDF
Scaling AI in production using PyTorch
PDF
DutchMLSchool. ML Automation
PDF
Productionizing Real-time Serving With MLflow
PDF
Managing the Machine Learning Lifecycle with MLOps
PDF
Wix's ML Platform
PDF
Hydrosphere.io for ODSC: Webinar on Kubeflow
PDF
Deploying Models at Scale with Apache Beam
PDF
Applied Machine learning for business analytics
PDF
Reproducible AI Using PyTorch and MLflow
PDF
Clipper: A Low-Latency Online Prediction Serving System: Spark Summit East ta...
PDF
Productionalizing Models through CI/CD Design with MLflow
MLSEV Virtual. From my First BigML Project to Production
A journey through the machine learning model deployment to production
Journey through the ML model deployment to production @DSC5
DutchMLSchool 2022 - Automation
Clipper: A Low-Latency Online Prediction Serving System
Clipper at UC Berkeley RISECamp 2017
Journey through the ML model deployment to production by Stanko Kuveljic
Building an ML Platform with Ray and MLflow
"Scaling ML from 0 to millions of users", Julien Simon, AWS Dev Day Kyiv 2019
Scaling AI in production using PyTorch
DutchMLSchool. ML Automation
Productionizing Real-time Serving With MLflow
Managing the Machine Learning Lifecycle with MLOps
Wix's ML Platform
Hydrosphere.io for ODSC: Webinar on Kubeflow
Deploying Models at Scale with Apache Beam
Applied Machine learning for business analytics
Reproducible AI Using PyTorch and MLflow
Clipper: A Low-Latency Online Prediction Serving System: Spark Summit East ta...
Productionalizing Models through CI/CD Design with MLflow
Ad

Recently uploaded (20)

PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPT
Mechanical Engineering MATERIALS Selection
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
composite construction of structures.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
web development for engineering and engineering
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Digital Logic Computer Design lecture notes
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
DOCX
573137875-Attendance-Management-System-original
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
R24 SURVEYING LAB MANUAL for civil enggi
Mechanical Engineering MATERIALS Selection
UNIT-1 - COAL BASED THERMAL POWER PLANTS
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
composite construction of structures.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Operating System & Kernel Study Guide-1 - converted.pdf
web development for engineering and engineering
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Digital Logic Computer Design lecture notes
Foundation to blockchain - A guide to Blockchain Tech
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Automation-in-Manufacturing-Chapter-Introduction.pdf
573137875-Attendance-Management-System-original
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks

How to deploy a new model in production without overhead