Latest / Agentic Conversations (formally mlops.community) / Engineering MLOps // Emmanuel Raj // MLOps Meetup #69
Transcript
- 0:02Betsy. All right, I think I'm going to
- 0:11go with this. Hmm Manuel is a fin land-based
- 0:28senior machine learning engineer.
- 0:34He's passionate and every search software engineer, speaker and
- 0:44off the other. He's also of machine learning
- 0:53engineer at Ito every and a researcher at our kitty.
- 1:04University. Of applied sciences in Finland,
- 1:14with over six, plus years of experience, building machine
- 1:20learning Solutions in the industry, he has worked on
- 1:29multiple domains such as Healthcare.
- 1:36And Manufacturing. I was the No Doubt looking for
- 1:40retail e-commerce. An aviation.
- 1:49All right, hold on. Let me just let me give that one
- 1:50another go because it was so close.
- 1:52I got a little distracted with over 60 years of experience,
- 2:00building machine learning solution.
- 2:10He has worked on multiple domains such as Healthcare.
- 2:21Manufacturing Finance, retail, e-commerce deviation, etc, etc,
- 2:28etc. That is Emanuel.
- 2:31Welcome to the show. Hey, thank you to me, that was
- 2:34splendid. Ironhide your channel.
- 2:38Hopefully you heard that. Let's uh let's get into it, man.
- 2:42Hopefully, you enjoyed that all. I couldn't hear all.
- 2:45You were saying is Praises for the intro that you just had, I'm
- 2:51just gonna pretend that's what you were saying.
- 2:53Well, well, I wasn't able to hear and now we are going to get
- 2:59going. I think we've got enough people
- 3:01here and I know they're all very interested to listen.
- 3:06Into your wise words and what you have to say and also see a
- 3:09bit of a coating demo. I know you've got something
- 3:12planned for us that we kind of organized last minute.
- 3:16So I'm excited for that. Have high hopes and I think we
- 3:23should start though, just by hearing about how you got into
- 3:27machine learning. And you have all of this, all of
- 3:30this experience which we just heard about in the song, if it
- 3:34was paying attention to the lyrics.
- 3:37And so give us a bit of background on yourself.
- 3:42Yeah. Surely at that mean, first of
- 3:44all, I would like to say and I already said that you can hear
- 3:47that but no one introduced me so well, it was so Soulful.
- 3:52I really enjoyed it. Thank you.
- 3:55And yeah, but just a bit of intro about how I came to be in
- 4:00machine. Learning it all started back
- 4:03seven years ago when I was a student back in India, during my
- 4:08batch Bachelor's in computer science, engineering, I must
- 4:11admit that I was not the best of students until I found this
- 4:15class of artificial intelligence where I discovered that software
- 4:19doesn't have to be deterministic.
- 4:22It can be without rules. That can be non deterministic.
- 4:25So that got me excited. When I heard fuzzy logic and
- 4:29neural networks and all that then since then I've come to
- 4:33Finland and then it's a wonderful place.
- 4:36A lot of innovation in a is happening, especially grew up
- 4:40here so I get To be part of that and worked in multiple companies
- 4:44over here. And something that gets me
- 4:47excited is when I see machine learning work in production, so
- 4:53that kept me going on this machine learning engineer role
- 4:56or sort of that kind of throws in the last six plus years.
- 5:00And now I work at the company called theater.
- 5:02Every that I get to be part of multiple Industries and
- 5:06companies help them get machine learning to production and make
- 5:10it work so that they get the Best value out of it.
- 5:15That's awesome. And as we mentioned before, for
- 5:19those who are just joining right now, you've got a new book out
- 5:23which is amazing. I know how hard it is to write a
- 5:26book, so congratulations on that.
- 5:28We can put a link to that in the chat.
- 5:31I'll do that next time. That you answer a question and
- 5:35we also should mention that in case you're not in the MLS
- 5:39Community already jump into our slack Channel.
- 5:41Where it's going off. And that is all that I want to
- 5:45say, because I forgot to say that before.
- 5:47But let's talk a little bit about what you've seen over
- 5:51these different years when you've been working with
- 5:55different companies and in your opinion, why do you think
- 6:00machine learning projects fail. So much as they do, we've all
- 6:03heard that stat where it's like X percent of data or machine
- 6:09learning projects, never get put into production.
- 6:11And we've heard it so much. It's become a little cliche and
- 6:15I've spoken out about that before.
- 6:17But what is your advice or what have you been seeing?
- 6:22And what do you, what do you reckon is?
- 6:24Why these machine learning projects?
- 6:27Don't, don't get put out. And they fail.
- 6:31Yeah, that's that's an exciting question.
- 6:34And lots to learn over the years because I've seen some projects
- 6:38fail in front of me and especially since so there's this
- 6:42boom of infrastructure and a lot of data being created in the
- 6:46volume, velocity and variety and so forth.
- 6:51So we've seen that we can integrate machine learning into
- 6:56our current a software project. So while ml was coming into
- 7:02software, we wanted to infuse with devops and that's where the
- 7:06birth of Emma loves happen and during this course of couple of
- 7:09years, then we have this Standard process of ml Ops
- 7:14before that, many people are data.
- 7:16Scientists used to build models in the notebooks and deploy it
- 7:21in a very last title on some cluster or deployment Target.
- 7:25And they used to be that used to be the draw normal approach, but
- 7:31there are some problems that we could clearly see.
- 7:34At least, I noticed that many companies to begin with to
- 7:39personalize ML on. Air Products, they lack the
- 7:42systematic. Way of developing the AI
- 7:44software, which is what Emma Lopes is a lot about.
- 7:49And there was a lack of continual learning abilities in
- 7:52production because companies start with the mindset of having
- 7:58a POC to do, a quick POC and validate, its business value.
- 8:03And well it when it goes to production, they don't focus on
- 8:08continuous learning and retaining the models.
- 8:10So that is Reason why it projects tend to fail if that's
- 8:15not the mindset to keep you continue learning in the mind.
- 8:19And also, when it comes to production, when they have
- 8:24continued learning ability, they tend to go with wrong model race
- 8:29strategy, sometimes which doesn't satisfy the business
- 8:32kpis, or doesn't get the best business value for that problem
- 8:37or sometimes there's a lack of Wrong governance.
- 8:42In terms of data models and auditing the project and really
- 8:47inspecting quarterly or monthly what is happening in terms of
- 8:52operations and backtracking the lineage of their operations and
- 8:56seeing if there are any areas that can be better worked on to
- 9:01make the whole flow better and sometimes they also lack testing
- 9:07for real-world. One thing is to test with unit
- 9:11tests. Do integration tests before
- 9:13going into production but also important to do testing for the
- 9:17real world scenarios such as load testing or for the business
- 9:21problem and so forth. So these have been some problems
- 9:25and before this cool technology called open your network
- 9:30exchange. The Onyx came for
- 9:33interoperability there used to be this way of developing a
- 9:38machine learning models using multiple Frameworks.
- 9:41Um, data scientist uses tensorflow, someone despite
- 9:44heart. So, at the end to deploy these
- 9:48models, there wasn't this uniform way of realizing the
- 9:51models and packaging them. So that used to be one of the
- 9:55struggles as well. But thanks to such Frameworks,
- 9:58such as open your network exchange and that are helping to
- 10:01tackle these problems. So, these are some of the
- 10:04problems that I noticed while my experience over these years,
- 10:10Okay, I got to follow up questions on that one, first.
- 10:12One is simple. Yes or no?
- 10:14Do you feel like Onyx has solved the problem there and the next
- 10:19one is I want to hear you weigh in on why jupyter notebooks
- 10:24aren't ready for production. Right.
- 10:29Good questions, Onyx. I mean it's not the full One,
- 10:34Stop solution that addresses all types of Frameworks.
- 10:40Well, at least it started with addressing common Frameworks
- 10:43such as sklearn or tensorflow or pie thoughts.
- 10:46It's not the one stop solution. So I would say not everything is
- 10:50developed by using all these common framework, sometimes
- 10:53their custom models that can't be serialized using onyx.
- 10:58So there lies the limitation but usually roughly an estimate.
- 11:03Maybe 70% of the models could be serialized using Onyx so it
- 11:09helps somewhere. And over the time I see that
- 11:13developing and helping solve this interoperability the model
- 11:16interoperability problems. So at least we have something to
- 11:21work around and coming to jupyter notebooks.
- 11:25Well, jupyter notebooks. They are basically used to
- 11:29provide a web interface to see your output while you're
- 11:33developing and when you put you Peter notebooks in the cic, D
- 11:38pipeline, that's not ideal, because, in CI CD pipelines, we
- 11:42usually use scripts like Python scripts or other files that go
- 11:51with the software engineering development and that can be
- 11:56deployed and used by the ICD pipeline.
- 11:58So, there lies the limitation. It's good for development, but
- 12:03when we take it to the cic D pipelines, that's where it
- 12:09loses. Its essence of providing a web
- 12:11interface because we don't need them.
- 12:13It's better to go as lean and simple as possible in the form
- 12:17of scripts. Well, since you're talking about
- 12:21cic pipelines, maybe we can go into a little bit of your book
- 12:27and how you mention in that how to build robust.
- 12:31Eicd pipelines. Can you go into that a little
- 12:34bit more and just tell us what your best practices have, what
- 12:38you found to be best practices. Yes.
- 12:43Yeah, I'm building robust, eicd pipelines.
- 12:46I mean, that's all that is and it's a mindset shift from
- 12:53building a model focusing on building a model to building a
- 12:56pipeline and not seeing model as your final product, but seeing
- 13:01python as your final product. So that's really important to
- 13:05have a robust Pipeline and some other components of robust
- 13:09pipeline are too. Proper process of quality
- 13:15assurance. For each phase traditionally, we
- 13:18have Devon vitamins to a and deployment environment, but a
- 13:25lot of things don't need to be completely automated because
- 13:29that might end up, end up, failing in production.
- 13:34And there needs to be oversight, especially in the QA
- 13:38environment. And especially Q&A is important,
- 13:40because There we do a lot of load testing stress testing
- 13:44integration testing before we release.
- 13:46So having these tests as part of the CI CD pipeline is crucial,
- 13:53and making sure that you also have a proper model release
- 13:59strategy. When it comes to your business
- 14:02problem is also an important aspect for your CI CD Pipeline
- 14:07and these models really strategies can be Like A/B
- 14:11Testing Shadow testing, Cannery testing, whatever suits, your
- 14:15business problem try to integrate them in a systematic
- 14:20way. So that the workflow addresses
- 14:22the business problem and try to automate as much as needed.
- 14:28And try to involve the human in the loop where the quality
- 14:33assurance comes in. So these are some components of
- 14:36robust eicd pipeline. I mean, whatever technology we
- 14:40use but these These principles should be applied to make sure
- 14:44that the governance is done properly and quality is assured
- 14:48before we take it to production. And also in monitoring we need
- 14:53to ensure that there's a good monitoring strategy for the
- 14:56business problem as well. Yeah.
- 14:58And that instinctively makes me feel like a little bit of what
- 15:06we had, who was it? Josh Tobin on here while back
- 15:10and he Talking about how you need to monitor each phase of
- 15:15the whole machine learning development life cycle and it
- 15:18kind of sounds like, that's what you're hinting at to is making
- 15:21sure that your your monitoring everything as it's going along
- 15:25and your, you've got a little bit of the human in the loop.
- 15:28But you're also automating what you can, but it's able to really
- 15:33get that get to that point where, unless something is fit
- 15:37to move on to the next step, it doesn't go there.
- 15:41So you don't have tragedies where something is put out
- 15:45before. It is even ready and it's fully
- 15:46baked. Yeah, exactly.
- 15:49And also there's something that is seen to be developing which
- 15:55is a i Ops and clubbing. That together with ML Ops ml Ops
- 16:01is about applying devops practices to your machine
- 16:05learning deployment and monitoring.
- 16:08But AI Ops is about applying a i Do your devops practices though,
- 16:14when we take that angle even it makes the CI CD pipeline more
- 16:18robust. And do you have an example of
- 16:21how that would work with in cic pipeline?
- 16:24Because I know that I have some friends working at a regular
- 16:29devops monitoring company and they use AI Ops within their
- 16:34company, to make sure that you're only being alerted for
- 16:39things that actually matter. So, they're using machine
- 16:42learning or AI to make sure that you get the alerts that are
- 16:48really important and you don't get stuck in alert hell as they
- 16:51call it. And so, one thing that I'm
- 16:55wondering is on the CI CD pipeline, how can you bring
- 16:58machine learning into that and create an AI Ops within the cic
- 17:04pipeline? For your machine learning?
- 17:06Yeah, that's it's critical to get the right alerts.
- 17:09Otherwise, it doesn't not have a lot of impact.
- 17:12So there are some use cases that we can look into some common use
- 17:17cases that can be applied to traditional ski ICD pipeline, a
- 17:21lobster such as making a predictive model to monitor, the
- 17:26releases that you make. So for instance if you're about
- 17:29to release a model you can use another model predictive model
- 17:34to see how likely it is that this model would succeed in
- 17:39production or whatever you're deploying.
- 17:41And the train that model which is used to predict How likely it
- 17:46is to succeed or not the training data that can be used
- 17:49is all the historic data of your releases, for example.
- 17:52So it needs such kind of data and documenting.
- 17:57And storing such data is also crucial in order to get proper
- 18:01alerts. So the better your predictive
- 18:03model is the better. It is able to say, if x y, z
- 18:07release is going to be successful or not.
- 18:10That is one use case. Ace and secondly when we have a
- 18:14model in production and we are monitoring its logs, maybe we
- 18:19can develop an anomaly detection model to use which is train
- 18:24based on all the locks previous, historical log books and detect
- 18:29an anomaly before it happens. So that we know that this kind
- 18:35of error can be foreseen. And also to automate error
- 18:39handling, we can bring In some some scripts as part of the Ci
- 18:46City Pipeline and in case error is detected using anomaly
- 18:50detection model. Then that skip the script would
- 18:54be triggered to address that problem, so that before the
- 18:57problem arises, we already have fixed it.
- 19:00It can be something like a relearning, the deployed service
- 19:04or redeploying, another model, or whatever that problem might
- 19:09be. So these kind of of common use
- 19:11cases can be applied using a Ops 2 that develops workflow and CI
- 19:17CD Pipeline. And this kind of an approach can
- 19:19give a good rate of automation for the whole work.
- 19:24Yeah. Yeah, it's fascinating to think
- 19:26about and I had never even looked at it that way.
- 19:30So thanks for opening those doors in my mind.
- 19:34There's a question that just came through and I think it's
- 19:36one that many people struggle with, so thank you.
- 19:39Whoever it was for asking this, hi Manuel, what advice do you
- 19:44have for someone who is trying to start building the ml Ops
- 19:48capabilities of their company, where to start, considering they
- 19:53already have some Models in production.
- 19:58Right, so I'm assuming these models are built using not using
- 20:04envelopes, way of breaking a zoom, that they're just put in
- 20:09production by some data scientists.
- 20:11So good way to start is to look at the legacy of the company.
- 20:16What kind of tools are being used because ml Ops is such a
- 20:20technology that can be used using, usually, any kind of
- 20:24tools that are being used in your software stack, maybe you
- 20:27To add one or two depending on your use case.
- 20:29So I would suggest getting acquainted with envelopes
- 20:33workflow process and try to build an ml platform first where
- 20:41you have a way of working to provide, get for your data, get
- 20:47for your source code. So you have a lineage for data
- 20:50and code and then also the models.
- 20:53So that kind of a platform gives you a place where you can get a
- 20:57bird eye view of the operations before deployment and then that
- 21:01would be the first phase where you build your ml models using
- 21:06ml platform where you have a proper lineage and the second
- 21:09phase would be the deploy phase where you can take those models,
- 21:13which have been trained serialized and then packaged
- 21:16them to a micro service, or whatever format suits your
- 21:21deployment needs and package them.
- 21:24That would be the second phase so I would suggest a test go.
- 21:27Creatively in a modular way you build your models first, using a
- 21:31new platform. Then go to the deploy phase
- 21:34where you use your email platform to deployment goes and
- 21:37then go to the monitor face. So there are tons of resources
- 21:42coming out these days to learn about this.
- 21:45And there are big companies, or startups working as well, so I'm
- 21:49sure you would be able to find your way, but keep in mind, the
- 21:53legacy of your company, the business is profit, business
- 21:55problems, and try to make the best.
- 21:57Best workflow for it. So you said something really
- 22:02interesting there that I'm always grappling with and of
- 22:06course in the community were exposed to all the new tools and
- 22:11everything fresh that's coming out, right?
- 22:14And it's easy to go down that rabbit hole and think that you
- 22:17need XYZ as whatever insert new tool here.
- 22:24But when you're talking about keeping in mind the legacy of
- 22:27what the company has in house, I can be useful and really trying
- 22:31to build off of that. So you don't need to go out and
- 22:34shop around for the newest, brightest shiny tool.
- 22:38Can you go into that a little bit more and and what tools you
- 22:41think are are really important or most useful?
- 22:45And can you get away with doing it all, on the Legacy tools?
- 22:51I mean, we've had Daniel stall on here, who works at Regions
- 22:56Bank and he broke down his Tech stack.
- 22:59Yeah, and it was interesting to me because there was no fancy ml
- 23:04Ops tool in the whole Tech stack.
- 23:06And he, he boasted that he has 100% of his models, get put into
- 23:11production, and so that was like a little bit of a circuit
- 23:15breaker in my mind thinking. Wow, no, no special ml obstacles
- 23:19yet. He is doing the what most ml Ops
- 23:24teams or what most machine learning teams can only dream of
- 23:28doing so. What kind of tools for you are
- 23:32the most important? And how do you feel about that
- 23:35the Legacy and bringing on new shiny tools?
- 23:39Yeah that's a really good question because almost all
- 23:42companies have a history of software development if it's not
- 23:46a start-up if it's a start-up you can of course look at tools
- 23:49and try to figure out the best one.
- 23:52But in this case I agree with Daniel what he said that you get
- 23:59a proper way. Workflow, you can use whatever
- 24:02tools or multiple tools to make it work and get 100% models
- 24:09working in production and get it working for your business
- 24:12problem. So somewhere I would like to
- 24:16point out is focus on the devops stack that your company has in
- 24:21terms of legacy and try to build off of that.
- 24:25If for example, you're using develop swelling from Amazon On
- 24:30or GitHub, or get lab, whatever it is, or as you're trying to
- 24:35build off of that, they might, there's a likelihood that they
- 24:38might have services for ML Ops or tooling around it.
- 24:44Try to plug in play with that. If it suits you, then go with
- 24:47it. Don't fall in love with tools,
- 24:49for in love, with the most optimal way to solve a problem
- 24:53and that's the way we want to look at.
- 24:55And also keep the cost in mind because using the Tool or using
- 25:00the most, coolest tool out there is really cool but also try to
- 25:04optimize costs for getting the most optimal value for your
- 25:09software life cycle. So keep this in mind.
- 25:13Keep this in mind. Try to iterate with with the
- 25:17Legacy tools if there are there. Otherwise, there are tools.
- 25:22I would advise try to look at some tools that keep you
- 25:27independent or give you. Liberty in terms of not having a
- 25:32vendor, for example, if you're using some Cloud, you're logged
- 25:37in to continue using that. So, there are other services
- 25:41which startups are working on, which are orchestration, tools,
- 25:45and I can recommend something like value High, which is a
- 25:49finish start up here. Also, working in America took
- 25:53off, they have customers and it's an open source tool for
- 25:58some of the features. And And try to build off, open
- 26:02source tools as well, because there are a lot of Open Source
- 26:04tools such as ml flow, which are quite hid out in the market.
- 26:08And when you try to build microservices, you can look at
- 26:12fast API couple with Docker to create these micro services and
- 26:17using such tools. Try to go open source as much as
- 26:21possible. And if you have a legacy where
- 26:25your devops tools are being used from a particular, vendor try to
- 26:29Plug and Play. That works well for you.
- 26:31That's good but fall in love with the with the problem the
- 26:35way you solve it and optimize it not tools so it will take a bit
- 26:39of trial and error and exploring and taking feedback and support
- 26:43to figure out the right workflow.
- 26:46And Tool. So yeah, speaking of Open Source
- 26:49tools and working with them with in machine learning, the one
- 26:53that always comes to my mind is Prometheus and anger fauna using
- 26:58those together. And for the most part they do
- 27:02the trick, right? They work, I'm wondering if you
- 27:06have experience with them and how you feel about them.
- 27:09And what really because I think Lena from the community said
- 27:14this best that, It's not important what tool you're
- 27:17using. It's what your, what kind of
- 27:19metrics you're monitoring and so most tools, most monitoring
- 27:24tools, specific monitoring tools are able to measure all of the
- 27:29metrics but it's you, the machine learning engineer or the
- 27:33one who built the model for needs to know what the metrics
- 27:35are that, you're really looking for and and how you figure out
- 27:39how to retrain from those and, and all that.
- 27:42So, love to hear your thoughts on that.
- 27:44Yeah. I mean Those tools Prometheus
- 27:47and Griffon are getting quite some users, especially in a
- 27:50monitoring site and yeah, it depends on you what you want to
- 27:54Monitor, and there are two things to monitor especially
- 27:58which is the model performance and the application performance
- 28:02on the high level, and everything else comes under
- 28:05under under these. So Prometheus and Griff Wanna
- 28:08Give You a good bird. Eye view on both and depends on
- 28:12you, what you want to customize. So I think those are Tools,
- 28:16especially for monitoring stack so building off of something
- 28:19else or cic the pipeline and try to Club these Prometheus
- 28:24circular fauna or there's also some other tools such as
- 28:27evidently AI or these kind of startups that are really
- 28:31building my software and services for monitoring as well.
- 28:35So it depends on what you want to monitor.
- 28:39The keep your business problem and business value in mind and
- 28:44try to get critical. Call metrics such as response,
- 28:48time, failure rate, and the application performance metrics
- 28:54and so forth. And try to even look at logs and
- 28:57try to also apply a. I Ops if you want to take it a
- 29:00step further to predict if something's going to fail or how
- 29:05you want to handle it. And I think it's also important
- 29:11to ask you about security and I know there's probably Like,
- 29:16going back to this question that was asked and how to bring the
- 29:20MLS capabilities into a company where you have some models in
- 29:23production, I know that security can be a roadblock for a lot of
- 29:28teams. How have you faced that?
- 29:30And how you overcome that challenge.
- 29:34Yeah. When it comes to security,
- 29:37especially if your machine learning engineer, they designed
- 29:39this, sometimes it's hard to foresee all the possible attacks
- 29:43that might be coming. We might be be very focused on a
- 29:46Model part of it. Maybe we can anticipate some
- 29:49adversarial attack or poisoning attack or reverse engineering or
- 29:53band or back so we can work for that.
- 29:56But real life security is another thing and I would advise
- 30:01to take help from your Dev Ops teams and system experts to
- 30:07foresee, and have have a workaround with firewalls or
- 30:12making sure you accept you're in.
- 30:15Rinses from particular addresses or keep track of your operations
- 30:20to keep your services secure and also Ops can be sprayed help to
- 30:26monitor your system logs and predict certain patterns.
- 30:30If there's an adversarial attack coming in or poisoning attack
- 30:33coming in it will alert you before the impact is really
- 30:38fair, so making use of all this and at the end it's a team game,
- 30:42one man or woman can't do everything.
- 30:44So Try to build the best of all. No, it's, that's great.
- 30:50So before we get into the live coding, that you were going to
- 30:57do for us, I am wondering in your opinion.
- 31:01What is next? What comes next for?
- 31:03ML Ops? Where Do We Go From Here?
- 31:06Yeah, and The Lofts has really taken off in the last couple of
- 31:11years and we've got where we've got and it's a nice development
- 31:15where we have this nice workflow to automate Our deployment
- 31:20operations and monitoring operations, but I think there's
- 31:23quite some work still needed to be done in the monitoring angle
- 31:27and making our CI CD pipelines robust.
- 31:29As we talked with hops before, and also, plugging in a Ops with
- 31:35ML Ops in terms of predictive capabilities to predictive of
- 31:40release, is going to be successful or not.
- 31:43But monitoring your logs for a potential attack or this kind of
- 31:47capability. So clubbing.
- 31:48Nai Ops and automating error, handling security, and this kind
- 31:53of operations together. With a ops+ envelopes I think
- 31:58is, is the next Frontier that we have in a lapse and if both
- 32:02these come together can be a very powerful technology.
- 32:07Hmm. Where do you feel like right now
- 32:09is the most mature section of envelopes because it is such
- 32:15like you're saying it is such a wide.
- 32:18And vast discipline and you're mentioning how see ICD is
- 32:24probably not so mature. And we need some, we need to do
- 32:27some work with monitoring. What pieces?
- 32:30Do you feel like are doing much more than other pieces?
- 32:37Yeah, I think if we look at em, llp's process on a very high
- 32:40level modular level. We have these three blocks where
- 32:44we build models deploy models monitor models.
- 32:48So I feel there's quite some nice work done with the bin spot
- 32:53where their MO platform tools available out there.
- 32:57Big cloud providers are there. Many startups are there where we
- 33:01can have this nice governance strategy till we build the
- 33:04models and package them where you can trace.
- 33:07That the data that was used to train the model source code,
- 33:11that was used to train a model parameters that we used to train
- 33:14the model. And so so I feel like build
- 33:17module is really The Taken good shape.
- 33:20And you can use many tools out there and they have this really
- 33:24well in casein deploy. Module is the second one which
- 33:27has taken nice shape. And there are a couple of
- 33:31deployment targets that are becoming quite popular, thanks
- 33:35to kubernetes Docker. And these kind of technologies
- 33:40that are taking us leaps in that.
- 33:43So there is nice development in deployment as well.
- 33:46So now the Third This is the monitoring module needs.
- 33:51Some work to make sure that Mo services are robust secure and
- 33:58scalable whenever needed. So tools, like Prometheus
- 34:02co-founders are taking us there, but there is still some work to
- 34:06do when it comes to really customizing inference to the
- 34:11business problem and knowing what to monitor having the right
- 34:15model release strategy and Being a strategy to header handle and
- 34:21so forth. So there's work to get down
- 34:23monitoring module but build and deploy are in nice shape.
- 34:28Excellent. So what have you got for us
- 34:31today? You want to walk us through what
- 34:32you were planning on doing and making in front of our eyes,
- 34:37right in front of our eyes. Yeah, definitely.
- 34:41Thanks for this opportunity as well and always excited to code
- 34:44and and show what can be done Hands-On.
- 34:48So, today we'll be looking at one of the important aspects of
- 34:52the inlet flow, especially for the Q&A or module, We test our
- 34:58service before we release it. And one of the important test
- 35:02that we should do is stress test or load, testing before you push
- 35:08out your model to production making sure that your service is
- 35:13able to handle X number of requests or X number of users,
- 35:18or whatever scenarios are out there.
- 35:21So making sure you load test for that.
- 35:24Before you take it to production, I can be Quite
- 35:27handy. So you should of course, to
- 35:29integration tests and unit tests, before you build, and
- 35:33this kind of test but load testing is an important one.
- 35:36Which will ensure robustness of your end of service options and
- 35:40let's go. Let's just pretend I'm one of
- 35:43those people that doesn't do that.
- 35:45What are some potentially bad things that can happen?
- 35:51Then we gonna end up with the lot of failures or if there's a
- 35:56highwomen Volume of requests. Your model will not be able to
- 36:00serve it. Hence your users are unhappy,
- 36:03your business value will be reduced and they'll be unhappy
- 36:07customers and yeah you simply feel in some parts of delivering
- 36:14business value if that doesn't happen.
- 36:17Yeah, I think testing is something that is so underrated,
- 36:22especially when it comes to ml Ops and trying to get the
- 36:27Testing mentality is something that Alfredo does that talked
- 36:31about two or three weeks ago. I can't remember exactly when
- 36:35you was on here, but he was mentioning how important it is
- 36:38to test and really try and catch everything you can before it
- 36:43gets to production. And so he was he also said
- 36:46something that I felt was was straight wisdom and that was you
- 36:50want to get you want to catch things as early as possible
- 36:56because the closer that you catch something to production
- 37:00the more expensive, it is That's a good thought.
- 37:04I agree to that. Yeah, we want to be able to let
- 37:09catch ya. So yeah, let's see what we have
- 37:15today for the Hands-On stuff. So, today, I'll walk you through
- 37:20a table where we have a fast API microservice.
- 37:25We may deploy it on cloud or run it locally.
- 37:29But then load test this service using an open-source tool that
- 37:33can be easily plugged in to your envelopes workflow to to load
- 37:39test in terms of what is the response time.
- 37:43Or how are your request doing and how many users you want to
- 37:46test against and so forth. So let's have a look.
- 37:50I will share my screen. Awesome and hopefully, it should
- 37:55work. Yep.
- 37:57See you in it. You see the fast, Eddie ice
- 38:00cream? Yep.
- 38:02Yes. So here is the code.
- 38:05Really try to keep it very clean and simple because it's better
- 38:10to understand. That way.
- 38:13So we have this git repository you can find it with my name and
- 38:18my labs Community moved up and it also stood in the chat right
- 38:21now. Yes please do so.
- 38:24And so there's this fast API microservice which is very
- 38:29simple. It it predicts the weather if
- 38:34it's going to rain or not and this kind of a problem is
- 38:38inspired from my book where I Walk through the a business
- 38:44problem, a real life business problem where we need to predict
- 38:47the weather at Port, where ships are coming with heavy logistic
- 38:53cargos. So we need to plan traffic and
- 38:56so forth to optimize the port. So one of the aspects is to
- 38:59predict whether they're so it's the same same code from there.
- 39:04Basically, I've trained support Vector Machine model to classify
- 39:11whether the given input. Put, which is coming in form of
- 39:15temperature, humidity wind speed, it been baiting degree
- 39:20visibility in km pressure, millibars and current weather
- 39:25condition. And we use these this input
- 39:27value to predict whether eight hours ahead of time.
- 39:32So this support Vector machine is a Time series model, which
- 39:36predicts eight hours ahead in time.
- 39:39And basically, here we start Fast API object, and we take the
- 39:48model scalar, which scales the incoming data bit between minus
- 39:531 to 1. And then we have the model
- 39:56loaded as well. And here at the end, point
- 40:00predict, we take in the input data in terms of these variables
- 40:05and we simply scale it using the model scalar and then we predict
- 40:11it. It's a rain or no rain.
- 40:14So using this information in the hypothetical business problem,
- 40:18the port was able to train so that was the idea of this web
- 40:23service of this fast API server. So I'm do you see my terminal
- 40:30now? Yes, yes, yes.
- 40:35So yeah. I'm going to run that fast API
- 40:41microservice locally and we'll test it using locus of how
- 40:46robust is So there's no Docker container running at this point.
- 40:54I have run that image in my PC. Local in am spinning up a
- 41:00container. Now for that past API service
- 41:04and when we go to the service now it should work as it is with
- 41:10the predict endpoint that we saw before we make a post request
- 41:15and for the Post request, you can have your input data
- 41:20whatever. Mission.
- 41:21There is and it should give you a response.
- 41:23I have a model input data that we can drive it.
- 41:32Try it out. So you can see the values
- 41:38temperature, decreased, immunity, and all this.
- 41:41So we input this data to the service and we get the
- 41:44prediction if it rains. Yeah it says it rains for this
- 41:48kind of condition so this is what we're basically doing with
- 41:52this past API service and now let's check it out.
- 41:55Check out how to load test this if it's able to handle 50 users.
- 42:01Users what is the scenario? What happens really when we give
- 42:06this service in production? For example, to the users.
- 42:10So imagine this service is not running locally but it's running
- 42:13in product, I'm just running it locally now just to demonstrate
- 42:18to you. So we'll have to just deploy
- 42:21this Docker container in your deployment.
- 42:24Target to get it in production. But here for load testing.
- 42:30Use something called Locust IO which is an open source tool and
- 42:36it comes to the form of SDK which can be integrated to your
- 42:39ml Ops workflow. And you can see the script is
- 42:43very simple here, where we use these three methods from Locust.
- 42:50So we use Locust, and use these three methods, HTTP user tasks.
- 42:55And between, and we take the dump data, which is the input.
- 43:00Data. So, the HTTP user that works
- 43:05using the Locust will bombard the API service that we deployed
- 43:10in production, or we're running locally now with this dump data.
- 43:14So the data would be constant but you'll make multiple
- 43:17requests that's the idea. So here we create a class with
- 43:22your name of your choice and and pass the HTTP user that will
- 43:28make requests to your endpoint. And And here you point to the
- 43:34service to make a post request and you sending the data and the
- 43:40header, which is adjacent content type.
- 43:43So here you don't mention the endpoint.
- 43:47Now will spin up the Locust or IO server and it's a server,
- 43:51it's a web service that runs your in your infra, but it can
- 43:56be also a script that can run and give you output.
- 44:00So you In that output, you can work around in your CI, CD
- 44:04Pipeline and say if it passes a load test or not.
- 44:08So let's spin out those local store IO.
- 44:23So I'm starting the Locust server which spins up the web
- 44:27interface. It has a cool web interface so
- 44:31it runs on localhost 1889. So here you have a choice where
- 44:40you should mention your end point that you want to test.
- 44:43So I'm going to use my Local Host 8080 because I'm running
- 44:48the service locally you can deploy it on some endpoint on
- 44:52cloud or Deployment Target and give that endpoint address yet
- 44:56tested. So I'm going to simulate a
- 44:58scenario where I will try to have 50 users testing and have a
- 45:06spawn rate which will be not s number of users per second.
- 45:10So this will let say we spawn up 10 users for each second until
- 45:15it gets 50 users and bombarding the endpoint with 50 users.
- 45:20So let's start the load test. So, here you see that the test
- 45:27has started now for the predict endpoint and there are some
- 45:31requests going with the dummy data or the data dump, we had in
- 45:35the Locust script and there are zero fails for.
- 45:40Now this is the aggregated data. You can see and We can also look
- 45:48at the median time for the request response time and look
- 45:52at charts as well. So the charts charts, look
- 45:56something like this. We can see what time requests
- 45:59are coming to the end point. And at what time, how many
- 46:03number of requests are being done per second.
- 46:05As you can see 15.2 16 requests in a second being sent to the
- 46:12service and you can see the average response time And the
- 46:17number of users exponentially over time.
- 46:20As we requested, 10 users to respond up here 50 user.
- 46:24There's are constantly bombarding the service so it is
- 46:29a HTTP users and you get critical information like this
- 46:33total requests per second and how many have passed as you can
- 46:37see, there's one failure here. You can, of course, go back to
- 46:41your logs and see why it has failed that kind of information.
- 46:45Can be useful to handle such an error if it happens in
- 46:51production so you can see your failures here.
- 46:56So there's also locks that come in here.
- 46:59It is connection error. Something with my Local Host.
- 47:05Yeah and you can also see exceptions.
- 47:09Here, there are some things that happen.
- 47:11You can download this data and further inspect but I wouldn't
- 47:14recommend this. RC IC D pipeline.
- 47:17I would recommend using using SDK to to logout the outputs of
- 47:25the test and let's say, if you are, you have a, I will stop
- 47:29this test now and let's say, you have this test, go on for two
- 47:33minutes and you have the end results and you see that all
- 47:37your requests are passing. There's no fail.
- 47:40Then you can take it to production otherwise just have a
- 47:44look at your Logs, why is it failing and try to address that
- 47:50before taking it to production? So this kind of a tool can be
- 47:54useful, especially in quality assurance also interface where
- 48:00you can load, test your microservice before you deploy
- 48:04it to production. So, you get a idea of what it
- 48:07can be with X number of requests and X number of users trying it
- 48:12out. So, Yeah, that is what we have
- 48:14for today. So, is there a way to automate
- 48:19this in your, in, your pipeline, or in, in your whole strategy?
- 48:26Yeah, the way to automate would be to have this script log out
- 48:34or send locks if for a number of requests that have been done,
- 48:39how many have passed? And how many have failed this
- 48:41kind of statistics. And you can have a script like
- 48:45this part of your Q&A, for example, where you do test, and
- 48:50this test would tell you X number of failures and if there
- 48:55is no failure, then automatically deploy the service
- 49:00to production. If there is failure, and of
- 49:02course, you would need human intervention and inspection to
- 49:06see what's the cause and so forth.
- 49:08So having this script as part of Q&A or Dev can Give you an idea
- 49:14of the kind of load and how the performance of the microservices
- 49:19before taking it to production. Amazing.
- 49:27So I think that is That's all. We've got unless there's any
- 49:34more questions. This has been awesome and I had
- 49:37no idea about Locust and I think you instantly see the value of a
- 49:43tool like that and and why you would want to use it.
- 49:47So that's really cool to see. I want to thank you for coming
- 49:51on here and is there anything else that we we should know
- 49:55about you? And I know you're in the
- 49:57community slap but if somebody wants to reach out, what's the
- 49:59best way to do it? Yeah, first of all, thank you
- 50:03Danny for having me here and I was, of course, looking forward
- 50:07to have discussions, especially all the awesome discussions that
- 50:11happen on envelopes community. And I'd like to point out that
- 50:16the book is out, engineering analogs, you can learn all these
- 50:20tips and tricks of having a robust cic pipeline ml apps in
- 50:25general. See two such as Locust ml flow
- 50:29and all the tools that Usually handy and it comes to Emily Ops
- 50:33workflow. Check out the book.
- 50:37But otherwise it's been a pleasure to have the demo and
- 50:40have these awesome descriptions and every time we have this
- 50:44discussion, there's quite some nice Reflections happening.
- 50:47So thank you for that and it's been a pleasure.
- 50:51Yeah. And for those that do not know,
- 50:54I'm throwing the book in the chat again, one last time.
- 50:58And are you going to To create a course ever.
- 51:03Right? Also that's in the pipeline as
- 51:05well because some people like to read books, some people like
- 51:09online content, so the video content is ongoing and of course
- 51:16should be out on udemy next month and somewhere where I
- 51:20cannot third week that was fast. Really cool.
- 51:24Well, keep us posted when it comes out and we'll put it in
- 51:27the description in YouTube for those who are watching this in
- 51:30the future. As for now.
- 51:32Thank you everyone for joining us.
- 51:35And we will see you next week. Same place, same time.
- 51:39Yes, thank you. It's been a pleasure.
- 51:41All