Latest / Talk Python To Me / #356: Tips for ML / AI startups
Transcript
- 0:00Have you been considering launching a product or even a business based on Python's AI ML stack?
- 0:06We have a great guest on this episode, Dylan Fox, who is the founder of Assembly AI and has been
- 0:12building his startup successfully over the past few years. He has interesting stories of hundreds
- 0:18of GPUs in the cloud, evolving ML models, and much more that I know you're going to enjoy hearing.
- 0:24This is Talk Python To Me, episode 356, recorded February 17th, 2022.
- 0:30Welcome to Talk Python To Me, a weekly podcast on Python. This is your host, Michael Kennedy.
- 0:48Follow me on Twitter where I'm @mkennedy and keep up with the show and listen to past episodes
- 0:53at talkpython.fm and follow the show on Twitter via at Talk Python. We've started streaming most of our
- 1:00episodes live on YouTube. Subscribe to our YouTube channel over at talkpython.fm/youtube to get
- 1:05notified about upcoming shows and be part of that episode. This episode is brought to you by the
- 1:12Stack Overflow podcast. Join them to hear about programming stories and about how software is made
- 1:18in century. Find out about errors as soon as they happen. Transcripts for this and all of our episodes
- 1:25are brought to you by Assembly AI. Do you need a great automatic speech to text API? Get human level
- 1:30accuracy in just a few lines of code. Visit talkpython.fm/assembly AI. Dylan, welcome to Talk Python to
- 1:37me. Yes. Thank you. I am a fan. I've listened to a lot of episodes and big podcast fan. So I'm happy
- 1:44to be on here. Thanks. Yeah, I'm sure you are. Your specialty is in the realm of turning voice into
- 1:51words. Yeah, that's right. I bet you do a lot of studying of media like podcasts or videos and so on,
- 1:58right? Yeah, it's actually funny. So I started the company. I started Assembly like four years ago. And
- 2:04there was this one audio file that I always used to test our speech recognition models on. It was this
- 2:08Al Gore TED Talk from like 2007, I think. And I've almost memorized like parts of that TED Talk because
- 2:14I've just tested it so many times. It's actually still part of our end-to-end test suite. It's in
- 2:19there. It's like a legacy kind of founder thing that's like in the current still. Yeah, how cool.
- 2:24Yeah, it is kind of funny, especially now that we're like 30 people at the company and I'll see
- 2:31some of the newer engineers writing tests around like that Al Gore file still. And it makes me laugh
- 2:37because there's no real reason I picked that. It was just something easy that came to me.
- 2:41Yeah. Yeah. You can start. I just got to grab
- 2:43some audio. Here's something, right? Yeah, exactly. Exactly. So yeah, definitely. I've also listened to
- 2:48like a ton of podcasts and I was with, we just started like releasing models for different
- 2:53languages. And I was with someone from our team last week and I heard this like phone call and it's
- 2:58like, it's like foreign language. People like screaming on this. I was like, what are you listening
- 3:02to? And, it is, but it is an audio company. You get sometimes data from customers and it's like,
- 3:08you have to like listen to it. Yeah. I bet there's some interesting stories in there.
- 3:11Yeah. For sure. Yeah. Well, we're very privacy conscious. So not too, not too many, but yeah.
- 3:16Yeah. There was just, on the verge, there was just a article about a different speech to text
- 3:23company. I don't know. Have you seen this, that there was some suspicious stuff going on? Let me see
- 3:29if I can find it. I think, what was it called? It was Otter. Interesting.
- 3:34Otter.ai. I'm not asking you to speak on them, but this, a journalist, Otter.ai scares a reminder
- 3:41that cloud transcription isn't completely private. Basically there was a conversation about Uyghurs
- 3:48in China or something like that. Yeah. And then they unprompted reached out to the person who was
- 3:54in the conversation and said, could you tell us the nature of why you had to speak about this?
- 3:59No way. They're like, what?
- 4:01That is crazy. That is crazy.
- 4:03Yeah. They're like, we're a little concerned about why, you know, it's, it's kind of like
- 4:07interested in the content of our conversation.
- 4:08Yeah. There's a lot of that like suspicion around, you know, there's some like, like conspiracy
- 4:13theories right around like, oh, does your phone like listen to you while you're around and does
- 4:17it evidently listen to you and then use that data to remarket to you? And I was talking to someone
- 4:22about this recently. I did nothing about the location-based advertising world, but sometimes I'll
- 4:27be talking about something and then I'll see ads for it on my phone or if I'm on Instagram or something.
- 4:33And someone told me it's probably more based on like the location that you're in and the other data
- 4:38that they have about you.
- 4:39Yeah. You were at your friend's house. Your friend just searched for that, then told you about it.
- 4:44Yeah, exactly.
- 4:45I think the reality of that is that it's actually more terrifying than if they were just listening to you.
- 4:51Yeah, it is.
- 4:51That they can piece together this shadow reality of you that matches reality so well.
- 4:56Yeah. Like your friend just bought this thing and you went over and then, so maybe you're
- 5:00interested in this thing because you're probably-
- 5:02Yeah, they probably told you about it or something, right?
- 5:04Yeah. It is really crazy. It is really crazy. I haven't paid too much attention to all the
- 5:08changes that are happening around like, I listened to some podcast, I think on the Wall Street Journal
- 5:12about like the big change that Google's making around that tracking and how a lot of people are up
- 5:17in arms about that. And it's, it was saying something how like they're going to have,
- 5:20and sorry if I'm derailing whatever plan we had for a conversation here.
- 5:24You're derailing in a way that I'm like super passionate about because it's so crazy,
- 5:28but yeah.
- 5:28Yeah, yeah.
- 5:29We'll go too deep, but yeah, it's so interesting.
- 5:31They said that there's, I'm probably butchering this, but something how like for each user,
- 5:36they're just going to have like six like categories about you. And then one of them is going to be
- 5:40randomly inserted as to somehow anonymize your profile. And I just thought, yeah, it was super weird
- 5:46to hear about how they're doing it.
- 5:48Yeah.
- 5:48And like what the meeting was internally that came up with that idea, you know? So I'm like,
- 5:52well, let's just throw a random category on there. I don't know.
- 5:55My thoughts are we're faced or we're presented with a false dichotomy. Either you can have horrible,
- 6:02creepy, tracking, advertising, shadow things like we talked about. Or you can let the creators and
- 6:09the sites that make the services you love die. There are more choices than two in this world,
- 6:15right?
- 6:15For example, you could have some kind of ad that is related to what is on the page rather than who
- 6:22is coming to the page, right? You don't necessarily have to retarget me. Like for example, right here
- 6:26on this podcast, I'm going to tell people about, I'm not sure without looking at the schedule, what the
- 6:31advertisers are for this episode, but I am going to tell people about that. And it is exactly related
- 6:37to the content of the show. It's not that I found out that, you know, Sarah from Illinois did this Google
- 6:45search and visit this page. So now we're going to show it like, no, it's, there's so many sites like this,
- 6:50this one here on the verge, you could have ads for assembly AI and it'll be, maybe you don't actually want
- 6:56on this one, but you know, like things like this, it would be totally reasonable to put an ad for speech
- 7:02to text companies on there that requires no targeting and no evil shadow companies. And there's,
- 7:09you know, like we go on and on, but there are many ways like that, right? That don't require this false
- 7:14dichotomy that is being presented to us. So hopefully we don't end up with either of those. Cause I don't
- 7:19think those are the best options or the only options. Yeah. It's weird how that's kind of how
- 7:23things developed, you know, to where we are now. Yeah. But I agree with you. There's probably a lot we
- 7:28can everyone's looking for like, okay, well, if we do retargeting, we can get 2% better returns.
- 7:34And like, you know, the, no one's worried about, well, what happens to society?
- 7:38Yeah. That's actually what I was going to say. It's all about the kind of high growth,
- 7:42like society that we have where we need to maximize growth and maximize returns. And I mean,
- 7:47I understand this acutely. Like I'm, you know, the CEO of a startup, so I get it. But yeah,
- 7:52it's when it's like growth over everything, you end up with things like what you said,
- 7:57like, Oh, it proves it to our returns 2%. So let's do this. But you don't think about what
- 8:02the trade-offs will be. Yeah, absolutely. All right. Well, thanks for that diversion.
- 8:06That was great. Yeah. But let's, before we get beyond it, let me just, get your background
- 8:12real quick. How do you get into programming? And I'm going to mix it up a little and machine
- 8:15learning. Yeah. Yeah, definitely. Do you want the long, the long story or the short story?
- 8:19How many minutes do I have? Intermediate. Intermediate.
- 8:22So the intermediate story is that I started a company when I was in college, just like a
- 8:28college startup thing. And at the time was very limited in my programming knowledge. I had done
- 8:35some basic like HTML when I was a kid, I was really into like, like Counter-Strike and Call of Duty and,
- 8:41Oh yeah. Yeah. I would like sell up like private servers. I don't, I don't know how I got into this,
- 8:48but would, would, I like rented these servers and I would like windowed remote windows desktop into
- 8:53them and set up like private Counter-Strike servers and then sell those and set up like a basic website
- 8:58for it with HTML and CSS. And, and my brother was super into computers. So it was always kind of
- 9:04into computers. And then in college, got into startups. And I think like programming and startups are like
- 9:09really connected. So through that, learned how to code, learned how to program, started attending
- 9:15Python meetups in Washington, DC, where I went to school. And that's how I met Matt Mackay, who we,
- 9:21it was a mutual, mutual connection. Yeah.
- 9:23So attended a bunch of meetups, learned how to program and then got really into it. But I think
- 9:29what I found myself more interested in was the like more like meaty programming problems, more like,
- 9:35I guess like algorithm type problems. And that kind of naturally led me to like machine learning and NLP.
- 9:42And then kind of just like took off from there. Cause I found that I was really interested in,
- 9:46in machine learning and, and like different NLP problems.
- 9:50Those are obviously the really hard ones that, you know, it's, yeah.
- 9:54Especially probably when was this that you were doing it or the,
- 9:58this is maybe like 2013, 2014.
- 10:02Yeah. So, so kind of the early days of when that,
- 10:05that was becoming real. Right. I remember feeling like all this AI and text to speech
- 10:11or speech to text rather type of stuff was very much like fusion, like 30 years out, always 30.
- 10:18Like it's, it's going to come eventually, but you know, people are doing weird stuff in Lisp
- 10:22and it doesn't seem to be doing much of anything at all.
- 10:24Like some like Pearl script seat out. Yeah. Yeah.
- 10:28And then all of a sudden we end up with like amazing speech attacks. We ended up with
- 10:32self-driving cars, like something clicked and it all came, came to life.
- 10:36Yeah. It's kind of crazy, especially over the last couple of years.
- 10:39I think what's really interesting is that a lot of the advances in like self-driving cars and NLP
- 10:44and speech to text, they're all based on similar machine learning algorithms. So,
- 10:49you know, like the transformer, right. Which is like really popular type of neural network
- 10:54that came out was initially applied towards like just NLP, like text language modeling related tasks.
- 11:01Now that's shown to be super powerful for speech as well. Whereas classical machine learning,
- 11:06there were still these underlying algorithms like support vector machines or, you know, other,
- 11:11other types of underlying algorithms, but a lot of the work was around like the data.
- 11:15And so how can you extract better features for this type of data? And you had to be like,
- 11:19I remember when I was getting into speech recognition, I bought this speech recognition,
- 11:24like textbook. And this is, yeah, a while ago. And it was around like really understanding like
- 11:29phonemes and how different things are spoken and how the human speech is spoken. And now you don't
- 11:35need to know about that. You just get a bunch of audio data and you train these like big neural
- 11:38networks. They figure that out. Right. You wanted to understand British accents and American
- 11:42accents. You just give it a bunch of more data. Yeah, yeah, exactly. So, but it is,
- 11:47it is crazy to see where things have gotten over the last couple of years in particular. Yeah. So
- 11:52when I was starting out, neural networks were there, but they're a lot more basic and you didn't have,
- 11:58like, there's a lot more compute resources down, more mature libraries like TensorFlow and
- 12:02PyTorch. I think I went to like one of the first TensorFlow meetups that they had,
- 12:07or not meetups, like developer days or whatever down at the Google conference. So it's,
- 12:12it's like so new still. Yeah. It's so new. Yeah. It's easy to forget. It is a while ago.
- 12:16It is. Yeah. That all the stuff didn't even exist, right? Yeah, absolutely.
- 12:19So you mentioned assembly, assembly AI. Yes. That's what you're doing these days, right?
- 12:24Yeah. So I am the founder of a company called assembly AI. We create APIs that can automatically
- 12:31transcribe and understand audio data. So we had APIs for automatic speech to text of audio files,
- 12:39live audio streams, live audio streams, and then APIs that can also summarize audio content,
- 12:44do content moderation on top of audio content, detect topics, what we call like audio intelligence
- 12:50APIs. And so we have a lot of startups and enterprises using our APIs to build the way we call it like
- 12:57applications on top of audio data, whether it's like content moderation of a social platform or
- 13:03speeding up workflows like I'm sure you have where you take a podcast recording and transcribe it so
- 13:09you can make it more shareable or extract pieces of it to make it more shareable. Yeah, exactly. Yeah.
- 13:14Basically for me, it's a CLI command that runs Python against your API, against a remote MP3 file. And then,
- 13:24you know, magic. That's the great thing about podcast hosts that are also programmers. Like I've talked
- 13:30to a few and they're all like, there's a bunch that are non-programmers and they use these different
- 13:34services. But every podcast host that I've talked to that's a programmer, they have their own like
- 13:38CLIs and Python scripts that they're running. Yeah.
- 13:42Yeah. Yeah. Yeah. There's a whole series of just, you know, CLIs and other commands to do the workflow.
- 13:48Yeah. I do want to just give a quick statement, disclaimer. Yes. So if you go over to the transcripts
- 13:53or possibly, I suspect if you've listened to the beginning of this episode, it'll say that it's
- 13:57sponsored by Assembly AI. This episode is not part of that sponsorship. This is just, you and I got to
- 14:04know each other. You're doing interesting stuff. You've been on some other shows that I've heard that
- 14:08the conversation was interesting. So invited you on. Thank you for sponsoring the show. But just to
- 14:13point out, this is not actually part of that. But with the transcripts that we do have on the show,
- 14:18the last year or so are basically generated from you guys, which is pretty cool.
- 14:23Yep. Yep. And we don't even need to talk about Assembly that much on this podcast. We can talk
- 14:27about other things. Yeah. So one of the things I want to talk about, and maybe what's on the screen
- 14:34here gives a little bit of a hint of being TensorFlow, is why do you think Python is popular
- 14:39for machine learning startups in general? I feel that I'm not as deep in that space as you, but
- 14:44looking in from the outside, I guess I would say it feels very much like Python is the primary way
- 14:50which a lot of this machine learning stuff is done.
- 14:52Yeah. Yeah. That's a good point. So why that is, outside of machine learning even, I think Python's
- 14:57just such a popular language because it's so easy to build with compared to PHP or C# and even
- 15:05JavaScript. When I learned to code, I started with Python because the syntax was easy to understand.
- 15:11There were a lot of good resources. And then there's this snowball effect where more people know Python,
- 15:16so there's more tutorials about Python. There's more libraries about Python. And
- 15:19it's just more popular of a language. Yeah. This insights to be pulling this up.
- 15:23Yeah. If people have talked about this a lot, right? But if you pull up the Stack Overflow
- 15:28trends for the most popular programming languages, there's only one that is going dramatically up out
- 15:35of 10 languages or something. It's just so much more popular. Yeah.
- 15:38It is. It's so interesting how it's really sort of taken off. And it wasn't back in when you got
- 15:46started and when I got started back in this general area in 2012. Interesting. What was the number one
- 15:50language then? The number one then was, what is that? C#.
- 15:54C#. But you got to keep in mind, this is a little bit of a historical bias of Stack Overflow.
- 16:00Stack Overflow was started by Jeff Atwood and Joel Spolsky, who came out of the .NET space.
- 16:05So when they created it, its initial traction was in C# and VB. But over time, clearly,
- 16:11it's become where programmers go, obviously. So take that a bit with a grain of salt. But that was the
- 16:16number one back in the early days. Another founder legacy decision.
- 16:19Yeah. Exactly. Yeah. Yeah. So I agree that it's absolutely generally popular. And I think there's
- 16:25some interesting reasons for that. Yeah. It's just so approachable, but it's not a toy, right? A lot
- 16:30of approachable languages are toy languages and a lot of non-toy languages are hard to approach.
- 16:35So I'll see you next time.
- 16:49For a dozen years, the Stack Overflow podcast has been exploring what it means to be a developer
- 16:53and how the art and practice of software programming is changing our world. Are you wondering which skills
- 17:00you need to break into the world of technology or level up as a developer? Curious how the tools
- 17:04and frameworks you use every day were created? The Stack Overflow podcast is your resource for tough
- 17:10coding questions and your home for candid conversations with guests from leading tech companies about the
- 17:16art and practice of programming. From Rails to React, from Java to Python, the Stack Overflow podcast will
- 17:22help you understand how technology is made and where it's headed.
- 17:25Hosted by Ben Popper, Cassidy Williams, Matt Kierninder, and Sierra Ford, the Stack Overflow
- 17:31podcast is your home for all things code. You'll find new episodes twice a week, wherever you get
- 17:36your podcasts. Just visit talkpython.fm/stackoverflow and click your podcast player icon to subscribe.
- 17:43And one more thing. I know you're a podcast veteran and you could just open up your favorite podcast app
- 17:48and search for the Stack Overflow podcast and subscribe there. But our sponsors continue to support us when
- 17:53they see results and they'll only know you're interested from Talk Python if you use our link.
- 17:57So if you plan on listening, do use our link, talkpython.fm/stackoverflow to get started.
- 18:03Thank you to Stack Overflow for sponsoring the show.
- 18:05Yeah, like for me, it was very easy to get started with Python. And I actually had,
- 18:12so I taught myself how to program. I went to college, I studied economics. So I did not study
- 18:19programming in college computer science. And the first language I started to try to learn was PHP.
- 18:24And I bought this huge PHP textbook and made it halfway through. And I was like, what is going on?
- 18:29I gave up and then tried again with Python later and it was so much easier.
- 18:33And then I also wonder how much of this is for the machine learning libraries in specific.
- 18:38Like you have these macro trends where a lot of the data science boot camps that have been so popular.
- 18:43There's scikit-learn. I know we have a tab up there. There's NumPy and I dream of what NLTK is one of the
- 18:50popular NLP libraries. So there are a lot of libraries in Python in the early, like when I was getting into NLP,
- 18:56I worked a lot with NLTK and like SciPy and scikit-learn and NumPy. And I think a lot of
- 19:02work was done around there. And so people that were doing data science or doing some type of machine
- 19:07learning were already in Python. And then now you have like PyTorch and TensorFlow and it's just like
- 19:12kind of cemented, like, okay, the machine learning libraries today, the popular ones that you work
- 19:17with them in Python.
- 19:17Yeah. You want to give us your thoughts on those? We've got TensorFlow and PyTorch and
- 19:22you know, probably scikit-learn as well. Those are the traditional ones. We've got some newer ones like
- 19:26Hugging Face.
- 19:27Yeah. Yeah. They're a cool company.
- 19:28Yeah. Maybe give us a survey of how you see the...
- 19:32The different libraries.
- 19:33The different libraries.
- 19:33The different libraries.
- 19:33The libraries that people might choose from.
- 19:35So when we started the company, everything was in TensorFlow.
- 19:38When was that?
- 19:39Back in like late 2017.
- 19:41Okay.
- 19:41Yeah. Late 2017. Everything was in TensorFlow. And actually, I don't know what year
- 19:47PyTorch came out. I don't even know if it was out back then. Or maybe it was like just internally at Facebook.
- 19:52Yeah. It's pretty new. Yeah.
- 19:53Yeah. So TensorFlow was definitely, they got started early. I think their docs and
- 19:58the framework just got complicated over the years. And then they sort of rebooted with like TensorFlow 2.0.
- 20:05And then there was like Keras that was popular. It kind of got pulled in. Now, I think,
- 20:11so we switched everything over to PyTorch in the last year or two. A big reason for that was that,
- 20:16and we actually put out this article on our blog comparing like PyTorch and TensorFlow. And we have
- 20:21this chart where we show like the percentage of papers that are released where the code for the
- 20:27paper is in PyTorch versus TensorFlow. And it's a huge, huge difference. Like most of the latest
- 20:34research gets implemented. Yeah, here it is. If you go down to one of, so this is, yeah,
- 20:39hugging face. Can you go keep going? Yeah, research papers. Yeah. Go up to that one. Yeah. Okay.
- 20:44So it shows like the fraction of papers. And so what we're showing here for the people that are
- 20:48listening is like a graph that shows the percentage of papers that are used, built using PyTorch
- 20:55versus TensorFlow over time. Yeah. When you started, it was, what is this? Six, seven percent?
- 21:00Yeah, probably 10 percent. And the balance being TensorFlow,
- 21:04Right. When you started your company. Right.
- 21:05And now it's 75 percent PyTorch. That's a huge, very large change.
- 21:10It's a dramatic change. You know, if PyTorch was a company, it'd be like
- 21:13probably raising a lot of money. I think one of the reasons we picked PyTorch is because a lot of the
- 21:19newer research was being implemented in PyTorch first. There were examples in PyTorch. And so it's
- 21:23easier to get, they have it on their, it's their tagline, but to quote them, like from research to
- 21:28production, right? Like it was easier to get more exotic, advanced neural networks into production and
- 21:35like actually start training models with those different types of layers or operations or loss
- 21:39functions that were released in these different papers. So we started using PyTorch and we kind of
- 21:44haven't looked back. Yeah.
- 21:46Well, if you're tracking all the research and trying to build a cutting edge startup around ML,
- 21:52you don't want to wait for this to make its way to other frameworks. You want to just grab it and go.
- 21:57So that's where the research is being done. That helps a lot, right?
- 22:00Right. Exactly. Yeah. You can get, just get up and running a lot faster with the newer research. And so
- 22:05most companies that I talk to now, they're all using PyTorch. I think PyTorch is definitely like
- 22:11the more popular framework. There's some new ones coming out that have people excited, but still,
- 22:15like from what I can sense, PyTorch is, if someone was going to get started today, I would tell them
- 22:21to start with PyTorch. Yeah.
- 22:22And I think TensorFlow is also- Who runs PyTorch? I think it's-
- 22:26Sorry, who runs PyTorch? It's released by Facebook, right?
- 22:28Yeah. And then TensorFlow, that's Google, right?
- 22:30Google, yeah. Yeah. And I think Google's tried to tie TensorFlow into their cloud ML products,
- 22:35so train your models on Google Cloud and use their TPUs in the cloud. And there's probably some business
- 22:41in this cases behind that, but I feel like it may have made the developer experience worse because
- 22:46it's trying to get back to Google. Whereas PyTorch isn't trying to get you to train your models on
- 22:51Facebook Cloud or something. Yeah. What's the story with hugging face?
- 22:54This is how- People probably wouldn't use Facebook Cloud if that existed nowadays.
- 22:58Yeah. I don't know if you'd want to host your data interface. Meta Cloud. I mean, Meta Cloud now.
- 23:04Yeah. Meta Cloud. You can only do it in VR. Yeah.
- 23:06What's the story with Hugging Face? So Hugging Face is a cool- So this is a company, actually.
- 23:10And they have, it's kind of hard to even explain. It's like, you can basically get access to a bunch
- 23:16of different pre-trained models really quickly through Hugging Face. And so if you want to,
- 23:20a lot of work around NLP now is like how familiar you are with like self-supervised learning or
- 23:26base models for NLP. I'm familiar with that. Somewhat. So the idea is to have a,
- 23:31like a general model and then apply some sort of transfer learning to build up a more specialized
- 23:37one without training from scratch. Is that- Exactly. Yeah. And then that general model is,
- 23:41is really just trained to like learn representations of the data. It's not even really trained like with us,
- 23:47our particular like NLP task. It's just like trained to learn representations of data. And then
- 23:52with those representations that it learns, you can then say like, okay,
- 23:55you know, I'm going to train you towards this specific task with some labeled data in a
- 24:01supervised manner. And so there are some really popular open source, like base models, foundation
- 24:07models, like BERT is one, there's a bunch of others, but you can easily get like, like load up BERT basically,
- 24:13and fine tune it on your data with Hugging Face. So if you're trying to get a model, the model up and
- 24:19running quickly in like the NLP, like the text domain, you can do that pretty easily with Hugging
- 24:24Face. And- Okay.
- 24:25Yeah. So it's less like, if you want to like build your own neural network from scratch,
- 24:29like inputs to outputs, implement your own loss function, all that, you would do that in PyTorch.
- 24:35If you want to try to just like quickly fine tune BERT for a specific task that you're trying to solve,
- 24:40you could still go like the PyTorch out, but it would just be faster to go with Hugging Face. So they've seen a lot of adoption there. And then scikit-learn is kind of like the old school library that's been around forever with like-
- 24:52The OG, yeah.
- 24:54The OG, yeah. Like if you want to do stuff with like support vector machines or random forest or like KDR's neighbors, you know, this scikit-learn is probably still really popular in that for those different use cases.
- 25:05I do think that I hear scikit-learn being used quite a bit still.
- 25:09Yeah.
- 25:09Maybe in the research, the academic, if you go take a course on it, you know, probably there's a lot of stuff on this, I would guess.
- 25:17Yeah. Like there's a lot of times where, I mean, you don't really need to build a neural network. I mean, there's parts of our stack that are really important.
- 25:22Like basic machine learning, like statistical models. And if you can get away with it, it's a lot easier to train and you don't need as much data and it's easier to deploy. So like a lot of like recommendation type models or, and sometimes SVMs are just like good enough. SVMs, support vector machines are just good enough for, for a task that you might want to have.
- 25:41So for a lightweight Netflix recommendation or YouTube recommendation, not like the high end stuff that I'm sure they're actually doing.
- 25:49Yeah.
- 25:49Something like that.
- 25:50Yeah. Yeah, exactly.
- 25:51That kind of recommendation engine. Yeah.
- 25:52Something, yeah. Something basic. Yeah. Although I actually am kind of underwhelmed with like the Netflix and YouTube recommendations are very good.
- 25:59Netflix recommendations and like prime recommendations are kind of underwhelmed by. You would think that you watch.
- 26:04I agree.
- 26:05Yeah. Yeah. It's still so hard to find things to watch sometimes on those platforms.
- 26:09It is. And YouTube interestingly seems to have an end. So if you scroll down through YouTube, like 10 pages, it'll start showing you like, well, it seems like we're out of options. Here, we'll show you 10 from this one channel. And then we'll just kind of stop.
- 26:22I know you got a lot of videos. You could just keep recommending stuff. I'm pretty sure if you would keep recommending it. There's stuff down here. But yeah, I agree. It's interesting.
- 26:30I feel like it's gotten better too. Like my YouTube consumption has really picked up over the last year, I would say. The recommendation algorithms, and I don't know if it's just more content being created or maybe it's just like a personal thing for me. And there was some thing on Hacker News too about like YouTube comments that like one of the founders of Stripe posted are like generally very positive. And like there's really good comments on YouTube too. So they've definitely also come up with ways to classify comments as being high value or not.
- 26:58And then put those up top. And nowadays, those models are definitely used with something like for some big neural networks and transformer.
- 27:07Yeah.
- 27:07Because those neural networks, they're so much better at understanding context. And like SVMs, you have to still, for a lot of these classical machine learning approaches, like feed it, hand-labeled data. But the neural networks, yeah, they're really good for those language tasks now.
- 27:24Yeah, absolutely. Christopher out in the audience has a question. That's kind of interesting. Does it make sense to start with scikit-learn if, for example, you're trying to predict when a production machine is not out of tolerance yet is trending to be?
- 27:37Is that like, God...
- 27:38Like if you were like monitoring like a data center for maybe VMs, I'm guessing.
- 27:42Like your RAM or like memory is going high or some statistic is like predictive that this VM will probably go down.
- 27:50Failure is coming.
- 27:51Failure is coming. Yeah.
- 27:53And the question was, is it SBM or scikit-learn good to start with? Yeah, I would actually probably say that's where you want to go with something like scikit-learn.
- 28:00Because there's probably very clear-cut patterns.
- 28:03I would say if you're unsure of what the pattern is, then a neural network is good because a neural network can, in theory, like you're feeding it raw data and it's learning the pattern.
- 28:12But if you know what the pattern is, like, okay, like there's probably like these signals that if a human was just sitting there looking at it all day, would be able to tell this system is probably going to go down.
- 28:23Then you just can train an SVM or some type of classical machine learning model with scikit-learn to be able to do those predictions with pretty high accuracy.
- 28:31And then you've got a super lightweight model.
- 28:33You don't need much training data to train it because you're not trying to build something that's like super generalizable to like all systems or like all AWS instances.
- 28:41It's probably something unique to your system.
- 28:43But I would say that's kind of where the difference is.
- 28:45And then it's a lot easier too because if you're trying to build like a neural net, it's like, well, what type, how many layers, what, you know, kind of like optimization schedule, like learning rate.
- 28:56There's all these hyper parameters and things you have to figure out.
- 28:59You still have to do that too for classical machine learning to a degree.
- 29:02But if your problem is not that difficult, it's not as, you know, like fancy nowadays, but it gets the job done.
- 29:10Yeah.
- 29:10I suspect you could come up with some predictors and then like monitor them for in this model, whereas opposed to here's an image that is a breast scan.
- 29:18Does it have cancer or not?
- 29:20Right.
- 29:20Like exactly.
- 29:21We don't even really know what we're looking for, but there probably is a pattern that could be pulled out by a neural network.
- 29:26Exactly.
- 29:27Yeah.
- 29:27That's a great point.
- 29:28And, you know, like we're trying to build some predictive scaling for our API right now, because, you know, one of the problems with the challenges of a startup that's doing machine learning in production is, you know, we deploy like hundreds of GPUs and thousands of CPU cores into production every day at peak load.
- 29:45And then there's just huge costs that come from a scale.
- 29:50And then there's huge costs that come with that.
- 29:52And so we've done a ton of work around like auto scaling and trying to optimize models and production and things like that.
- 30:01And now we're trying to do some predictive scaling.
- 30:04And for that, for example, we'd probably do something super simple with like scikit-learn.
- 30:08We wouldn't do a neural net for that.
- 30:10Yeah.
- 30:10The scaling sounds like solving a basically a similar issue.
- 30:13Yeah.
- 30:14Yeah.
- 30:14As understanding failure, right?
- 30:15Yeah, exactly.
- 30:16Exactly.
- 30:17The lack of scaling sometimes is kind of the result is failure.
- 30:20So yeah, they're somewhat related together.
- 30:23Yeah.
- 30:24You talked about like running stuff in production.
- 30:26And there's obviously two aspects for machine learning companies and startups and teams and products that are very different than say the kind of stuff I do, right?
- 30:36Like I've got APIs that are running.
- 30:38We've got mobile apps.
- 30:39We've got people taking the courses.
- 30:40But all of that stuff, there is like one.
- 30:43It's always the same, right?
- 30:45We put stuff up and people will use it and consume it and so on.
- 30:48But for you all, you've got the training and almost the R&D side of things that you've got to worry about working on and scaling.
- 30:55Right.
- 30:55And then you've got the productionizing.
- 30:57So maybe tell us a little bit about how you, what do you guys use for-
- 31:02For both parts.
- 31:02For training.
- 31:03Yeah.
- 31:03Maybe start with the training side.
- 31:05Yeah, the training side, it's basically like impossible to use the big clouds for that because it would just be prohibitively expensive, at least for what we do.
- 31:13So we train like these huge neural nets for speech recognition and different NLP tasks.
- 31:19And, you know, we're training them across like 48, 64 GPUs, like really powerful GPUs.
- 31:24I've got the GeForce 3090, which is a beast up here.
- 31:28Do you know what kind you're using?
- 31:30Yeah, so we use a lot of V100s, like A100s.
- 31:34And we rent, basically what we do is we rent dedicated machines from provider.
- 31:40And each machine, we're able to like pick the specs that we want.
- 31:44Like how many GPUs, what cards, how much RAM, what kind of CPU we want on there.
- 31:48So we're able to pick the specs that we want.
- 31:51And we found that that's been the best way to do it because the big clouds, yeah, if you're running like a dozen, dozens of GPU, like of the most expensive types of GPUs for like weeks on end, you could do that if you had like one training run you wanted to do.
- 32:06But a lot of times you have to train a model halfway through.
- 32:09It doesn't work well.
- 32:10You have to restart or finish this training and the results are not that good.
- 32:14And you learn something.
- 32:15So you have to go back and start over.
- 32:16And now what we're doing is buying a bunch of our own compute.
- 32:19Like my dream is to have some closet somewhere with just like, you know, tons of GPUs and like our own like mini data center for the R&D.
- 32:26Because if things go down, you know, like when you're training a model, you checkpoint it as you go.
- 32:31So if your program crashes or your server crashes, like you can resume training.
- 32:35Whereas like for production workloads, we use AWS for that because things can't go down.
- 32:40And I don't think we'd want to take on our own competency of like hosting our own production infrastructure.
- 32:45But for the R&D stuff, you know, we are looking into just buying a ton versus renting because it'd be a lot more cost efficient.
- 32:53And you can, instead of basically like paying each year for the same compute, you just like buy it once.
- 32:58And then you just pay for the electricity and server hosting costs and maintenance costs that come with that.
- 33:03Yeah.
- 33:04Maybe find a big office building and offer to heat it for free in the winter by just running on the inside.
- 33:09There's this like, you know, you can run like NVIDIA SMI.
- 33:11I don't even play around with GPUs at all.
- 33:13But like, you can see what the temperature is of the GPU.
- 33:16And like sometimes, you know, if I'm, I remember a while ago when I was training some of these models, I would just like look at what the temperature is during training.
- 33:24And yeah, they get so hot.
- 33:25And these data centers have to have all this, all these special cooling infrastructure to keep the machines down.
- 33:30It's pretty environmentally unfriendly.
- 33:32Yeah.
- 33:32To the extent that some of them, yeah, to the extent that people are creating underwater data center, like nodes and putting them down there and just letting the ocean be the heat sink.
- 33:44Yeah.
- 33:45That's crazy.
- 33:45You can buy some land and like, you know, in Arctica and put our stuff there.
- 33:50That's where like the GitHub, like the Arctic code thing.
- 33:53I forget what it's called.
- 33:54Yeah.
- 33:54Yeah.
- 33:55The Arctic code vault.
- 33:58Yeah.
- 33:58Yes.
- 33:58Yeah.
- 33:58So we could do something like that for our GPUs.
- 34:00When we get bigger, that's, that's the dream.
- 34:02That's where it might nerd out.
- 34:03There you go.
- 34:03So, yeah, so we train, I think we have like, I think somewhere like maybe like 200 like GPUs that we use just for R&D and training.
- 34:13And we're getting a lot more because you don't want to be, a lot of times there's like scheduling bottlenecks.
- 34:18So two researchers want to run a model and need a bunch of compute to be able to do that.
- 34:22And they're both good ideas.
- 34:23You don't want to have to like wait four weeks for someone to run their, their model because compute is taken.
- 34:30So we're trying to unblock those scheduling conflicts by just getting more compute.
- 34:34Yeah.
- 34:34And for the production side, yeah, we deploy everything in AWS right now and onto like smaller GPUs.
- 34:41Because a lot of our models do inference on GPU still.
- 34:44Some of our models do inference on CPU.
- 34:47Oh, interesting.
- 34:47Yeah.
- 34:48To, to evaluate the stuff, it still uses GPUs.
- 34:51Yeah.
- 34:51Correct.
- 34:52Even after the models are created.
- 34:52Correct.
- 34:53Yeah.
- 34:53I mean, there's, we could run it on CPU, but it's just not as parallelizable as running
- 34:58it on GPUs.
- 34:58There's a lot of work that we could probably do to get it really efficient so that, you know,
- 35:04we're running it on like as few CPU cores as possible.
- 35:06But one of the problems is like almost like every like three to four months, we're like throwing
- 35:11out the current neural network architecture and using a different one that is giving us better
- 35:15results.
- 35:15Like sometimes we'll make the model bigger or there'll be a small tweak in the model
- 35:19architecture that yields better results.
- 35:21But a lot of times it's like, okay, we've kind of iterated within this architecture as
- 35:25much as we can.
- 35:26And now to get the next accuracy bump, we have to go to a new architecture.
- 35:29We're undergoing that right now.
- 35:31We've released our, one of our like newer speech recognition models we released, I think
- 35:36like three months ago and the results are really good, but now we have one that is looking
- 35:40a lot better and it'd be like a completely different architecture.
- 35:43And so it's just that trade off of, do you spend a bunch of time optimizing the current
- 35:48model that you have and trying to like prune the neural network and do all these optimizations
- 35:54to get it really small?
- 35:55Or do you just spend that research effort and that energy focused on finding the next accuracy
- 36:00game?
- 36:01And because we're trying to win customers and grow our revenue, it's just, all right, let's
- 36:06just focus on the next model.
- 36:07And when we have a big enough team or when we can focus on it, we'll work on making the
- 36:11models smaller and more compute efficient and less costly to run.
- 36:16But right now, yeah.
- 36:17Like our speech recognition model that does inference on a GPU.
- 36:21There's a couple of our like NLP related models, like our content moderation model that does
- 36:26inference on a GPU.
- 36:28And then there's like our automatic punctuation and casing restoration model.
- 36:31Like that runs on a CPU because that's not as compute intense.
- 36:35And so it really varies.
- 36:37Yeah.
- 36:37Yeah.
- 36:37Yeah.
- 36:37As you say, it's pretty interesting to think about how you're optimizing the software
- 36:41stack and the algorithms and the libraries and whatnot.
- 36:44You know, when you're not doing something that's changing so quickly, you know, if it's working,
- 36:51you can kind of just leave it alone.
- 36:53Right.
- 36:53Like, right.
- 36:54I've got some APIs, I think they're built either in Pyramid or Flask.
- 36:58Sure.
- 36:58It'd be nicer to rebuild them in FastAPI, but they're working fine.
- 37:02I'm just like, I have no reason to touch them.
- 37:04Right.
- 37:04So there's not a, like a huge step jump I'm going to take.
- 37:08They're not under extreme load or anything.
- 37:11Right.
- 37:13This portion of Talk Python To Me is brought to you by Sentry.
- 37:17How would you like to remove a little stress from your life?
- 37:19Do you worry that users may be encountering errors, slowdowns, or crashes with your app right
- 37:25now?
- 37:25Would you even know it until they sent you that support email?
- 37:28How much better would it be to have the error or performance details immediately sent to you,
- 37:33including the call stack and values of local variables and the active user recorded in the
- 37:39report?
- 37:39With Sentry, this is not only possible, it's simple.
- 37:42In fact, we use Sentry on all the Talk Python web properties.
- 37:46We've actually fixed a bug triggered by a user and had the upgrade ready to roll out as we
- 37:51got the support email.
- 37:52That was a great email to write back.
- 37:54Hey, we already saw your error and have already rolled out the fix.
- 37:58Imagine their surprise.
- 37:59Surprise and delight your users.
- 38:01Create your Sentry account at talkpython.fm/sentry.
- 38:05And if you sign up with the code talkpython, all one word, it's good for two free months of
- 38:11Sentry's business plan, which will give you up to 20 times as many monthly events as well
- 38:16as other features.
- 38:17Create better software, delight your users, and support the podcast.
- 38:22Visit talkpython.fm/sentry and use the coupon code talkpython.
- 38:29But in your world, there's so much innovation happening around the models that you do have
- 38:36to think about that.
- 38:37So how do you work that tradeoff?
- 38:38How do you like, well, could we get more out of what we've got or should we abandon it and
- 38:42start over?
- 38:43Right?
- 38:43Because it is nice to have a very polished and well-known thing as well.
- 38:47Definitely.
- 38:48And every time you throw out our architecture to implement a new architecture, you've now
- 38:52got to figure out how to run that architecture at scale.
- 38:54And you don't want to have any hiccups for your current customers or users of your API, which
- 38:59sometimes happens because these models are so big that you can't just write this model
- 39:03that service that sits on a GPU and does everything.
- 39:06You have to break it up into a bunch of component parts so that you can run it efficiently at
- 39:10scale.
- 39:11So there's like eight, nine microservices for a single model because you break out all
- 39:17these different parts and try to get it running really efficiently in parallel.
- 39:20But it does beg the question of how do you build good CI/CD workflows and good DevOps workflows
- 39:25to get models into production quickly?
- 39:26And this is something that we're working on right now and trying to solve.
- 39:31Because a lot of times we have better models and we sit on them for like two, three weeks
- 39:34because to get them into staging, we have to do low testing, see does anything with scaling
- 39:39have to change because the model profile is different?
- 39:42Are there any weird edge cases that we didn't check or see during testing?
- 39:46So it slows down the rate of development because you have, it's hard to do CI/CD.
- 39:53It's not like you just, okay, run these tests, the code works, go.
- 39:57There's like compute profile changes that happen.
- 39:59So maybe you need a different instance type or you need to...
- 40:02Right.
- 40:03Uses less CPU, but way more RAM.
- 40:05So if you actually deploy, it's going to crash or something.
- 40:07Okay.
- 40:07Exactly.
- 40:08And then doing that at scale, you have to profile out and do low testing.
- 40:12And so really, we're trying to figure out how to get these models into production faster.
- 40:15And I think the whole ML ops world is so in its infancy around things like that.
- 40:21And it's a lot of work.
- 40:23Yeah.
- 40:23It's a lot of work.
- 40:24So for us, the trade-off though is always like, you know, our customers and developers,
- 40:28they just want better results and always more accurate results.
- 40:31And so we just always are working on pushing our models, making them more accurate.
- 40:36If we can iterate within a current architecture, great.
- 40:39Like sometimes you can just make the model bigger or make a small change and then you get
- 40:43a lot of accuracy improvements.
- 40:44And it's just like what we call it a drop-in update where no code changes.
- 40:48It's just literally like the model that you're loading is just different.
- 40:51And then it's just more accurate.
- 40:53Right.
- 40:53That's easy.
- 40:53Yeah.
- 40:54That's the dream.
- 40:54You know, it's just a drop-in, but that's maybe like 30% of updates.
- 40:59Like the other 70% are, okay, you've got a new architecture or it's got a pretty different
- 41:03compute profile.
- 41:04So it uses a lot more RAM or it's a lot slower to load in the beginning.
- 41:08So we need to scale earlier because instances come online later and become healthy later.
- 41:14So there's all these like things you have to think about.
- 41:17Yeah.
- 41:17The whole DevOps side of this sounds way more interesting and involved than I first thought.
- 41:22Yeah.
- 41:22It's painful too.
- 41:23I mean, we're like, I can't explain how many like graphs we have in Datadog, just like monitoring
- 41:27things all day.
- 41:28Luckily, I don't have to work on that anymore.
- 41:31That was very stressful.
- 41:33And I was like owning the infrastructure.
- 41:35Now we have people that are better at it than me.
- 41:37We had like two DevOps people start on Monday, but yeah, like DevOps is a huge, huge piece
- 41:41of this.
- 41:42Yeah.
- 41:42That's quite interesting.
- 41:43Yeah.
- 41:43I do want to just circle back to one real quick thing.
- 41:45You talked about buying your own GPUs for training and people might out there be thinking
- 41:48like, who would want to go and get their own hardware in the day of AWS, Node, whatever,
- 41:54right?
- 41:55Like it just seems crazy.
- 41:56But there's certainly circumstances.
- 41:58Like here's an example that I recently thought about.
- 42:00So there's a place called Mac Stadium where you can get Macs in the cloud.
- 42:03Hey, how cool, right?
- 42:04So maybe you want to have like something you could do with extra things.
- 42:07And well, what does it cost?
- 42:08Well, for a Mac mini M1, it's $132 a month.
- 42:14You think that's, is that high or low?
- 42:15Well, the whole device, if you were to buy it costs $700.
- 42:19Yeah.
- 42:20You know, that's, and I suspect that even though the GPUs are expensive, there's probably something
- 42:26where like, if you really utilize it extensively, it actually makes.
- 42:29To buy it.
- 42:30It stops making sense in ways that people might not expect.
- 42:33Yeah.
- 42:33That it's a buy it, you mean, right?
- 42:35Like it stops making sense to rent it.
- 42:36Yeah.
- 42:36That's what we're facing.
- 42:37It stops making sense to rent it in the cloud.
- 42:38Yeah.
- 42:38Yeah.
- 42:39I mean, we spent a crazy amount of money renting GPUs in the cloud and it's like, okay, you
- 42:45know, if we had a bunch of money to make a, you know, CapEx purchase, right?
- 42:49Like just shell out a bunch of money to buy a bunch of hardware up front, it'd be so much
- 42:53better in the long run.
- 42:54Cause it is similar to the example you made about like, if you don't have a lot of cash, then you're
- 42:59only going to use a Mac for a couple months.
- 43:01Right.
- 43:01You need it for two weeks.
- 43:02Then it doesn't make sense to buy it.
- 43:03Great.
- 43:04You just, you pay the a hundred dollars and you're good.
- 43:05Right.
- 43:06Right.
- 43:06Or if you don't have like 2k and you know, then, then you just rent in and it's like,
- 43:11you know, if you don't have the money to buy a house, you rent an apartment, right?
- 43:14Like things like that.
- 43:15So there are definitely benefits.
- 43:17And I think for a lot of, I think for most models, you don't need crazy compute.
- 43:22Like you could get away with, like, you could buy a desktop device that has like two GPUs
- 43:28or you could rent a dedicated machine or still do it on AWS if you're using like one or two
- 43:32GPUs.
- 43:32And it wouldn't be insane.
- 43:34So if you're just starting out, all those options are fine.
- 43:37But if you're trying to do like big models and, or train a bunch of parallel, you need
- 43:42more compute.
- 43:43And definitely doesn't make sense to use the big clouds for that.
- 43:47There's a bunch of dedicated providers that you can rent, like dedicated machines from
- 43:51and just pay a monthly fee regardless of how much you use it.
- 43:55And, it's a lot more, it's a lot more efficient for like companies to do that.
- 43:59Give me your thoughts on sort of CapEx versus OpEx for ML startups rather than, I don't know,
- 44:06it's some other SaaS service that doesn't have such computational stuff, you know, being
- 44:11CapEx being, you got to buy a whole bunch of machines and GPUs and stuff versus OpEx.
- 44:16Like, well, it's going to cost this much to rent in the cloud.
- 44:18Like I feel like things are more possible because you can get the stuff in the cloud,
- 44:24prove an idea and then get investors without going, well, you know, let's go to friends
- 44:29and family and get 250,000 for GPUs.
- 44:31And if it doesn't work, we'll just do Bitcoin.
- 44:32Yeah.
- 44:33Yeah, yeah, yeah.
- 44:34Definitely.
- 44:34I mean, we started in the cloud, right?
- 44:36So like first models we trained were K80s on K80s and AWS took like a month to train.
- 44:43Wow.
- 44:43Yeah, it was terrible.
- 44:44So we started in the cloud and then now that we're fortunate to have like more investment
- 44:49in the company, we can make these CapEx purchases.
- 44:51But yeah, I mean, the operating expenses of running an ML startup are also like crazy, like
- 44:56payroll and GP and payroll and like AWS are our biggest expenses because you run so much
- 45:02compute and it's super expensive.
- 45:04And what I talk about and what we talk about is like, there's nothing fundamental about what
- 45:09we're doing that makes that the case.
- 45:11It's just goes back to that point of like, do you spend a couple months optimizing your models,
- 45:16bringing compute costs down?
- 45:18Or do you just focus on the new architecture and kind of pay your way to get to the future?
- 45:23Like this growth versus, yeah.
- 45:26And then we're like a venture-backed company.
- 45:28So like there's expectations around our growth and, you know, all that.
- 45:31So we just focus on like, okay, let's just get to the next milestone and not focus too much
- 45:36on like bringing those costs down because there's the opportunity cost of doing that.
- 45:40But eventually we'll have to.
- 45:42Yeah.
- 45:43It's a little bit of the ML equivalent of sort of the growth.
- 45:48You can lose money to just gather users.
- 45:51Yeah.
- 45:52But this is the sort of gain capabilities, right?
- 45:55It is.
- 45:55Yeah, it is 100%.
- 45:56And then you'll figure out how to do it efficiently once you kind of find your way.
- 46:00Okay.
- 46:00And I'll give you like a tangible example.
- 46:02I mean, like we've been adding a lot of customers and developers on the API and there's always like
- 46:08new scaling problems that come up.
- 46:09And sometimes we're just like, look, let's just scale the whole system up.
- 46:13It's going to be inefficient.
- 46:14There's going to be waste, but like let's scale it up and then we'll like fine tune the auto
- 46:18scaling to bring it down over time versus like having to step into like a more perfect auto
- 46:26scaling scenario that wouldn't cost as much, but there'd be bumps along the way.
- 46:30And so we just like scaled everything up recently to buy us time to go work on figuring out how
- 46:35to improve some of these like auto scaling.
- 46:37Yeah.
- 46:38Yeah.
- 46:38You could spend two weeks trying to figure out the right way to go to production or you
- 46:42could spend just more money.
- 46:44Exactly.
- 46:45And then, cause you, you might not be sure with the, like the multiple month life cycle,
- 46:51some of these things.
- 46:52Right.
- 46:53Is this actually going to be the way we want to stick with?
- 46:55So let's not spend two weeks optimizing it first.
- 46:57Right.
- 46:57Very interesting.
- 46:58And I mean, like, look, not every company can make that decision.
- 47:01Like if you are bootstrapped or you're trying to get off the ground, which like a lot of companies
- 47:05are, you do have to make those, you can't just pay your way to the future.
- 47:09Yeah.
- 47:09And I'm a big fan of bootstrapped companies and finding your way.
- 47:14I don't think that necessarily just, you know, set a ton of money on fire.
- 47:17Right.
- 47:18It's the only way forward.
- 47:19But if you have backers already, then they would prefer you to move faster.
- 47:24I suspect.
- 47:25Correct.
- 47:25Yeah.
- 47:26Correct.
- 47:26Correct.
- 47:27Like I always was self-conscious about our, you know, operating costs as an ML company,
- 47:31cause they're high compared to other SaaS companies where you don't have heavy compute,
- 47:36but you know, the investors we work with, they get that like, okay, this isn't, there's
- 47:41nothing like that fundamental about this that requires those costs to be high.
- 47:45You just have to spend time on bringing them down and it's, there's like a clear path.
- 47:49It's not like Uber where it's like the path to bring costs down or like self-driving cars
- 47:54because it's expensive to employ humans.
- 47:56That's like, you know, so far down the road.
- 47:59Yeah.
- 47:59But for us, it's like, okay, we need to just spend three months making these models more
- 48:03efficient and they'll run a lot cheaper, but it's that trade-off.
- 48:08But I love bootstrap companies too.
- 48:10I mean, it's just a different way to do it.
- 48:11Something special about like, you're actually making a profit and you're actually, you have
- 48:16customers and people paying for stuff.
- 48:18Yeah.
- 48:19Yeah.
- 48:19Yeah.
- 48:20And the, and the freedom for sure.
- 48:21Yeah.
- 48:21So you probably saw me messing around with the screen here to pull up this Raspberry Pi
- 48:25thing.
- 48:25There's a question out in the audience says, could you do this kind of stuff on a Raspberry
- 48:29Pi?
- 48:30And like a standard Raspberry Pi, I suspect absolutely no.
- 48:33Yeah.
- 48:34Have you ever seen that there are water-cooled Raspberry Pi clusters?
- 48:37Whoa.
- 48:37I have not seen that.
- 48:39That is crazy.
- 48:40Is that insane?
- 48:40That's insane.
- 48:41So what kind of computer are they getting on that?
- 48:44It's pretty comparable to a MacBook Pro on this.
- 48:47That's crazy.
- 48:48They've got what, eight water-cooled Raspberry Pis in a cluster.
- 48:51And it's really an amazing device.
- 48:53But if you look back at a, you know, you sort of consider it like a single PC with a, you
- 49:00know, a basic Nvidia card or a MacBook Pro or something like that.
- 49:04Like that's still pretty far from what you guys need.
- 49:06Like how many GPUs did you say you were using to train your models?
- 49:09It's like 64 for the bigger ones.
- 49:12Yeah.
- 49:12In parallel.
- 49:13Yeah.
- 49:14Yeah.
- 49:14These are not small GPUs.
- 49:16So I suspect I'm going to maybe throw it out there for you and say probably no, maybe
- 49:21for the scikit learn type stuff, but not for what you're doing.
- 49:23Not the TensorFlow PyTorch.
- 49:25Yeah.
- 49:25Not for, not for training, but you could do inference on a Raspberry Pi.
- 49:30Like you could squeeze a model down super tiny, like what they do to get some models
- 49:34onto your phones.
- 49:35And you're on that on a Raspberry Pi.
- 49:37You get the models small enough.
- 49:39The accuracy might not be great, but like you could do it.
- 49:41Yeah.
- 49:41Oh, there's a lot of stuff happening around the edge.
- 49:43Like I think a lot of that Siri.
- 49:45Yeah.
- 49:45The edge compute, the sort of ML on device type stuff.
- 49:48Like a lot of the speech recognition on your phone now happens on device.
- 49:52Yeah.
- 49:52Yeah.
- 49:52And not in the cloud.
- 49:53Yeah.
- 49:53Sort of related to this, like the new M1 chips and even the chips in the Apple phones before
- 50:00then come with like neural engines built in, like multi-core neural engines.
- 50:04Right.
- 50:04Interesting for edge stuff again, but not really going to, not really going to let you do like
- 50:09the training and stuff like that.
- 50:11Right.
- 50:11I haven't done much iOS development, but I know there's like SDKs now to kind of like get your
- 50:16neural networks like on device and make use of these, like the hardware on the phone.
- 50:20And definitely if you're trying to deploy your stuff on the edge, there's a lot more
- 50:24resources available to you.
- 50:26Yeah.
- 50:26Yeah.
- 50:26And it's a really good experience because having, you know, you speak to your assistant
- 50:31or you do something and it says thinking, thinking like, okay, well that I don't want
- 50:35that.
- 50:35Like, I'll just go do it if I got to wait 10 seconds.
- 50:37Right.
- 50:37Yeah.
- 50:38But it happens immediately.
- 50:38And there's the privacy aspect too.
- 50:40Yeah, absolutely.
- 50:41The privacy is great.
- 50:42Yeah.
- 50:43Like the wake word on the, like, I don't know if you know this, but like the wake
- 50:46words, like on the Alexa device, like they happen local, that runs locally.
- 50:49Although I've heard, I've heard that when you say Alexa, they verify it in the cloud
- 50:55with a more powerful model.
- 50:56Interesting.
- 50:57Because sometimes it'll trigger and then shut off.
- 50:58I don't know if you've ever seen that happen.
- 51:00Yeah.
- 51:00It's, it'll spin around and go, ah, no, that wasn't right.
- 51:03Yeah, exactly.
- 51:04I think what's happening is that they're sending what they're sending like the wake
- 51:07word to the cloud to verify.
- 51:08Like, did you actually say Alexa?
- 51:09Probably the local models below some certain confidence level, it sends it up to the cloud and then
- 51:15the cloud verifies like, yeah, start, start processing.
- 51:17But it is much faster from a latency perspective.
- 51:20Although with, with 5G, I don't know, like mobile internet is so much, it's faster now.
- 51:25It's getting pretty crazy.
- 51:26Yeah.
- 51:26Yeah, absolutely.
- 51:27Yeah.
- 51:27Sometimes I'll be somewhere my wifi is slow and I'll just tether my phone and it's like
- 51:32faster.
- 51:32Yeah.
- 51:32Yeah.
- 51:33If I'm not at my house, I usually do that.
- 51:35If I go to a coffee shop or an airport, I'm like, there's a very low chance that the wifi
- 51:39here is better than my 5G tethered.
- 51:41Yeah.
- 51:41Yeah.
- 51:41Exactly.
- 51:42Exactly.
- 51:42Exactly.
- 51:45Jack Woody out in the audience has a real interesting question.
- 51:47I think that you can speak to because you're in this space right now, living it.
- 51:54What do investors look at when considering an AI startup or maybe AI startup, not just specifically
- 51:59speech to text?
- 52:01Yeah.
- 52:01It's a good question.
- 52:02I think it really depends on like, are you building like a vertical application that makes
- 52:07use of the AI?
- 52:07So you're building some like call center optimization software where there's like AI under the hood,
- 52:13but you're, you're using it to power this like business use case versus are you building
- 52:18some like, like infrastructure AI company?
- 52:20Like we're us, like we're building APIs for speech to text, or if you're building a company
- 52:25that's exposing like APIs for NLP or different types of tasks, I think it varies what they
- 52:30look at.
- 52:31I am not an expert in like fundraising or AI startups.
- 52:35I want to make that very clear.
- 52:36Like, so, so maybe don't take my advice too, too seriously.
- 52:39Yeah, but you've done it successfully, which is, I mean, there are people who claim to
- 52:44be experts, but are not currently running, you know, a successful backed company.
- 52:48So I wouldn't put too much of a caveat there.
- 52:51Yeah.
- 52:51I think we just got lucky with, you know, meeting some of the right people that have helped us.
- 52:55But I think it's like, yeah, you know, are you, are you doing something innovative on the
- 52:59model side?
- 53:00Do you have some innovation on the architecture side?
- 53:03I actually don't really think the whole like data vote is that strong of an argument personally,
- 53:08because there's just so much data on the internet now.
- 53:10And did a moat being like, we run Gmail so we can scan everybody's email.
- 53:14That gives us a competitive advantage.
- 53:16Yeah.
- 53:16Yeah.
- 53:17Something like that.
- 53:18Exactly.
- 53:18Yeah.
- 53:18I don't know.
- 53:19Like you might get like a slight advantage, but there's so much data on the internet and
- 53:23there's so many, there's so many innovations happening around.
- 53:26Like, look at, look at GPT-3 that OpenAI put out, right?
- 53:29That was just trained on like crazy amount, a huge model trained on crazy amounts of public
- 53:34domain data on the internet.
- 53:36That works so well across so many different tasks.
- 53:38So even if you had a data mode for a specific task, like it's arguable that GPT-3 could beat
- 53:45you at that task.
- 53:46So I think it depends what you're doing, but I don't personally buy into the whole data mode
- 53:51thing that much.
- 53:52You know, cause like even for us, we're able to build some of the best speech to text models
- 53:56in the world.
- 53:57And we don't have this like secret source of data.
- 54:01You know, we, we just have a lot of innovation on the model side and there's tons of domain
- 54:05data in a public domain that you can access now.
- 54:08So I think it's really about like, are you building some type of application that is making
- 54:13the lives of like a customer developer, some startup, like easier leveraging AI?
- 54:19Right.
- 54:19Are you solving a problem that people will pay money to solve?
- 54:22Yeah.
- 54:23Yeah, exactly.
- 54:23Exactly.
- 54:24Cause I actually think it's more about like the distribution of the tech you're building
- 54:28versus the tech itself.
- 54:29So like, are you packaging it up in an easy to use API or is like the, imagine you're
- 54:36selling something to like podcast hosts that uses AI.
- 54:39I mean, AI could be amazing, but if like the user interface sucks, you know, like you're,
- 54:44you're not going to use it.
- 54:45Here's what you do.
- 54:45You're going to make a post request over to this and you put this header in and like, it's
- 54:49going to like, here's how you do paging and you're like, no, no, here's the library
- 54:53in your language.
- 54:53You call the one function, things happen, right?
- 54:55Like how presentable or straightforward do you make it right?
- 54:58Right.
- 54:59Cause I actually think that's a huge piece of it.
- 55:01Are you, are you making it easier?
- 55:02Are you making, is the distribution around the technology you're creating like really powerful
- 55:06and, and like, do you have good ideas around that?
- 55:09So I think it's a combination of those things, but to be honest, I think really depends on
- 55:13what you're building and what the product is or what you're doing.
- 55:16Cause it varies, like really it varies a lot.
- 55:18Yeah.
- 55:18There's also the part that we as developers don't love to think about, but the marketing
- 55:25and awareness and growth and traction, right?
- 55:28Yeah.
- 55:29It's, you could say, look, here's the most amazing model we have.
- 55:32Well, we haven't actually got any users yet, but that is a really hard sell for investors
- 55:36unless they absolutely see, you know, this has huge potential.
- 55:40Right.
- 55:40But if you're like, look, we've got this much monthly number of users and here's the
- 55:46way we're going to start to up, you know, create a premium offering.
- 55:49And yeah.
- 55:49Yeah.
- 55:50Right.
- 55:50That that's something we're not particularly skilled at as developers, but that's a non-trivial
- 55:56part of any tech startup.
- 55:57Right.
- 55:57Oh yeah.
- 55:58And I think as a developer too, you kind of like shy away from wanting to work on that
- 56:01because it's so much easier to just write code or build a new feature versus like go solve
- 56:05this hard marketing problem or go like.
- 56:08Marketing sales.
- 56:09Like you gotta have them, even if you're bad at them and you don't like it.
- 56:12Yeah.
- 56:12And we're fortunate that we get to market it to developers.
- 56:14So like I enjoy it, you know, and cause you get like to talk to developers all the time,
- 56:20but yeah, that's a huge piece of it too.
- 56:22Definitely.
- 56:22Definitely.
- 56:23It's, it's kind of all come together.
- 56:24Yeah.
- 56:25This up a little bit, we're getting sort of near the end, but let's talk about,
- 56:28you've got this idea of you've got your models, you've got your libraries, you've trained them
- 56:32up using your GPUs.
- 56:33Now you want to offer it as an API.
- 56:36Like how do you go to production with a machine learning model and do something interesting?
- 56:41You want to talk about how that's where I know you talked a little bit about running
- 56:44the cloud and whatnot, but yeah.
- 56:46You know, do you offer as an API over Flask or run it in a cloud?
- 56:50Like what are you doing there?
- 56:51Are they Lambda functions?
- 56:52Yeah, that's a good, that's a good question.
- 56:53What's your world look like?
- 56:54So we have asynchronous APIs where you send in an audio file and then we send you a
- 57:00webhook when it's done processing.
- 57:01And then we have real-time APIs over WebSocket where you're streaming audio and you're getting
- 57:05stuff back over a WebSocket in real time.
- 57:07The real-time stuff's a lot more challenging to build.
- 57:10I'm sure it is.
- 57:11Yeah.
- 57:11Yeah.
- 57:12The async stuff.
- 57:13Really what happens is we have like, so one of our main APIs was built in Tornado.
- 57:18I don't know if you, yeah.
- 57:19Legacy.
- 57:20The early, early async enabled Python web framework before asyncio was officially a thing.
- 57:26Yep.
- 57:27So I built the first version of the API in Tornado.
- 57:30So it's kind of like still in Tornado for that reason.
- 57:33A lot of the newer things or newer microservices are built by FastAPI or Flask.
- 57:38And so for the asynchronous API, what happens is like you're making a post request.
- 57:43The API is really just like a CRUD app.
- 57:44It's storing a record of the request that you made with all the parameters that you turned
- 57:49on or turn off.
- 57:50And then that goes into a database.
- 57:52Some worker that's like the orchestrator is constantly looking at that database and it's
- 57:57like, okay, there's some new work to be done.
- 57:59And then kicks off all these different jobs to all these different microservices, some over
- 58:04queues, some over HTTP, collects everything back, orchestrates like what could be done in
- 58:09parallel, what depends on what to be done first.
- 58:12When that's all done, all the kind of asynchronous like background jobs, the orchestrator pushes
- 58:18the final result back into our primary database.
- 58:21And then that triggers you getting a webhook with the final result.
- 58:25So that's like in a nutshell, kind of what the architecture looks like for the asynchronous
- 58:29workloads.
- 58:30There's like tons of different microservices, all with different instance types.
- 58:34different like compute requirements, some GPU, some CPU, some, you know, like all different
- 58:40scaling policies.
- 58:41And that's really where the hard part is.
- 58:43That's kind of like the basic overview of how the asynchronous stuff works in production.
- 58:47Yeah.
- 58:48Yeah.
- 58:48Very cool.
- 58:48Yeah.
- 58:49Are you seeing Postgres or MySQL or something like that?
- 58:52Postgres for the primary DB.
- 58:54Because we're on AWS, we use DynamoDB for a couple of things like ephemeral records we need
- 58:59to keep around for when you send something in, it goes to DynamoDB.
- 59:02And that's where we like keep track of basically like your request and what parameters you add
- 59:08on and off.
- 59:08And that kicks off a bunch of things.
- 59:10But the primary DB is Postgres.
- 59:11Yeah.
- 59:12I think there's like, at this point, like it's getting pretty large.
- 59:15There's like a few billion records in there.
- 59:18Because we process like a couple million audio files a day with the API.
- 59:22Sometimes I'll read on Hacker News like these, I think like GitHub went down at one point
- 59:27because they couldn't increment the primary key values any higher.
- 59:31It's, int 64 is overflowing.
- 59:34We're done.
- 59:34Yeah, yeah.
- 59:35Something like that.
- 59:36Yeah.
- 59:36I mean, in the back of my mind, like I hope we're thinking about something like that because
- 59:39that would be really bad if we came up against something like that.
- 59:42Do you store the audio content in the database or are they going like some kind of bucket,
- 59:48some object storage thing?
- 59:49So we're unique in that we don't store a copy of your audio data.
- 59:52Okay.
- 59:53For privacy reasons for you.
- 59:55So you send something in, it's stored ephemerally like in the memory of the machine that's processing
- 1:00:01your file.
- 1:00:01And then what's stored is the transcription text encrypted at rest because you need to be able
- 1:00:05to make a GET request for the API to fetch it.
- 1:00:07But then you can follow up with a delete request to permanently delete the transcription text from
- 1:00:12our database.
- 1:00:12So we try to like keep no record of the data that you're processing because like we want
- 1:00:18to be really privacy focused and sensitive.
- 1:00:22You can, like some customers will toggle on that.
- 1:00:25We keep some of their data to continuously improve the models, but by default, we don't store anything.
- 1:00:31Yeah, that's really cool.
- 1:00:32Yeah.
- 1:00:32That's good for privacy.
- 1:00:34It's also good for you all because there's just less stuff that you have to be nervous about
- 1:00:38when you're trying to fall asleep.
- 1:00:40You're like, what if somebody broke in and got all the audio?
- 1:00:42Oh wait, we don't have the audio.
- 1:00:43Okay.
- 1:00:43So that's not a thing they could get.
- 1:00:44Yeah.
- 1:00:45Like things like that, right?
- 1:00:46Yeah.
- 1:00:46Yeah.
- 1:00:47It's definitely, definitely.
- 1:00:50I hadn't thought about that before, but I'm imagining now what that would be like.
- 1:00:53Well, now I'm making, now you're going to be nervous because there's probably other stuff,
- 1:00:56but that's all right.
- 1:00:56Yeah.
- 1:00:56Now you got me thinking about in that space.
- 1:01:00Like what are those things we need to lock up?
- 1:01:02No, we have like, we're mostly a team of engineers.
- 1:01:05So I think of the 30 people, like 70% are engineers with a lot more experience than me.
- 1:01:11So we're doing everything like by the book, especially with the business that we're in.
- 1:01:15Yeah.
- 1:01:15Yeah.
- 1:01:15Of course.
- 1:01:16Yeah.
- 1:01:16All right, Dylan, I think we're out of time, if not out of topic.
- 1:01:19So let's maybe wrap this up a little bit with the final two questions and some packages and
- 1:01:25stuff.
- 1:01:25So if you're going to work on some Python code, what editor are you using these days?
- 1:01:29I'm still using Sublime.
- 1:01:31Right on.
- 1:01:31What do you use?
- 1:01:32The OG easy ones.
- 1:01:34I'm mostly PyCharm.
- 1:01:35If I want to just open a single file and look at it, I'll probably use VS Code for that.
- 1:01:40That's probably just, you know, I want to open that thing.
- 1:01:42Not have all the project ideas around it, but I'm doing proper work.
- 1:01:46Probably PyCharm these days.
- 1:01:47Yeah.
- 1:01:47Yeah.
- 1:01:48That makes sense.
- 1:01:48Yeah.
- 1:01:49And then a notable PyPI project, some library out there.
- 1:01:52I mean, you've already talked about it, like TensorFlow and some others, but anything out
- 1:01:56there you're like, oh, we should, you should definitely check this out.
- 1:01:58I would check out Hugging Face if you haven't yet.
- 1:02:00It's a pretty cool library.
- 1:02:01Yeah.
- 1:02:02A pretty cool library.
- 1:02:03Yeah.
- 1:02:03Hugging Face seems like a really interesting idea.
- 1:02:05Yeah.
- 1:02:05I want to give a quick shout out to one as well that I don't know if you've seen this.
- 1:02:09Have you seen TLS, please, as an LS replacement?
- 1:02:13No.
- 1:02:14Chris May told me about this yesterday.
- 1:02:16Told me and Brian for Python Bytes.
- 1:02:18Check this out.
- 1:02:19So it's a new LS that has like icons and it's all developer focused.
- 1:02:24So like if you've got a virtual environment, it'll show that separately.
- 1:02:27If you've got a Python file, it has a Python icon.
- 1:02:30The things that appear in the list are controlled somewhat by the git ignore file and other things
- 1:02:34like that.
- 1:02:35And you can even do like a more detailed listing where it'll show like the git status of the
- 1:02:40various files.
- 1:02:41Isn't that crazy?
- 1:02:41That's really cool.
- 1:02:42Yeah.
- 1:02:42That's really cool.
- 1:02:43That's a Python library, PLS.
- 1:02:44PLS.
- 1:02:45That's awesome.
- 1:02:46I'll check that one out.
- 1:02:46Yeah.
- 1:02:47Yeah.
- 1:02:47People can check that out.
- 1:02:48Yeah.
- 1:02:48All right.
- 1:02:49Dylan, thank you so much for being on the show.
- 1:02:51It's really cool to get this look into running ML stuff.
- 1:02:55Yeah.
- 1:02:55And production and whatnot.
- 1:02:57Thanks for having me on.
- 1:02:58Yeah.
- 1:02:59You bet.
- 1:02:59You want to give us a final call to action?
- 1:03:00People interested in sort of maybe doing an ML startup or even if they want to do things
- 1:03:06with Assembly AI?
- 1:03:07If you want to check out our APIs for automatic speech and text, you can go to our website,
- 1:03:11assemblyai.com.
- 1:03:13Get a free API token.
- 1:03:14You don't have to talk to anyone.
- 1:03:15You can start playing around.
- 1:03:17There's a lot of Python code samples that you can grab to get up and running pretty quickly.
- 1:03:20And then, yeah, if you're interested in ML startups, I think that one of the things that
- 1:03:25I always recommend is if you want to go the funding route, definitely check out Y Combinator
- 1:03:31as a place to apply because that really helped us get off the ground.
- 1:03:35They help you out with a lot of credits around GPUs and resources.
- 1:03:39And it helps a lot.
- 1:03:40That helped us a lot.
- 1:03:41Were you in the 2017 cohort?
- 1:03:43Yeah.
- 1:03:43Something like that.
- 1:03:44Yeah.
- 1:03:452017.
- 1:03:45So it was super helpful.
- 1:03:47And I would highly recommend that.
- 1:03:48There's also just a big community of other ML people that you can get access to through
- 1:03:53that.
- 1:03:53So that really helped.
- 1:03:55And I would recommend people check that out.
- 1:03:57How about if I don't want to go PC funded?
- 1:04:00Yeah.
- 1:04:00Go ahead.
- 1:04:01Yeah.
- 1:04:01So one more is there's also an online accelerator called Pioneer.
- 1:04:05I don't know if you've heard of this, but that's also a good one to check out too.
- 1:04:09If you don't want to go the accelerator route, then I would say like, yeah, really it's just
- 1:04:15about getting a model working good enough to like close your first customer and then just
- 1:04:19like keep iterating, you know?
- 1:04:20So like don't get caught up in like reaching state of the art or yeah.
- 1:04:23Like in the research, just like kind of think of like the MVP model that you need to build.
- 1:04:27They go win your first customer and they kind of keep going from there.
- 1:04:30Yeah.
- 1:04:31Awesome.
- 1:04:31All right.
- 1:04:32Well, thanks for sharing all your experience and for being here.
- 1:04:34Yeah.
- 1:04:35Yeah.
- 1:04:35Thanks for having me on.
- 1:04:36This was fun.
- 1:04:36Yeah, you bet it was.
- 1:04:37All right.
- 1:04:37Bye.
- 1:04:38This has been another episode of Talk Python To Me.
- 1:04:41Thank you to our sponsors.
- 1:04:43Be sure to check out what they're offering.
- 1:04:45It really helps support the show.
- 1:04:46For over a dozen years, the Stack Overflow podcast has been exploring what it means to
- 1:04:51be a developer and how the art and practice of software programming is changing the world.
- 1:04:55Join them on that adventure at talkpython.fm/stack overflow.
- 1:04:59Take some stress out of your life.
- 1:05:02Get notified immediately about errors and performance issues in your web or mobile applications with
- 1:05:07Sentry.
- 1:05:07Just visit talkpython.fm/sentry and get started for free.
- 1:05:12And be sure to use the promo code talkpython, all one word.
- 1:05:16Want to level up your Python?
- 1:05:17We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:05:21Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:05:26And best of all, there's not a subscription in sight.
- 1:05:29Check it out for yourself at training.talkpython.fm.
- 1:05:32Be sure to subscribe to the show.
- 1:05:34Open your favorite podcast app and search for Python.
- 1:05:37We should be right at the top.
- 1:05:38You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 1:05:43and the direct RSS feed at /rss on talkpython.fm.
- 1:05:47We're live streaming most of our recordings these days.
- 1:05:51If you want to be part of the show and have your comments featured on the air,
- 1:05:54be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:05:59This is your host, Michael Kennedy.
- 1:06:00Thanks so much for listening.
- 1:06:02I really appreciate it.
- 1:06:03Now get out there and write some Python code.
- 1:06:05Thank you.