<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jonathan Yarkoni on Medium]]></title>
        <description><![CDATA[Stories by Jonathan Yarkoni on Medium]]></description>
        <link>https://medium.com/@jy2k?source=rss-31ffadff3371------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2O4h1AifgVordncVwe_vsQ.png</url>
            <title>Stories by Jonathan Yarkoni on Medium</title>
            <link>https://medium.com/@jy2k?source=rss-31ffadff3371------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:13:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jy2k/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating a Kubeflow Pipelines Component]]></title>
            <link>https://jy2k.medium.com/creating-a-kubeflow-pipelines-component-d87c1611dc1c?source=rss-31ffadff3371------2</link>
            <guid isPermaLink="false">https://medium.com/p/d87c1611dc1c</guid>
            <category><![CDATA[kubeflow-pipelines]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mlops]]></category>
            <dc:creator><![CDATA[Jonathan Yarkoni]]></dc:creator>
            <pubDate>Mon, 10 May 2021 15:31:13 GMT</pubDate>
            <atom:updated>2021-05-10T15:31:13.648Z</atom:updated>
            <content:encoded><![CDATA[<p>Kubeflow pipelines is quickly becoming the industry standard for creating and managing ML pipelines. Using Kubeflow pipelines SDK you can create a pipeline by specifying a DAG with several sequential / parallel steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NazSa1aHv2UZkfpb" /></figure><p>Each step is a component which runs in a container.</p><p>In this blogpost we will go over the steps needed to create component.</p><h3>Assumptions</h3><ul><li><a href="https://www.kubeflow.org/docs/components/pipelines/sdk/install-sdk/">Install KFP SDK</a></li><li>Basic familiarity with <a href="https://riptutorial.com/docker/example/10772/helloworld-dockerfile">Docke</a>r and Python</li></ul><p>A component is a re-usable step that can be incorporated into a pipeline.</p><h3>Steps to Creating a Component</h3><ol><li>Build a function</li><li>Add dependencies into the function</li><li>[optional] Use a custom docker image</li><li>[optional] Dynamically install packages.</li><li>Create component from function</li><li>[optional] git component</li><li>[optional] load and re-use component</li></ol><h3>1. Build a function</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/424b65d42634280e36a78acc29e7b59e/href">https://medium.com/media/424b65d42634280e36a78acc29e7b59e/href</a></iframe><h3>2. Add dependencies into the function</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97fcf0cf3020451b007bedf7a56d687f/href">https://medium.com/media/97fcf0cf3020451b007bedf7a56d687f/href</a></iframe><h3>3. [optional] Use a custom docker image</h3><p>If you would like to create custom dependencies to use in step #2 you can bake them into the image. In order to do so:</p><p>3.a. Create a <a href="https://takacsmark.com/dockerfile-tutorial-by-example-dockerfile-best-practices-2018/">Docker Image from a Dockerfile</a>.</p><p>3.b. <a href="https://cloud.google.com/artifact-registry/docs/docker/pushing-and-pulling">Upload</a> Docker Image to an <a href="https://cloud.google.com/artifact-registry/docs/how-to">accessible container registry</a> (preferably <a href="https://cloud.google.com/artifact-registry">artifact registry</a>)</p><h3>4. [optional] Dynamically install packages.</h3><p>In step #5 you can use the Docker image from step #3 and dynamically install packages via to separate arguments passed to the ‘func_to_container_op’ function.</p><h3>5. Create component from function</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4de9378d70339e7b64b530da9862603/href">https://medium.com/media/b4de9378d70339e7b64b530da9862603/href</a></iframe><p>Notice how the 3rd argument is the container registry image path from step #3 and the 4th argument is an array of packages to install dynamically from step #4.</p><p>The first argument is the python function to be converted to run as a step in a pipeline.</p><p>The second argument is the output path for the re-usable component: ‘bq_to_csv.yaml’</p><h3>6. [optional] git component</h3><p><a href="https://cloud.google.com/source-repositories/docs/pushing-code-from-a-repository">Pushing code from an existing repository</a></p><pre>git push --all google</pre><h3>7. [optional] load and re-use component</h3><p>Once you have access to the ouput file from step #5 you can load and reuse the file in any Kubeflow pipeline DAG.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e436fc1dd25a6e82361ee04aec2b8ebe/href">https://medium.com/media/e436fc1dd25a6e82361ee04aec2b8ebe/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d87c1611dc1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serving a Python Container in Production]]></title>
            <link>https://jy2k.medium.com/serving-a-python-container-in-production-b1de210ba7ee?source=rss-31ffadff3371------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1de210ba7ee</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[mlops]]></category>
            <dc:creator><![CDATA[Jonathan Yarkoni]]></dc:creator>
            <pubDate>Fri, 02 Apr 2021 13:54:46 GMT</pubDate>
            <atom:updated>2021-04-02T13:54:46.627Z</atom:updated>
            <content:encoded><![CDATA[<h4>Build, deploy and predict</h4><p>The code for this example is available on <a href="https://github.com/jy2k/container-serving-ai-platform">Github</a>.</p><h4>Goals</h4><p>The world of ML is vast. There are many different different tools to amalgamate if you want to maximize value. Going from research to production is not trivial. There are many things to consider and many decisions to make. I often stumble upon customers who use different frameworks such as Sci-kit, Pytorch and Tensorflow. Several customers use multiple frameworks and some even want to serve legacy python models.</p><p>In this post we will go through all of the steps necessary to build and deploy containers to AI Platform’s “models” product. This blogpost aims at providing a starting point for someone with a basic model who is looking to set up a framework- agnostic service layer which is secured, scalable and backed by an SLA. We will be making use of AI Platform’s ability to wrap any code and serve it.</p><h4>Non-Goals</h4><p>Containers are an incredible tool but I won’t be covering them in depth. For the purpose of this tutorial the main benefits are ease of deployment and the framework agnosticity they provide.</p><h3>Why use AI Platform endpoints?</h3><p>An organization should focus on it’s core business. It is rarely the case that creating a robust scalable serving layer is the business objective. You could design and build a capable serving layer using custom components such as a <a href="https://cloud.google.com/load-balancing/docs">load balancer</a> and an <a href="https://cloud.google.com/compute/docs/instance-groups/distributing-instances-with-regional-instance-groups">instance group</a> of VM’s. GCP’s AI platform allows us to accelerate development by making use of ancillary services such as data preparation, metadata layer, feature store, etc. It can significantly shorten your deployment cycle and maintenance overhead.</p><h3>Advantages</h3><ul><li>Framework agnostic</li><li>Infrastructure</li><li>GPUs</li><li>Scalability</li><li>Secure</li><li>SLA</li><li>Real-time / batch requests</li><li>Ease of development</li><li>Time to deployment</li><li>gRPC</li></ul><h3>Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jSfDzS3dpjoU5awW_WnjBw.png" /></figure><h3>Working with custom containers</h3><p>Our end goal is to have a service available behind an endpoint that we can use to make real-time requests and batch requests. Even though AI Platform is capable of natively handling serving for frameworks such as Tensorflow, Pytorch and Sci-kit, containers have become the de-facto go to on every step of the MLops pipeline. You can choose from a wide list of prebuilt <a href="https://cloud.google.com/ai-platform/deep-learning-containers/docs/choosing-container">images available on AI platform</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BMACnalzl-1fsewC" /></figure><h3>Preparing the container</h3><p>For us to work with the AI Platform’s serving layer we must upload a container to an Artifact Registry hosted in the same project . Make sure that the service account used has the <a href="https://cloud.google.com/artifact-registry/docs/docker/authentication#gcloud-helper">proper permissions</a> to read the container (learn more about <a href="https://cloud.google.com/iam/docs/service-accounts">service accounts</a>). When building the container we need to <a href="https://cloud.google.com/ai-platform/prediction/docs/custom-container-requirements">follow AI platform’s requirements</a>.</p><p>First we create a Dockerfile. There is no need to invent the wheel. There are many base images we can build on top of. Since we’re using Python and need a running server I choose to create a basic <a href="https://runnable.com/docker/python/dockerize-your-flask-application">flask image</a>.</p><p>Create a Dockerfile file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QW73OS2Hpt4sMCxL" /></figure><p>And from here we see that we need to add the requirements.txt file containing one line with the flask dependency:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/0*wjXlEtFU3W7ZHIM0" /></figure><p>And the app.py which can be replaced with any other code such as serving a Tensorflow model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/0*zqln_LaSdMXQLmc5" /></figure><h3>Steps</h3><p>Now we will use the container. We will run the steps using an <a href="https://cloud.google.com/ai-platform-notebooks">AI platform managed notebook service</a>.</p><ol><li>Create the docker:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bK9ip4trr_OJFU4w" /></figure><p>2. Push the docker to the an <a href="https://cloud.google.com/artifact-registry/docs/manage-repos">Artifact Repository</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/0*l-TndjSoA3fmAqUc" /></figure><p>3. Create a model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/0*cOPQNyiUnCyCDH4S" /></figure><p>4. Upload new version to the model from step #3:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-CvxH_Tm5S0jqp2v" /></figure><p>5. Set the version as default:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/0*TpsBvP30CWuMgvW3" /></figure><p>6. Test the endpoint:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xQXNbMxihITvqqO_" /></figure><p>7. Rinse and repeat ~~~~~</p><h3>Conclusion</h3><p>Unless there are constraints that force you to deploy on the edge the advantages AI platform and ease of use of containers outweigh the benefit of building out a custom service.</p><h3>Next steps</h3><p>Follow this <a href="https://cloud.google.com/ai-platform/prediction/docs/getting-started-pytorch-container">guide to serve pytorch models</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1de210ba7ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>