Machine Learning and Movement Part 2

A creator does random exercises while training a Detectron2 object-detection model on Google Cloud. The model is at 25-27k iterations with loss around 0.328 and average precision at 35, targeting 50. He's hitting CUDA memory errors on an 8GB GPU and plans to switch to a smaller model.
Chapters
Oh, why isn't my model training? Look at this. Excuse me, just had to take a quick nap because— here we go, JupyterLab. I've disconnected it. It was supposed to be on Google Cloud, but I've got a runtime error. CUDA runtime error, out of memory. I just went to the bathroom as well, and my urine was a color that it shouldn't be. So I forgot to drink water for like the last 6 hours. Don't do that. I've been working on this modeling problem for my Airbnb problem, and it's continuing on from what we were doing yesterday, running a massive experiment. It's working on Colab, which is great, using transfer learning, but I wanted to train a model from scratch on my own GCP instance, so Google Cloud Platform instance. But as you can see by the red, Red means not good, and we're getting server connection errors, so whatever. I'm gonna monitor this training while we do another workout, but the theme of this one is, is I was gassed, right? You saw me begin on the floor, tired, laying down, and you know what? When you need to take a break sometimes, a wise man once told me, "The pump is the cure." So, Yawning my absolute skull off before, but there are things to do tonight because it is Saturday night and you know what that means. So, I have to move. Now, as I said before, I haven't planned anything today. So, today's theme is randomness. We're day 12 for Repsorona, almost 2 full weeks of moving. So, thank you for joining in. And randomness is so value— I think it's undervalued these days. Too much. I have a list of things that I have to do rather than just inject randomness. I follow this routine instead of just trying things for the sake of trying things, following curiosity. You know, routine is the death of joy. So today, we are going to start the clock. We're doing 10 minutes today. We'll monitor the model training, but we're going to do random exercises. Exercise. Ready, number 1, star jumps. Every time, it's gonna come straight from the top of the dome. Remember, we're starting this one feeling very yawnish, very tired, but we're gonna keep moving. Oh, look at that, cameraman's even yawning. Got him. Hahaha. And now he's laughing. Come on, we're doing star jumps. Maybe this could be a great little series. Movement, Oh, rest. There we go. I'm feeling it already, feeling it already. Maybe this could be a little series, movement and modeling. Come on, have a look at what we've got here. So I've kicked off this for— we're up to iteration— just zoom in on this for me— up to iteration 25,000. I'm not sure if you can see that, but you can just take my word for it. 25,000. Uh, there's some curves here. The curves are going in the right direction. Oh, back to it. Random exercise. We're going to do sit-throughs. So we'll come here, start in a plank position, and then throw your leg through like that. Arm up in the air. Note, this is different to a kick sit because we're staying up high. There we go. Kick through. Make it nice and fun. So come back, kick through. Boom! Boom! That's it, little shout as you go through. Squeeze those glutes, thrust those hips towards the roof, and then come back. Rest. Look at that. Look at that. All right, come back in. So what I want this to do, average precision, it is currently, you won't be able to see that 'cause I can barely even see that, but it's at 35. I want it to reach 50, meaning average precision. Because that is what Airbnb's MVP was for their object detection. So let's say, for example, you took a photo of this room. I want my model to be able to identify that that is a chair. Exercise! What movement we're going to do? Push-ups! Let's do it! Nice and slow. Actually, cobras, because they're more fun. Down. Yeah! Down, right, left, up, down, right, left, Up, down, right, left, up, down, right. Oh, I tricked ya! Little bit of randomness. Left, right, up, down, left, up, down, right, left, up, down, right, up, up. Rest. Ah, you see, what else is there to do in quarantine and lockdown than to train machine learning models and do a little bit of dancing in your bedrooms. And so what my experiment is currently at, it's at 25 or 26,000 iterations. What I want it to, it's going to go up to 100,000. Now that may take maybe a late night for me. I think from 0 to 25,000 took about 2 hours. Alright, what are we on? What are we on? Let's do froggies. So come down, elbows between your knees, and go up like that. Oh, that's so good. Sit nice and deep down. That's it. You can even hold it there. That feels great for me because, as I said, I sat down training my model or trying to fix my errors on Google Cloud. CUDA runtime errors, man. You ever had them? Leave a comment below if you've ever had a CUDA runtime error. That's it. Rest. Come back. You know, I gotta think of these exercises before the clock starts, but that's the beautiful thing about having a deadline is that, okay, sometimes yes, you will be in a rush, but other times you'd be amazed. How many times have you had a deadline and you sort of, I think we spoke about this in another one, in the last video maybe. You've had a deadline and it's sort of somehow the entire universe has come together to help you. Oh, what are we at? Exercise. What we're going to do? We're going to do kick sits. So these are some of my favorite exercises. You know, I should actually mix it up. Keep it up. That's it. Movement and Modeling Episode 2. I'm pretty sore from yesterday actually. That was, that was a good session. Keep it up. Kick sits. Let's go through. If you're training your machine learning model, remember, what's the rule? Rest. That's my new rule. If my model moves, I move. Oh, I've got a good one, good one for what's next. Um, my friend Andre, who we teach my machine learning course on Udemy— shout out to Andre, absolute complete, complete, absolute and complete living Legend, hope to visit you one day. He lives in Canada, I live in Australia. He gave me this workout to try and I haven't tried it yet. But we need to practice. So what have we got? Burpees. Come down, all the way to the bottom, up, tap. That's it. Down, up, clap. Oh yeah. Down, up, clap. Take a peek at your model. Yep. Keep it up, come on. Rest. Nice. All right, where we at? So we're getting about 100 iterations because I'm running a— in Google Colab, the Google Colab gods have gifted me a P100 GPU, so thank Thank you Google Colab gods. Because you know how if you go to Google Colab you get a free GPU, but sometimes it's random as to what one you get. A K80, which is about half the speed of a P100. So we've got the big dog GPU. So it takes about 1 minute per 100 iterations. And speaking of 100 iterations, let's do some knee taps. So tap your elbow, we go back. Tap elbow and back. That's it. Tap your elbow and back. Keep it up. Nice. That's it. Keep going. Hold it. Rest. Beautiful. You know, we've been mixing it up. We're 7 through. That's 7 different exercises. We're injecting Randomness. So that's a bit of a challenge actually, is that every so often I like to have a random day. So I've got my personal assistant here, and this is just a whole bunch of crap that I need to do today. Reps for Rona Day 12, I put that on the list and that's what we're doing now. But every so often I like to inject a random day where I just say, "Exercise." Screw the list. So now we're going to do bear crawls. Unleash your inner animal. Oh yes, feels good to move, right? Okay, now back, all the way back. It's a bit hard going back. You need to concentrate on where each limb is moving. Keep it up, come on, nice. Rest. That is beautiful. So where are we at? I really wish we could have had an evaluation round here. As you see, actually, my loss curve is, is just bouncing around. Have a look at that. See how wildly it's going there? So what I think— I've got it scheduled to do that. I need some learning rate decay. This is my theory. I need my learning rate to to be smaller, and it's set to decay at iteration 60,000. So you might have to wait for that. Okay, I'm gonna do split jumps. The lunge, that's it. Lunge into a jump. Pump it up. Just keeping these movements nice and simple. Oh, I've got a great one for the next one. I just thought of it. And I just thought of a way to fix my CUDA error. Keep it up, come on. Boom. Okay, um, try my kuta error. I gotta record this so I come back. I need to try a smaller model, um, because I'm running out of memory. The original Detectron 2 models, which is the computer vision library that I'm using, were trained on 16 to 32 gigabyte GPUs, but I'm only using 8 gigabyte GPUs. Exercise. Okay, now I'm gonna fall to the floor and push back up. So fall. Oh yes, come back. You gotta fall. Nice, come back up. Now, if you can't fall, that's alright. Walk out, walk back up. Walk out, walk back up. That's it. Watch those wrists if you're falling. Walk forward. Nice. I think that's it. 10 sets. Alright, where's the model at? We need to finish. Finish the video with a little summary. We're at iteration as of this little speech part, 26,840. We've worked up a sweat. Our model has been moving the whole time, running it in Google Colab, so it might time out. I'm not sure. We're going to get the— we're going to get the little victory with the ad. Great workout. You spent 10 minutes 7 seconds exercising. Beautiful. So that's, uh, you're awesome. 5 stars. And you get that little ad plug in there for Natural Dry Tomato. I don't need that. It just wants me to upgrade to the paid version of it. So we are now at iteration 27,000. Total loss is 0.328. We want that number to get as close to zero as possible. Average precision is 35. Hopefully that increases. I've got it set to schedule, evaluate itself every 20,000 iterations, so that won't be until 40,000. But I feel so much better. That workout, the theme was randomness. So question for you: how have you, or how do you, inject randomness into your life? Me at the moment, it could be something as small as doing something that you haven't planned. That's nice and simple. That's one way. If you've ever done machine learning, if you've ever done deep learning, you know how valuable randomness is for a model to learn. In fact, most of it, the entire thing, is based on randomness. So, there's your challenge. How can you inject some randomness into your life? And how can you get moving a little bit every day? Even when you're zoned out, even when you face a CUDA runtime error, remember, the pump is the cure. I'll see you tomorrow.
More from Daniel

Small Language Models (SLMs) Are the Future: Fine-Tuning AI That Runs on Your iPhone

Introducing Sunny - A MedGemma-Powered Skin Health Tracking App (Kaggle Competition Entry)

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 4 - Comparing the results

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 3 - Running LLMs on the RTX 4090

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 2 - Formalizing the tests

Benchmarking: NVIDIA DGX Spark & NVIDIA RTX 4090 | Part 1 - Creating a series of tests

Local Multimodal RAG on the NVIDIA DGX Spark | Part 4 - Publishing our demo to Hugging Face

Local Multimodal RAG on the NVIDIA DGX Spark | Part 3 - Putting it all together


