<?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 Enias Cailliau on Medium]]></title>
        <description><![CDATA[Stories by Enias Cailliau on Medium]]></description>
        <link>https://medium.com/@enias.cailliau?source=rss-cf1ec8d63220------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u-Tfz9S7GUcO-c4OIXfAFw.png</url>
            <title>Stories by Enias Cailliau on Medium</title>
            <link>https://medium.com/@enias.cailliau?source=rss-cf1ec8d63220------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 00:26:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@enias.cailliau/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[Indexing your podcasts with language AI in Python]]></title>
            <link>https://medium.com/steamship/indexing-your-podcasts-with-language-ai-in-python-9fe4bb17aa9e?source=rss-cf1ec8d63220------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fe4bb17aa9e</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Enias Cailliau]]></dc:creator>
            <pubDate>Tue, 18 Oct 2022 13:02:16 GMT</pubDate>
            <atom:updated>2022-10-18T14:17:49.979Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XWFIwWYQRXXvCn_vKGAEOQ.jpeg" /></figure><h3>How to index your podcasts with language AI in Python</h3><p>The other week I wrote about using <a href="https://medium.com/steamship/im-consuming-5000-hours-of-joe-rogan-with-the-help-of-ai-9cb7cc7a4985">Language AI to listen to 5500 hours of Joe Rogan’s podcasts</a>. My code reads in MP3s, transcribes them, tags entities and sentiments, and then gives you a query endpoint to search the results.</p><p>I kept that post high level, so I wanted to follow up with a tutorial on how you can use the code I wrote on your own audio. The examples below are in Python, but it runs over an HTTP API, so you could do these from Javascript, R — Microsoft Excel if you’ve got that axe to grind… (reach out if you need help)</p><h3>In 5 minutes, you’ll have analyzed your own audio</h3><p>In this post, we’ll step through a minimal example where I’ll try to answer 2 questions from one of Joe Rogan’s podcasts:</p><ul><li>What does Edward Snowden say about Trump, Obama, and Biden?</li><li>What makes Edward Snowden sad?</li></ul><p>Let’s go!</p><h3>Step 1. Connect to Steamship</h3><p>We’ll be using Steamship to run our AI pipeline. So you’ll need to set up your Steamship credentials. You can log in and fetch your credentials using the CLI if it&#39;s your first time connecting to Steamship.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b675b88b31e0a95777da1c2c09ca29bc/href">https://medium.com/media/b675b88b31e0a95777da1c2c09ca29bc/href</a></iframe><h3>Step 2. Import my audio-analytics package</h3><p>I wrapped all the code you need in a <a href="https://medium.com/steamship/steamship-packages-full-lifecycle-language-ai-for-software-developers-df1be522a630">package</a> called audio-analytics (<a href="https://github.com/steamship-packages/audio-analytics">link to repo</a>). Here’s how you can spin up your own instance to run it in a private workspace.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe2740ed9675fc24bcfaf88eda3278f4/href">https://medium.com/media/fe2740ed9675fc24bcfaf88eda3278f4/href</a></iframe><p>A Steamship package instance auto-scales, so you only have to do this once for each workspace. You can browse through the package code <a href="https://github.com/steamship-packages/audio-analytics-app">here</a>, but here’s the TLDR of what I do: I use distributed Steamship services called plugins to transcribe, analyze, and index audio files.</p><h3>Step 3. Upload your audio</h3><p>You can upload your mp3 files by pointing to a publicly accessible URL. Any publicly accessible URL will work, including pre-signed URLs to S3 or Google Storage. If you want to upload local audio files directly to your package, you can use the helper method upload_audio_file featured <a href="https://github.com/steamship-packages/audio-analytics/blob/main/examples/utils.py">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2f9bf1558b18cac3cbf6b7a3a162a04/href">https://medium.com/media/a2f9bf1558b18cac3cbf6b7a3a162a04/href</a></iframe><h3>Step 4. Transcribe and analyze your audio</h3><p>Your instance will transcribe, analyze, and index your mp3 asynchronously as soon as you’ve uploaded it. You’ll have to wait for the analysis to finish to fetch the transcription and its language AI features.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/98e7cda7fe3769959fc67cf3bf3913a0/href">https://medium.com/media/98e7cda7fe3769959fc67cf3bf3913a0/href</a></iframe><h3>Step 5. Getting the transcription and language AI features</h3><p>Each file contains a transcript, and a list of language AI features called tags.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eea89df6487b004aa3a49f4ffe3f0a64/href">https://medium.com/media/eea89df6487b004aa3a49f4ffe3f0a64/href</a></iframe><p>Once processed, you’ll receive a file that includes a transcript and tags containing 7 unique language AI features. All tags are anchored to the transcription, meaning you can navigate overlapping features using queries. For those interested, I created a more in-depth workshop that looks at the language AI features <a href="https://github.com/steamship-packages/audio-analytics/blob/main/examples/audio-analytics-python-client-demo.ipynb">here</a>.</p><h3>Step 6. Query</h3><p>All the audio files you upload to your instance will get added to your private workspace for future retrieval. That means we can use queries to retrieve relevant fragments and extract statistics across all your audio files in one go.</p><p>In this example, we’ll answer two questions:</p><h4>What does Edward Snowden have to say about Trump vs Obama?</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5682692be7f756d9ef2478117a0d5545/href">https://medium.com/media/5682692be7f756d9ef2478117a0d5545/href</a></iframe><p>Snowden is quick to point out that both presidents have all made mistakes, war on whistleblowers (<a href="https://www.youtube.com/watch?v=_Rl82OQDoOc&amp;t=1315s">link</a>), drone strikes (<a href="https://www.youtube.com/watch?v=_Rl82OQDoOc&amp;t=1315s">link</a>), and other abuses (<a href="https://youtu.be/_Rl82OQDoOc?t=1912">link</a>). Meanwhile, Joe Rogan suggests Trump might pardon him (<a href="https://youtu.be/_Rl82OQDoOc?t=3055">link</a>). Snowden politely disagrees and suggests he might not accept a pardon from Trump if it happens.</p><h4>What makes Edward Snowden sad?</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc89835e0570752986e6a5fabcb953d2/href">https://medium.com/media/fc89835e0570752986e6a5fabcb953d2/href</a></iframe><p>We all know Snowden does not feel happy with the NSA, CIA, or FBI, but interestingly he also has some negative thoughts about Julian Assange and Wikileaks.</p><h3>It’s up to you now</h3><p>That’s it, really, a few lines of code. I scaled my instance and workspace to contain more than 50 of Joe Rogan’s podcasts and make them queryable. You can see the results <a href="https://joe-rogan-index.streamlitapp.com/">here</a>. I’m curious to see what cool apps YOU can make with this. Searching your Voice memos on your phone? Finding strange statements in CSPAN hearings? Finding every negative thing Sylvester Stallone ever said about Arnold Schwarzenegger?</p><p>Comment down below what you want to build, and we’ll make it happen 💪</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fe4bb17aa9e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/steamship/indexing-your-podcasts-with-language-ai-in-python-9fe4bb17aa9e">Indexing your podcasts with language AI in Python</a> was originally published in <a href="https://medium.com/steamship">Steamship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I’m consuming 5000+ hours of Joe Rogan with the help of AI]]></title>
            <link>https://medium.com/steamship/im-consuming-5000-hours-of-joe-rogan-with-the-help-of-ai-9cb7cc7a4985?source=rss-cf1ec8d63220------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cb7cc7a4985</guid>
            <category><![CDATA[podcasting]]></category>
            <category><![CDATA[joe-rogan]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Enias Cailliau]]></dc:creator>
            <pubDate>Thu, 22 Sep 2022 15:02:19 GMT</pubDate>
            <atom:updated>2022-09-22T15:02:19.927Z</atom:updated>
            <content:encoded><![CDATA[<h3>I’m consuming 5500+ hours of Joe Rogan with the help of AI</h3><blockquote><em>Update: I’ve turned this post into a weekend hustle — </em><a href="https://joeroganbible.substack.com/subscribe"><em>subscribe here</em></a><em> to receive weekly insights from Joe Rogan and his guests.</em></blockquote><p><em>I used state-of-the-art language AI to analyze and index Joe Rogan’s podcast. Doing so resulted in a publicly available full-stack AI package. This blog demonstrates how I’ve made it happen. Stick around for a demo and amusing insights I distilled from the pods!</em></p><p>This summer, I had another strike of information FOMO: I’d never heard a Joe Rogan podcast.</p><p>I reached this “horrifying” conclusion as I met my techie friends at a pizza and beer-fueled after-work. Part of the group was COVID transplants from the US. They were talking about some guy named Joe Rogan, who was either the most extraordinary person alive or a blight on the world, depending on who was talking. After half an hour of “aha”, “Oh, yes, interesting” and “Oh, no, 🤯”… I finally came clean: “I have no idea who Joe Rogan is”. 😬</p><p>Back home, I felt overwhelmed by FOMO. It sounded like Joe Rogan was the king of debate, often exploring controversial topics with his guests. I like to challenge myself by looking at life through the lens of other people, so I sat down to queue up a bunch of episodes. But when I looked at the queue my brain exploded 🤯: 5,000+ hours of aliens, weed, and MMA.</p><figure><img alt="The stats on Joe Rogan are both impressive and daunting at the same time" src="https://cdn-images-1.medium.com/max/1024/1*Cu-RYv4nsgfy1i03Mte-XA.png" /></figure><p>I can deal with aliens and weed, but 5,000+ hours? That’s more than 200 days of listening back-to-back. Even if I consumed at 2x speed like some of my “entrepreneur” friends, it would take me a whole year if I stretched myself thin and listened 8 hours a day. And that’s not counting the 15 NEW hours of content each week. There was only one conclusion: I would never catch up. 😭</p><p>💡 Then I realized, “Enias, you work at an NLP startup. Just have the computer tell you what this guy thinks”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*a3FS3T169y7sNnNGIoLdOQ.png" /></figure><h3>AI to the rescue</h3><p>What I needed was a solution that summarizes podcasts for me.</p><p>But of course, that wasn’t enough. I wanted a tool that responded to the random questions that popped into my brain. For example, this morning, I wondered: “What do Joe Rogan’s guests say about Cocaine? Spoiler alert: Joe Rogan and his guests like to talk about powdering their noses.</p><p>Luckily, AI is catching up. Speech-to-text turns podcasts into text. Language models summarize long-form content in seconds (and a hefty amount of 💰). It sounds like we have a solution. Let’s start building, shall we?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*mn2tS6XWprjmYLAjEBiduw.png" /></figure><h3>The solution</h3><p>Disclaimer: I’m a founding engineer at <a href="https://www.steamship.com/">Steamship</a>. We’re building the fastest way to add language AI to products. To the NLP-savvy engineer, Steamship works like an NLP operating system that makes it easy to process and query natural language with few lines of Python.</p><p>So logically, I ate my own dog food and built the podcast app using Steamship. It’s bundled in a package <a href="https://medium.com/steamship/steamship-packages-full-lifecycle-language-ai-for-software-developers-df1be522a630">you can import and use on other podcasts and audio files</a>. Here’s how I did it:</p><h4>1. Transcribe the podcasts</h4><p>I used two transcription providers, AWS and <a href="http://assembly.ai/">Assembly.AI</a>, to turn audio into text. After some basic testing, I found <a href="http://assembly.ai/">Assembly.AI</a> to be better than AWS, especially when figuring out who was speaking using speaker diarization.</p><h4>2. Analyse the transcriptions</h4><p>I used a mix of models from HuggingFace, <a href="http://assembly.ai/">Assembly.AI</a>, and OneAI to analyze the transcriptions. There isn’t a winner-takes-all to generate insights, and I found poor transcription quality and long podcasts degrade performance.</p><h4>3. Orchestrate the NLP models</h4><p>After plowing in Jupyter notebook for a day, I knew I couldn’t make it happen from just my laptop. Analyzing a single podcast takes 70 minutes. 40 minutes to transcribe the audio. Another 30 minutes to generate summaries and highlight language AI features. Combine the high latency with an unstable internet connection as a digital nomad, and you get chaos.</p><p>This is where Steamship’s packages come in. You can use them to bundle long, diverse workloads that run in the cloud and save the results for querying later.</p><p>Inside my “audio-analytics” package, I added an endpoint to download, transcribe, and analyze podcasts:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6287ed2e72b9060d8f5b58931dd9b7e3/href">https://medium.com/media/6287ed2e72b9060d8f5b58931dd9b7e3/href</a></iframe><h4>4. Store and make the insights queryable</h4><p>Once the Steamship package is bundled and deployed, I can just import and use it on my computer while the logic runs in the cloud.</p><p>Here’s how:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1166f6b04aa3fb3e674fcd09e71150b1/href">https://medium.com/media/1166f6b04aa3fb3e674fcd09e71150b1/href</a></iframe><h3>3 insights and a newsletter</h3><p>Here are 3 insights I extracted from the podcast.</p><h4>Have another beer</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*BFD7CwSpE6Xj2mjWMUtW1A.jpeg" /></figure><p>Sorry, I had to give in to the crowd. Indexing for Corona and the pandemic gives me these quotes:</p><ul><li><a href="https://youtu.be/LimytC6bNZ0?t=487">Andrew Shulz</a>: “Corona actually saves lives”</li><li><a href="https://youtu.be/vzx6h2sAGTU?t=1355">Kevin Hart</a>: “The Pandemic showed me how our economy really F* works”</li></ul><h4>Most guests are Google fanboys</h4><ul><li>Jordan Peterson idolizes <a href="https://youtu.be/6T7pUEZfgdI?t=922">Google employees as elite</a>; 1% people. For those wondering, I’m part of the 99%. Call me ordinary.</li><li><a href="https://youtu.be/_Rl82OQDoOc?t=190">Edward Snowden praises Google’s encryption</a>. Not bad when the most famous NSA agent praises your security. I feel safer as I type this in G Doc.</li><li>Joe Rogan and Andrew Shulz google <a href="https://youtu.be/LimytC6bNZ0?t=5976">#spaceisfake and #worldisflat</a>. That’s one way to spend your Sunday afternoon!</li></ul><h4>Social Media causes depression</h4><p>Joe Rogan likes to ask his guests how they feel about social media, priming them to link it to depression. Funny because most of his guest live off social media. <a href="https://youtu.be/vzx6h2sAGTU?t=4874">Kevin Hart</a> recommends you look at yourself in the mirror to index your strengths and flaws. Don’t let people tell you something you don’t already know. Meanwhile, the <a href="https://youtu.be/hcPUoxTvw5g?t=1712">real fighters</a> of the pod hint that special herbs pump you back up and improve your self-image.</p><h4>Bonus: Calf implants are cool in Miami (<a href="https://youtu.be/BBCl9A9NlRw?t=4430">link</a>)</h4><p>This doesn’t need text beside this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*ZTBpJnxJ1iYFlSROtaCqfg.png" /></figure><h4>Newsletter</h4><p>This whole project was so much fun to build that I’m creating a weekend newsletter out of it. I’ll share AI-generated insights and summaries from the Joe Rogan pod every weekend — you can subscribe <a href="https://joeroganbible.substack.com/subscribe">here</a>. Each e-mail will serve a summary of this week’s podcasts paired with 3 funny shots distilled from Joe’s 2050+ podcasts 🥃. The first release is scheduled for next Saturday!</p><h3>Demo</h3><p>I built a public demo where you can explore Joe Rogan’s podcasts through the lens of AI. Have fun <a href="https://steamship-packages-podcast-analytics-demo--home-pk4y66.streamlitapp.com/">here</a>. If you want to use this app on your own podcast or audio, reach out with the link in the demo.</p><h3>Join us!</h3><p>If you’ve come this far, we’re looking for software developers who want to try building their own packages using our SDK. If you want early access, hit me on my socials and say: “FIGHT FOMO TOGETHER”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cb7cc7a4985" width="1" height="1" alt=""><hr><p><a href="https://medium.com/steamship/im-consuming-5000-hours-of-joe-rogan-with-the-help-of-ai-9cb7cc7a4985">I’m consuming 5000+ hours of Joe Rogan with the help of AI</a> was originally published in <a href="https://medium.com/steamship">Steamship</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tensorflow + Sagemaker = ❤]]></title>
            <link>https://medium.com/superlinear-eu-blog/tensorflow-sagemaker-d17774417f08?source=rss-cf1ec8d63220------2</link>
            <guid isPermaLink="false">https://medium.com/p/d17774417f08</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Enias Cailliau]]></dc:creator>
            <pubDate>Wed, 21 Nov 2018 08:36:55 GMT</pubDate>
            <atom:updated>2018-11-21T08:36:55.909Z</atom:updated>
            <content:encoded><![CDATA[<h3>TensorFlow + SageMaker = ❤</h3><p>Amazon SageMaker is a managed machine learning service (MLaaS). The platform lets you quickly build, train and deploy machine learning models. In this blog post, we’ll guide you through a typical development process using the latest developments from SageMaker such as <a href="https://aws.amazon.com/about-aws/whats-new/2018/05/pipe-input-mode-is-now-supported-in-amazon-sagemaker-algorithms">pipe input mode</a> and <a href="https://aws.amazon.com/blogs/aws/sagemaker-automatic-model-tuning/">automatic model tuning</a>.</p><blockquote>This article is the second article in the series: “Accelerating deep learning development using SageMaker”. During this series, we explore the added value of using SageMaker for Deep Learning development. Part 1 provides a general overview of what SageMaker has to offer. This second part will provide a more technical view on how development lifecycles can be accelerated using the SageMaker ecosystem.</blockquote><p>In this tutorial, we will develop a Convolutional Neural Network (CNN) to classify fashion items in the <a href="https://github.com/zalandoresearch/fashion-mnist">Fashion MNIST</a> dataset from <a href="http://www.zalando.com/">Zalando</a>. This dataset contains 55.000 training samples and 10.000 validation samples. Each sample is a 28x28 grayscale image of a clothing item linked to a label. In total, there are ten possible labels; t-shirts, trousers, pullovers, dresses, coats, sandals, shirts, sneakers, bags, and ankle boots.</p><p>This tutorial will guide you through three essential stages in machine learning development; data-engineering, optimisation and deployment. We will use SageMaker to make it easier to iterate from one model to another. First, we will prepare the dataset so that we can stream data to our model during training. Then we will optimise our model using a distributed version of hyperparameter tuning. As the last step, we will deploy the TensorFlow model as a service.</p><p><em>This article is written in a code-along format. If you want to dig into the code yourself, you can find useful notebooks on the </em><a href="https://github.com/radix-ai/sagemaker-tensorflow-tutorial"><em>GitHub repository</em></a><em> of this article.</em></p><h3>Part 1: prepare data for streaming</h3><p>SageMaker offers two modes for streaming datasets to your model: <em>PIPE</em> mode and <em>FILE</em> mode. <em>PIPE</em> mode reduces overhead by streaming training and validation data straight from S3 storage. Using this input mode has three key advantages compared to downloading a file in <em>FILE</em> mode:</p><ol><li>Training jobs can start sooner since they don’t need to wait for the full dataset.</li><li>Training instances require less storage space since the dataset is never physically stored.</li><li>Streaming data from S3 is faster than streaming from a local file since the S3 filehandles are highly optimised and multi-threaded.</li></ol><p>More information on <em>PIPE</em> input mode can be found <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo.html">here</a>.</p><h4>Transforming dataset samples to TFRecords</h4><p>We first need to transform our data into a data structure which is compatible with the <em>PIPE</em> input mode. Currently, <em>PIPE</em> supports two file formats: RecordIO encoding and TFRecord encoding. For our development, we will use TFRecord encoding.</p><p>First, go to the SageMaker console and create a fresh SageMaker Jupyter Notebook instance using an instance type of your choice. During the development of this article, I used the <em>ml.t2.xlarge</em> instance type.</p><p>Once your Jupiter environment is ready, you can open it and create a new notebook with the <em>conda_tensorflow_p36</em> kernel. We can verify that Tensorflow is available by printing the Tensorflow version.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/57a2c3440964b40cdc77b42e66a987ee/href">https://medium.com/media/57a2c3440964b40cdc77b42e66a987ee/href</a></iframe><p>Now that we verified Tensorflow is available we can start preparing our dataset. First, we import the dataset and observe the shapes (dimensions) of the training set and validation set.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f95b24f215d04ef6d34749daab4ac3e/href">https://medium.com/media/0f95b24f215d04ef6d34749daab4ac3e/href</a></iframe><p>Optional: If you want you can have a look at some examples from the MNIST Fashion dataset.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7a22d76a9035c6a0ed0e7153ab9f570/href">https://medium.com/media/e7a22d76a9035c6a0ed0e7153ab9f570/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YL8kulEds-snyN2rrCyA-g.png" /></figure><p>We will write a helper function that stores a dataset in the form of TFRecords. The code for this helper function is not that expressive but lines 25–30 contain the essence; We store each sample (image + label) in a single TFRecord. When saving the image in a binary representation, we lose some information such as height, width and number of colour-channels. Therefore we also store these dimensions in the TFRecord format.</p><p>If you want to understand how to transform a dataset into TFRecords, you can read more about this binary format in <a href="https://goo.gl/4L365r">this blog</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21848a67ee3f2083bcb6cf2e2ec5f74a/href">https://medium.com/media/21848a67ee3f2083bcb6cf2e2ec5f74a/href</a></iframe><h4>Storing TFRecords on s3</h4><p>Let’s now transform the dataset into TFRecords using our helper function. Since the pipe input mode is based on S3 filehandles, it is required to store the complete dataset on S3. We’ll save the data using the upload_data function. Once the store operation completes, it returns an s3 url which points to the uploaded data.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a191af0b1ddc3861b0652b184871d70/href">https://medium.com/media/0a191af0b1ddc3861b0652b184871d70/href</a></iframe><h3>Part 2: Model design</h3><p>Now that our dataset is available on s3 we can start implementing our CNN in TensorFlow. First, create a new notebook using the <em>conda_tensorflow_p36 </em>kernel. We named our notebook <em>tune_fashion_network.ipynb</em>. At the top of this notebook, make sure the appropriate dependencies are available.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4194382c344fd28e26682b5c0c4685e6/href">https://medium.com/media/4194382c344fd28e26682b5c0c4685e6/href</a></iframe><h4>Build a TensorFlow model that is compatible with SageMaker</h4><p>SageMaker heavily relies on <a href="https://www.tensorflow.org/guide/estimators">TensorFlow’s Estimator API</a>. Because of this dependency, you are required to write your model according to the specifications of this API. At the bare minimum SageMaker requires an <em>entry_point</em> file which includes three definitions; First, you need to define the architecture of your model using a <strong>model_fn()</strong>. Second, you need to describe how data is fed into the model during training and validation using the <strong>train_input_fn()</strong> and <strong>eval_input_fn()</strong> handles.</p><p>PipeModeDataset (used in the function _input_fn()) is an implementation of the <a href="https://www.tensorflow.org/guide/datasets_for_estimators">TensorFlow Dataset API</a> which enables the use of the pipe input mode. The complete definition of our <em>entry_point</em> file can be found <a href="https://gist.github.com/EniasCailliau/9da7fabc438a369e2d97bb6b87e531a3">here</a>. It’s perfectly reasonable if you don’t understand everything just yet, each line will become clear as we work our way through this article.</p><p>Finally, we wrap our TensorFlow model inside a <em>sagemaker.tensorflow.estimator.TensorFlow</em> object to make it compatible with SageMaker’s services (more information can be found <a href="https://sagemaker.readthedocs.io/en/latest/sagemaker.tensorflow.html">here</a>). This wrap operation allows us to deploy the model on an instance of type <em>ml.c5.2xlarge</em> for 20.000 iterations. If you want to use a faster machine for training your model you can do so by changing the train_instance_type parameter. Note that we explicitly set the input_mode to ‘Pipe’ to force the usage of <em>PIPE</em> input mode.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/78d348fddba0c8e1f61392a883b93505/href">https://medium.com/media/78d348fddba0c8e1f61392a883b93505/href</a></iframe><h4>Enable hyperparameter tuning in SageMaker</h4><p>Now that we defined our model we can focus on optimising its hyperparameters. SageMaker offers automatic hyperparameter tuning through the Automatic Model Tuning service. The service spools up multiple machines to figure out the optimal hyperparameter configuration through <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning-how-it-works.html">Bayesian optimisation</a>.</p><p>Using automatic model tuning involves three steps:</p><ol><li>Define the training objective. The current implementation grabs the objective metric from the logs using regular expressions. Therefore, If you want to use an alternative objective such as accuracy you need to log this metric during training.</li><li>Define hyperparameter ranges.</li><li>Create a <strong>HyperparameterTuner</strong> instance which defines the number of jobs that it is allowed to use.</li></ol><p>More information on how to use automatic model tuning can be found through <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/automatic-model-tuning.html">this link</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eea61bb21b341f96a4bf8b5d5fbe1b64/href">https://medium.com/media/eea61bb21b341f96a4bf8b5d5fbe1b64/href</a></iframe><p>We can now trigger hyperparameter search by calling the fit function on our <strong>HyperparameterTuner</strong> instance. Notice that we pass the training data and validation data through a dictionary. The dictionary instructs SageMaker to open two channels: ‘train’ and ‘eval’. These channels are then processed by our _input_fn() we wrote earlier (see <a href="https://github.com/radix-ai/sagemaker-tensorflow-tutorial/blob/master/cnn_fashion_mnist.py">cnn_fashion_mnist.py</a>).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb16cb1ce75f9ba30a0195d69f8bb5e8/href">https://medium.com/media/eb16cb1ce75f9ba30a0195d69f8bb5e8/href</a></iframe><p>When writing this article, I trained the tuner for 16 times which resulted in a loss reduction of 50% (from 0.55 to 0.26).</p><h3>Putting your model into production</h3><p>The last step in the production pipeline is to serve the model as a service. Sagemaker facilitates this process through its <a href="https://sagemaker.readthedocs.io/en/latest/sagemaker.tensorflow.html"><em>sagemaker.tensorflow.estimator.TensorFlow</em></a> implementation.</p><p>First, we will train our model for a few more iterations on a faster instance (in this case the <em>ml.p2.xlarge).</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfda48a3ecb253fb90f9dbff29edd081/href">https://medium.com/media/dfda48a3ecb253fb90f9dbff29edd081/href</a></iframe><p>After training the model, we can deploy it using the deploy function. Notice that we use a much cheaper instance_type since inference isn’t as compute intensive as training.</p><p>To test if the service is up and running, we can send a randomly initialised image and check if the API replies.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8fd390c233c3da7f4a6db8693d52147e/href">https://medium.com/media/8fd390c233c3da7f4a6db8693d52147e/href</a></iframe><p>Optional: We can further analyse the performance of the model using the test set. For some example code on how to do that you can check out our <a href="https://github.com/radix-ai/sagemaker-tensorflow-tutorial/blob/master/train_deploy_fashion_network.ipynb">notebook</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2AHWQ_0qznAnFBLNqBeZNQ.png" /></figure><h3>Conclusion</h3><p>During this tutorial, we discovered the value of using SageMaker when developing deep learning systems. We’ve shown that SageMaker has excellent support for native TensorFlow implementations by offering efficient and distributed hyperparameter tuning.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d17774417f08" width="1" height="1" alt=""><hr><p><a href="https://medium.com/superlinear-eu-blog/tensorflow-sagemaker-d17774417f08">Tensorflow + Sagemaker = ❤</a> was originally published in <a href="https://medium.com/superlinear-eu-blog">Superlinear</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Sagemaker worth it?]]></title>
            <link>https://medium.com/superlinear-eu-blog/is-sagemaker-worth-it-4b78a2082ca9?source=rss-cf1ec8d63220------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b78a2082ca9</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Enias Cailliau]]></dc:creator>
            <pubDate>Tue, 13 Nov 2018 10:09:14 GMT</pubDate>
            <atom:updated>2018-11-16T13:10:24.595Z</atom:updated>
            <content:encoded><![CDATA[<h3>Is SageMaker worth it?</h3><p>Amazon SageMaker is a managed machine learning service (MLaaS). The platform lets you quickly build, train and deploy machine learning models. In this blog post, we will take a look at what SageMaker has to offer and if it is worth the cost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IlZ16ehpH9Ph7iC0.png" /></figure><blockquote>This article is the first article in the series: “Accelerating deep learning development using SageMaker”. During this series, I explore the added value of using SageMaker for Deep Learning development. Part 1 provides a general overview of what SageMaker has to offer. This second part provides a more technical view on how development lifecycles can be accelerated using the SageMaker ecosystem.</blockquote><h3>What it has to offer</h3><p>SageMaker is more than a service; it’s a development platform for machine learning practitioners. It is the perfect balance between low-level EC2 instances and high-level services such as Rekognition and Comprehend: It offers a fully-managed environment that facilitates building, training and deploying machine learning at scale.</p><p>The platform achieves this goal by offering a Jupyter Notebook instance as a starting point. From this notebook, you can use SageMaker’s services to train a model remotely in the cloud, distribute model tuning and easily deploy your model. All these services are offered through a high-level Python API.</p><p>SageMaker offers a wide range of built-in algorithms optimised for the cloud. The algorithms aren’t limited to the most common models such as Linear regression either. There is support for advanced deep learning models such as DeepAR forecasting which uses RNN. For the purists that don’t want to use the prebuilt models, SageMaker also supports TensorFlow and Apache MXNet out-of-the-box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*76HvVHZFCBxOMTWMz2B00A.png" /></figure><p>Behind the scenes, SageMaker employs two concepts: Docker images and s3 storage. Using these two concepts, it can host your training or inference code on any instance you desire. Using Docker as a machine abstraction also means that you can provide a docker image to SageMaker which contains your ML model in any framework or programming language you want.</p><h3>Why you should be using SageMaker</h3><p>Let’s analyse a typical workflow (illustrated in the image down below) and think where SageMaker will make things better. First, you generate your training and evaluation dataset using an ETL process. Once that’s done (and stored on s3) we can train our model and evaluate its performance. If we are satisfied with the result, we can deploy our model into production and serve predictions through an HTTP API.</p><p>In most cases, the three different stages of the workflow have different hardware requirements; ETL is mostly CPU and memory bound while training a model demands expensive GPU machines. Contrastingly, inference on a production-ready model is not as compute intensive which means you want to deploy it on much cheaper hardware. These different hardware requirements mean developers have to manage different instances during development which can be a burden, especially if we want to train multiple models on different machines.</p><p>SageMaker abstracts this hardware management so that we can focus on what we do best: developing groundbreaking models. In practice, this means that we can use different machines for each step of the workflow with only a single line of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*7bV5ijTy97z6zpBtjSrXog.png" /><figcaption><strong>Typical workflow for creating a machine learning model</strong> (<a href="https://docs.aws.amazon.com/sagemaker/latest/dg/how-it-works-mlconcepts.html">source</a>). Green corresponds to a notebook instance, blue — training instances, red — deployment instances.</figcaption></figure><h3>Pricing</h3><p>When exploring a new service, it’s always a good idea to analyse the additional cost it will introduce. Amazon isn’t clear how it prices SageMaker compared to traditional EC2 instances. The only indication is the usage of <a href="https://aws.amazon.com/sagemaker/pricing/instance-types/">ml instances</a> instead of normal ones. After some calculation we came to the following conclusion: the usage of SageMaker introduces a 40% increase in cost compared to running EC2 instances. 40% is a significant increase; when training a large model on a <a href="https://aws.amazon.com/ec2/instance-types/p3/">Tesla V100 instance</a>, the hourly rate is $4,2 compared to $3 when using lower-level EC2 instances. This price increase means you are spending an additional $1.2 each hour you train your model through the SageMaker Service.</p><p>Other cloud providers such as <a href="https://www.paperspace.com/gradient">Paperspace</a> and <a href="https://www.floydhub.com/">FloydHub</a> also offer GPU accelerated ML workloads. Both advertise cheaper machine costs but require a subscription. This payment model usually ends up being more expensive than just paying for machine usage as you do in SageMaker. Furthermore, SageMaker offers more integration such as the support for distributed training compared to its competitors.</p><h3>The Good, the Bad and the Ugly</h3><p>To experiment with the SageMaker platform I’ve developed a TensorFlow model that classifies fashion items. During this project, I used the advertised training and deployment services which worked perfectly. However, what made SageMaker stand out compared to the competition was the availability of two functions: Automatic Model Tuning and PIPE input mode. The Automatic Model Tuning service performs hyperparameter tuning using Bayesian Optimisation. Tuning hyperparameters tends to be painfully slow, but SageMaker reduces execution time significantly by distributing the compute workload across multiple instances. PIPE input plays a considerable role in making the distributed schema work. This input mode avoids training latency by streaming data directly from s3 to your model. All the SageMaker’s functionality requires minimal effort to use them.</p><h4>The good</h4><ul><li>Out-of-the-box support for popular ML frameworks such as TensorFlow and Apache MXNet</li><li>Support for multi-node training even for your own models</li><li>No configuration required to train models in the cloud</li><li>Notebooks can change host without losing information</li><li>Main SageMaker keeps track of your ongoing services (train/deploy/hyperopt)</li><li>Both Jupyter notebook and Jupyter lab are available</li></ul><h4>The bad</h4><ul><li>All your data has to be stored on s3</li><li>40% price bump on every instancetype</li></ul><h4>The ugly</h4><ul><li>Documentation is sometimes not as conclusive as you would want</li></ul><h3>Conclusion</h3><p>SageMaker accelerates machine learning development by abstracting server management and deployment set-ups. During my experiment, I found that SageMaker delivers sufficient added value for development workflows to justify the 40% price bump.</p><p>Convinced that SageMaker is for you? I recommend that you start with the SageMaker documentation and examples. If you want a guide that uses a TensorFlow model and all the bells and whistles from SageMaker, you can check out this tutorial (to be added soon).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*hEmHGs--POg_m0rpFWOX7Q.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b78a2082ca9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/superlinear-eu-blog/is-sagemaker-worth-it-4b78a2082ca9">Is Sagemaker worth it?</a> was originally published in <a href="https://medium.com/superlinear-eu-blog">Superlinear</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EC2 + TensorFlow GPU + Docker = ❤]]></title>
            <link>https://medium.com/superlinear-eu-blog/ec2-tensorflow-gpu-docker-84a06fbc7192?source=rss-cf1ec8d63220------2</link>
            <guid isPermaLink="false">https://medium.com/p/84a06fbc7192</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[deeper-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[Enias Cailliau]]></dc:creator>
            <pubDate>Mon, 22 Oct 2018 09:03:00 GMT</pubDate>
            <atom:updated>2018-10-22T09:03:00.048Z</atom:updated>
            <content:encoded><![CDATA[<p>Here at <a href="https://radix.ai/">Radix.ai</a>, we use GPUs to accelerate our Deep Learning training. One of our goals is to remain platform neutral towards our clients. Docker is a great platform that allows us to achieve this goal. Docker is a platform which abstracts the hardware from the container in operation. Now Nvidia and Docker made it possible to pass GPU capabilities such as CUDA to a Docker instance. This tutorial provides a step-through guide on how to get GPU accelerated docker up and running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*0Ugi8kcY0MMi3fCkLJdslA.png" /></figure><h4>Prepare your EC2 instance</h4><p>In this tutorial, we prepare an <a href="https://aws.amazon.com/ec2/instance-types/p2/">Amazon EC2 P2 GPU instance</a> to support nvidia-dockers.</p><ul><li>Image: Deep Learning Base AMI (Ubuntu)</li><li>Region: eu-central-1 (EU Frankfurt)</li><li>Instance type: p2.xlarge</li><li>Storage: 50 GB (more if you will use large datasets)</li></ul><p>First, boot up an instance with the specifications featured above. Once booted ssh into the machine using your certificate:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0de07b7c69526a32dda3a601c335628b/href">https://medium.com/media/0de07b7c69526a32dda3a601c335628b/href</a></iframe><p>Once on the machine, we first need to install Docker:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b452c17c302d88323be8ba9ece9670d1/href">https://medium.com/media/b452c17c302d88323be8ba9ece9670d1/href</a></iframe><p>Currently, Docker has no native support for GPU. Luckily Nvidia provides a nvidia-docker runtime which can be used to replace the default Docker runtime. Nvidia-docker2 can be installed using the following commands:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5102a7a886e85ec769e8d39775de0376/href">https://medium.com/media/5102a7a886e85ec769e8d39775de0376/href</a></iframe><p>We can now test if the runtime is working by running a GPU accelerated docker in the nvidia runtime:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49392f0640818e8371559f3b1f061a64/href">https://medium.com/media/49392f0640818e8371559f3b1f061a64/href</a></iframe><p>If everything is installed correctly, you should see a printout which includes the name of the GPU that is passed to the Docker instance (in our case the Tesla K80).</p><p>The docker command we used to boot up our nvidia/cuda docker selects the nvidia runtime using the runtime argument. However, we don’t want to supply this argument each time we run a docker. To avoid a bloated docker command, we modify the docker daemon to use the Nvidia runtime automatically:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5aaaecee68882dea7d9a5afb8c877c74/href">https://medium.com/media/5aaaecee68882dea7d9a5afb8c877c74/href</a></iframe><p>That’s it! Your instance is now ready to accept docker images which include GPU support. As an example, let’s deploy a Jupiter notebook to start our deep learning development.</p><h4>Running Tensorflow GPU in a jupyter notebook</h4><p>First, we need to ensure the security group of our instance accepts incoming traffic on port 6006 and 8888. Then we can start a docker machine using the following command:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/383003694cec35b3affb7ff3efa696d6/href">https://medium.com/media/383003694cec35b3affb7ff3efa696d6/href</a></iframe><p>Now you can visit your Jupyter notebook using the public ip from your EC2 instance.</p><h4>Final thoughts</h4><p>In this tutorial, we used docker to deploy GPU-accelerated deep learning environments on AWS. Using these docker-machines means that you can collect all your dependencies in one place, resulting in a portable solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84a06fbc7192" width="1" height="1" alt=""><hr><p><a href="https://medium.com/superlinear-eu-blog/ec2-tensorflow-gpu-docker-84a06fbc7192">EC2 + TensorFlow GPU + Docker = ❤</a> was originally published in <a href="https://medium.com/superlinear-eu-blog">Superlinear</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>