Hustle Hub #22

🛖 How to Debug Errors in Python, Give Updates Early, & More

New to Hustle Hub? Make sure to subscribe for more!

Read Time: 4.5 minutes

Hey friends,

I attended an AWS meetup last week about how to train Large Language Models (LLM) using distributed training. Given the current hype in ChatGPT, have you ever wondered how you could train an LLM from scratch?

🤯 The sharing was absolutely mind-blowing. I learned so much about the state of the art in distributed training for large models. In short, here are the 3 main ways you can use distributed training to train deep learning models (i.e. LLM) in AWS:

  • Data Parallelism: Use AWS’s network infrastructure to train models by partitioning data into multiple GPUs / instances.

  • Model Parallelism: Partition a large model into multiple instances to solve memory limitations in a single instance.

  • Tensor Parallelism: Partition individual weights of a model into multiple instances.

AWS Meetup - Distributed Training and Large Language Models (LLM)

This meetup made me realise how cloud computing makes the training of deep learning models accessible to the general public like us — the future of AI is bright.

Okay. Enough of me talking about distributed training. 🙊

In today's issue, I’d like to share with you how to debug errors in Python, why you should give updates early at work, and my favourite machine learning book.

Let’s get to it! 🚀 

🛖 What's in the hub today?

  • Tip: How to debug errors in Python

  • Mistake: I was afraid to give updates when I needed more time

  • Learning: Give updates early and frequently

  • Book: An Introduction to Statistical Learning

  • Tool: Canva Create

⭐️ 1 Tip

How to Debug Errors in Python

Me debugging when the bug is looking at me 😂

Debugging is part of the process when you’re analysing data. In fact, debugging may consume most of your time if you’re constantly stuck in errors. So here are my steps for debugging:

A typical Python error in Jupyter Notebook

  1. Don’t panic, don’t stress, don’t cry. Just relax. 🧘🏻‍♂️

  2. Go to the last error and read the line with the error message. It usually shows the source of the error.

  3. Understand the error type.

  4. Resolve the bug.

🐞 Techniques of Debugging (4 Rules):

  • Rule 1: For large programs, use print statement to print out intermediate outputs to check the codes.

    • Stop and test your work often as you go by printing out the intermediate outputs.

  • Rule 2: Understand what kind of error you are facing, and google for potential solutions.

    • For most errors that you will face, chances are others might have faced the same errors and solved them. You just have to google for potential solutions!

    • Usually, stackoverflow should have the answer you need!

  • Rule 3: Check the documentation.

    • When you’re not familiar with a Python’s library, it’s important to check the documentation to make sure you used the right methods and parameters.

  • Rule 4: Take a break.

    • Sometimes the best way to debug is by taking a break. When your brain is exhausted, starting at your code in frustration doesn’t help.

    • I’d go for a walk, exercise, take a shower, or just do nothing to relax. When I’m back to the code again, suddenly I know how to debug the error. Give it a try next time — highly recommended.

  • 🎁 BONUS: Use ChatGPT.

    • Copy and paste your error in ChatGPT, give it some context, explain the error you’re facing, and ask it to fix it.

🧠 How do you debug errors in Python? Let me know by replying to this email!

⚠️ 1 Mistake

When I was at Micron, I was afraid to give updates to my manager when I needed more time.

Because I didn’t want my manager to think that I couldn’t deliver on time. I only wanted to give updates after I had completed the task.

Guess what happened next?

I avoided my manager’s emails and messages and just replied that I was still working on the task.

Bad move. 🤦🏻‍♂️

🧠 1 Learning

While it’s important to know your timeline to complete a task, it’s common that we tend to underestimate the time we need in finishing a task.

In my opinion, it’s okay to say that you need more time to complete a task. Or perhaps you might need help in certain areas. You just have to tell your manager to manage expectations and make sure everyone is aligned.

This will help your manager to trust you more if you give updates about the status more frequently than waiting for them to check on you.

🧠 Here’s what I’ve learned:

  • Give updates early and frequently to your manager or colleagues.

  • Don’t pretend that you know everything or have everything in control. Be open to sharing your progress and seek help from others if needed.

  • Even better, share with your manager what you’re struggling with. The main role of a manager is to help you remove roadblocks. Don’t suffer alone. Seek support.

📚️ 1 Book

Whenever people asked me how I learned machine learning in my early days, I always pointed them to this book — An Introduction to Statistical Learning. This is like a bible to understanding the fundamentals of machine learning without getting too technical.

Think of this book like the Machine Learning course taught by Andrew Ng — but in a written format.

If you’re new to machine learning, I’d highly recommend giving this book a read. You can get it for free HERE.

📚️ Here are my takeaways from the book:

  1. The crucial role statistical learning plays in solving real-world problems and how it is used in various fields such as business, finance, medicine, and more.

  2. Understanding the fundamentals of statistical learning, including the bias-variance tradeoff, overfitting, regularization, and cross-validation.

  3. Overview and practical implementation of popular statistical learning techniques such as linear regression, logistic regression, decision trees, support vector machines, clustering, and how to implement them using real-world datasets.

🧠 Have you read this book? What's your thought on it?

🧰 1 Tool

If you’re not a designer, I’m sure you’ve at least heard of or used Canva for your work.

Personally, Canva has been my life saviour to help me design logos, social media content, LinkedIn’s Carousel, YouTube thumbnails and many more! 🪄

… and finally the launch of Canva Create.

It’s so powerful that I can’t help but share it with you. It’s basically a graphic design platform — powered by AI.

Canva will soon offer a range of new AI tools through this program.

These features will make creating content way easier for those without professional experience.

For example, Canva's Visual Worksuite will provide tools to help power all your visual communication needs. Here are some features you can use:

  • Magic Replace: upload an image, select a style, and let Canva visualize a design for you

  • Magic Edit: use text prompts to edit images

  • Translate: “speak your audience’s language”

  • Beat Sync: automatically sync audio and video

  • Magic Write: give Canva some text and it’ll give you anything from a blog post to social captions

🧠 Are you currently using Canva for your work? How would you intend to use Canva Create’s features?

🚀 Whenever you’re ready, there are 4 ways I can help you:

  1. Book a coaching call with me if you need help in the following:

How To Get Into Data Science

LinkedIn Growth, Content Strategy & Personal Branding

1:1 Mentorship & Career Guidance

Resume Review

  1. Promote your brand to ~1000 subscribers in the data/tech space by sponsoring this newsletter.

  2. Watch my YouTube videos where I talk about data science tips, programming, and my tech life (P.S. Don’t forget to like and subscribe 💜).

  3. Follow me on LinkedIn and Twitter for more data science career insights, my mistakes and lessons learned from building a startup.

That's all for today

Thanks for reading. I hope you enjoyed today's issue. More than that, I hope it has helped you in some ways and brought you some peace of mind.

You can always write to me by simply replying to this newsletter and we can chat.

See you again next week.

- Admond

Reply

or to participate.