<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ahmed Yassin on Medium]]></title>
        <description><![CDATA[Stories by Ahmed Yassin on Medium]]></description>
        <link>https://medium.com/@yassin01?source=rss-89a0a4cb9d2f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xATasSzkQikRkSIJGC39hg.jpeg</url>
            <title>Stories by Ahmed Yassin on Medium</title>
            <link>https://medium.com/@yassin01?source=rss-89a0a4cb9d2f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 14:42:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yassin01/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Thought I Knew Product. Then I Joined a Fintech!]]></title>
            <link>https://yassin01.medium.com/i-thought-i-knew-product-then-i-joined-a-fintech-ac798a89de88?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac798a89de88</guid>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[inflation]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[nsave]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Sun, 26 Apr 2026 09:37:00 GMT</pubDate>
            <atom:updated>2026-04-26T09:37:00.438Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4ThXDl1EDrePJO0m" /><figcaption>Photo by <a href="https://unsplash.com/@jakubzerdzicki?utm_source=medium&amp;utm_medium=referral">Jakub Żerdzicki</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When I joined <a href="https://www.nsave.com/">nsave </a>a few months ago, I thought I had it figured out. I’d done ML, I’d shifted to product, I’d written a whole blog about going from “model-first” to “product-first.” I knew how to ship things.</p><p>Then fintech happened!</p><p>Fintech isn’t just “another vertical.” It’s a different game with different rules, and most of what makes it hard isn’t written down anywhere. So if you’re a builder PM eyeing a move into fintech, or you just landed in one and feel slightly disoriented (like I did), here’s the stuff I wish someone had told me on day one.</p><h3>1. You’re not building features. You’re building trust.</h3><p>In most products, a clunky onboarding is annoying. In fintech, a clunky onboarding makes someone wonder if you’ll lose their money.</p><p>Every screen, every piece of microcopy, every loading state is a trust signal. When a freelancer in Cairo is uploading their ID to open account to get their first international payment, they’re not evaluating your UI. They’re quietly asking themselves, <em>“should I trust these people with my salary?”</em></p><p>That reframes everything. Your error messages aren’t UX polish, they’re emotional moments. A vague “Something went wrong” can cost you a user forever. A clear “Your transfer is on its way and will arrive in x hours” buys you a friend for life.</p><p>If you come from a pure tech background like me, this takes a while to internalize. I believe that The product is <strong>trust…</strong> Features are just how you deliver it.</p><h3>2. The “edge cases” aren’t edge cases?</h3><p>In a normal product, if your feature works for 99% of users, you celebrate. In fintech, that 1% failure means real people whose salaries didn’t arrive.</p><p>Picture this: a freelancer in Dhaka has a $500 invoice landing on Friday. It’s their rent. If your system has a 1% failure rate, that’s somebody’s rent going missing every hundred users. That’s not an edge case. That’s somebody’s life.</p><p>So you start obsessing over weird stuff. What happens if their local bank rejects the transfer? What if the FX rate shifts between request and execution? What if the ID upload fails for the third time and they’re already anxious? These aren’t engineering puzzles. They’re human problems wearing technical clothing.</p><h3>3. Your tools are your second brain. Lean into them.</h3><p>Fintech has more moving parts than you can hold in your head. Mentions, reviews, transactions, support tickets, partnership leads, community signals across many countries. If you try to track all of that manually, you’ll drown.</p><p>This is where being a <em>builder</em> PM (vs. a regular PM) genuinely saved me.</p><p>In fintech, where trust is the product and signals are scattered everywhere, automation isn’t a nice-to-have, it’s how you stay sane. So, I started building monitoring workflows in n8n that watch Reddit, the App Store, Google Alerts, and a bunch of forums for high-intent signals, then route them straight to Slack so a community manager can jump in within minutes. I built alerts for when negative reviews show up. I built weekly digests so the team starts Monday with a clear picture instead of a panicked scroll.</p><p>If you’re moving into fintech and you have any building chops, lean in hard. The “side hobby” of stitching tools together is a real competitive advantage. It frees you up to do the strategic work that actually moves the needle.</p><p>Honestly? Fintech is harder than I expected. There’s no clean ship-and-celebrate cycle. Every win is small, every alignment is a negotiation, every feature has five constraints you didn’t anticipate.</p><p>But it’s also the most meaningful product work I’ve ever done. When someone tells me a product I helped grow saved them from a currency loss, that hits differently than any model accuracy improvement ever did.</p><p>You’ll figure the rest out by doing it. That’s kind of the whole secret. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac798a89de88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing the “Aha!” Moment: What Transitioning to Product Taught Me About Growth & Community]]></title>
            <link>https://yassin01.medium.com/optimizing-the-aha-moment-what-transitioning-to-product-taught-me-about-growth-community-52a34b700c47?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/52a34b700c47</guid>
            <category><![CDATA[business-development]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[growth-mindset]]></category>
            <category><![CDATA[nsave]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Thu, 26 Feb 2026 21:45:49 GMT</pubDate>
            <atom:updated>2026-02-26T21:45:49.341Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*maUOkSPlL4H_1aF-.jpeg" /><figcaption>image source: intoo.com</figcaption></figure><p>A while back, I wrote a blog about my shift from a “model-first” to a “product-first” mindset. Back then, I was realizing that building a highly accurate machine learning model meant nothing if it didn’t solve a tangible business problem.</p><p>As I’ve moved deeper into the Product and Growth space, that lesson has evolved into something even more humbling: <strong>Users don’t care about your architecture. And great architecture doesn’t acquire users on its own.</strong></p><p>When I was deep in the engineering trenches, I measured success by technical elegance. I obsessed over the mathematical nuances of Adam vs. AdamW and optimized PyTorch Dataset classes to prevent memory leaks. If the code was robust, the job was done, right?</p><p>But product management flipped my perspective upside down. The most beautiful architecture in the world is useless if the user gives up before experiencing its value. And from a growth perspective, acquiring that user one-by-one through paid ads is an expensive, unsustainable grind.</p><p>This brings me to the two critical metrics I focus on today: <strong>Time-to-Value (TTV)</strong> and <strong>Predictable Acquisition</strong>.</p><h4>The Engineering Trap vs. The User Reality</h4><p>Engineers naturally focus on the backend. But Growth Product Managers aggressively focus on the user’s anxiety, their time, and their community.</p><p>Let’s look at the fintech sector as an example. <a href="https://www.nsave.com/">nsave</a>, a platform built to serve remote workers and freelancers in emerging markets. In countries dealing with unstable economies and hyperinflation (like here in Egypt), people are terrified of losing their life savings to currency devaluation.</p><p>This fintech app promises to protect those earnings. Their engineering team might be incredibly proud of their secure, multi-currency ledger, or their robust compliance infrastructure offering trusted offshore accounts regulated in the UK and Switzerland.</p><p>But the user signing up in Cairo? They don’t care about the API. They are anxious. They are frustrated by local bank limits and blocked PayPal accounts. They just want to know how seamlessly they can transfer money from other platforms and keep it safe at the best rate.</p><p>For them, the true “killer feature” isn’t the backend code; it’s the exact second they realize they can keep their hard-earned freelance money safe in USD, immune to local inflation.</p><p>That realization is the <strong>“Aha!” moment</strong>.</p><p>If your onboarding flow is clunky, their anxiety wins and they drop off fast. But fixing the UI is only half the battle. The real challenge of growth is figuring out how to deliver that “Aha!” moment at scale.</p><h4>Scaling the Magic</h4><p>Transitioning to Growth means I no longer just debug code; I debug the user acquisition journey. Optimizing Time-to-Value is remarkably similar to reducing loss in a neural network. You are looking for the shortest, most efficient path to convergence.</p><p>But how do you build a predictable, scalable acquisition engine that actually lowers Customer Acquisition Cost (CAC)? You stop fighting for users one by one, and you go to where they are already gathered.</p><p><strong><em>Here is how I approach it:</em></strong></p><p><strong>1. Treat UX Friction Like a System Error</strong> Just like logging a stack trace, you must obsessively track user drop-off points. If 40% abandon the app at the document upload, that is a critical system failure. You cannot scale a leaky bucket.</p><p><strong>2. Shift from 1:1 to 1:n (The B2B Pivot)</strong> Once the core product loop is solid, true growth requires leverage. Instead of targeting individual freelancers, the growth engine needs to target the infrastructure they rely on. By establishing strategic B2B partnerships with payroll platforms, remote work agencies, and Cairo-based Software Houses, a fintech product can integrate its solution at the source. Landing one partnership with a dev shop doesn’t win you one user, it wins you 50 high-intent users at once.</p><p><strong>3. Build Trust on the Ground</strong> In emerging markets, trust isn’t built on a slick landing page, nope, it’s built in the community. You cannot just run Facebook ads. You need to be deeply embedded in freelancer marketplaces, host on-the-ground webinars, and maybe build ambassador programs. I see that word-of-mouth is the ultimate conversion metric in the MENA region. When a community leader tells a frustrated remote worker, “Use this app, it actually works,” the Time-to-Value accelerates instantly.</p><h4>The Takeaway</h4><p>I still love building, as I find it gives me an edge. Technical depth is a superpower in growth because it allows you to understand exactly <em>how</em> a partnership integration or a new feature can be built.</p><p>But the transition from engineering to growth requires a massive shift in empathy and strategy. The best products feel like magic not because the codebase is complex, but because they act with urgency to solve a community’s pain. They build trust on the ground, leverage strategic partnerships to reach people efficiently, and deliver that “Aha!” moment before the user even has time to doubt them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52a34b700c47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How nsave Made My Freelance Life Seamless: A Game-Changer for International Payments]]></title>
            <link>https://yassin01.medium.com/how-nsave-made-my-freelance-life-seamless-a-game-changer-for-international-payments-e9aca2ae26f0?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9aca2ae26f0</guid>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Fri, 21 Nov 2025 17:38:12 GMT</pubDate>
            <atom:updated>2025-11-21T19:02:56.493Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ll be blunt: getting paid by international clients used to be my least favorite part of freelancing. Currency conversions, bank fees, mysterious delays, it all felt like unnecessary friction that ate time and a chunk of my income. Then I started using <strong>nsave (</strong><a href="https://www.nsave.com/">https://www.nsave.com/</a><strong>)</strong>, and it changed how I manage money across borders. Here’s my honest, no-fluff take on why it’s become a core part of my workflow.</p><p>Working with clients in the US meant constant headaches, poor exchange rates, hidden fees, and waits that could stretch into days. For someone who bills hourly or by project, that’s wasted time and lost income.</p><p>My first test was with ZAKA AI (<a href="https://zaka.ai/">https://zaka.ai/</a>) for an AI Product Mentor role at the startAD AI for Good sandbox. The payment arrived through nsave, and I was genuinely surprised! no hidden fees, transparent pricing, and the money hit my account in just a few hours. I could see exactly what I’d get. No surprises. That straightaway felt like a small miracle.</p><h4>Moving money to my Egyptian bank (no drama!)</h4><p>Getting international funds is only half the battle. I also needed to move money into my Egyptian bank account. nsave made that part easy too. Fast transfers, competitive rates, and nothing that required jumping through hoops. It just worked, which honestly felt like a luxury.</p><h4>Small perks that add up</h4><p>Two things stood out that I didn’t expect:</p><ul><li><strong>Free Pro membership for a month: </strong>they gave it to me without asking. Nice surprise :))</li><li><strong>Daily rewards: </strong>I get a small daily increase (they advertise 5% daily on certain rewards). It’s not huge each day, but if you use the app consistently, it compounds and becomes meaningful.</li></ul><p>These are the kinds of features that make you want to keep using an app, not just tolerate it.</p><h4>The virtual debit card: underrated lifesaver</h4><p>The free virtual debit card was a real game-changer. I no longer have to wrestle with online payment systems that reject local cards. Subscriptions, tools, and online services — they all work without fuss. For anyone who frequently buys software or online services from Egypt with international billing, this is huge.</p><h4>Customer support that actually helps</h4><p>What surprised me most was how helpful their support team has been. Whenever I had questions about transfers, account stuff, or even how features work they responded quickly and explained things clearly. Knowing there’s a responsive human on the other side makes a big difference!</p><h4>Why nsave stands out (my POV)</h4><p>Looking back, I wasted a lot of time and money before switching. nsave isn’t just one great feature, it’s the combination of small and well-executed things:</p><ul><li>Competitive rates on international transfers</li><li>Fast, transparent transactions (no hidden fees)</li><li>Smooth transfers to local Egyptian banks</li><li>Virtual debit card for international online payments</li><li>Free Pro perks that feel meaningful</li><li>A simple, pleasant app design</li><li>Responsive, human customer support</li></ul><h4>Final thoughts</h4><p>I’m still exploring everything the app offers, but I’ve already started recommending it to my friends and fellows in my network. That’s the highest compliment I can give a financial tool.</p><p>If you freelance, work remotely, or handle international payments regularly, put nsave on your radar. It’s not perfect, but it’s one of the best tools I’ve added to my workflow. It saves me time, and gives me peace of mind that my money will arrive and be usable without a headache.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9aca2ae26f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Find Risky SUID/SGID Files in Linux Before an Attacker Does]]></title>
            <link>https://yassin01.medium.com/find-risky-suid-sgid-files-in-linux-before-an-attacker-does-319de8b218a5?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/319de8b218a5</guid>
            <category><![CDATA[centos]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[risk-management]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Sat, 12 Jul 2025 13:39:34 GMT</pubDate>
            <atom:updated>2025-07-12T13:46:33.965Z</atom:updated>
            <content:encoded><![CDATA[<p>SUID/SGID files are a classic vector for Linux privilege escalation. Finding them is a critical step in any security audit. This is the one command you need.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%2528171%252C%2B184%252C%2B195%252C%2B1%2529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26width%3D680%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dsudo%252520find%252520%25252F%252520-perm%252520%25252F6000%252520-type%252520f%25250A&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%252528171%25252C%2B184%25252C%2B195%25252C%2B1%252529%26t%3Dseti%26wt%3Dnone%26l%3Dauto%26width%3D680%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dsudo%25252520find%25252520%2525252F%25252520-perm%25252520%2525252F6000%25252520-type%25252520f%2525250A&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/398d74d738e8df5887717b528c3edbd6/href">https://medium.com/media/398d74d738e8df5887717b528c3edbd6/href</a></iframe><h3>Command Breakdown ⚙️</h3><ul><li><strong>sudo</strong>: Execute as root to avoid &quot;permission denied&quot; errors.</li><li><strong>find /</strong>: Search the entire filesystem, starting from root.</li><li><strong>-perm /6000</strong>: Find files with either the SUID (4000) or SGID (2000) bit set. The / makes it an &quot;OR&quot; search.</li><li><strong>-type f</strong>: Restrict results to files only, ignoring directories.</li></ul><h3>The Security Risk 💣</h3><p>Attackers hunt for these files. A vulnerability in an SUID executable (especially the one owned by root) can be exploited to gain instant root access. Regularly running this command helps you spot misconfigurations and potential backdoors before they get abused.</p><h3>What to Look For</h3><p>Your scan will return both legitimate and potentially dangerous files. Know the difference.</p><p><strong>✅ Expected Benign Files:</strong> These programs need elevated rights to function.</p><ul><li>/usr/bin/sudo</li><li>/usr/bin/passwd</li><li>/usr/bin/chsh</li></ul><p><strong>🚩 Potential Red Flags:</strong> If you see these with SUID bits, investigate immediately. An attacker may have set them.</p><ul><li>/usr/bin/nmap</li><li>/usr/bin/find</li><li>/bin/bash or /bin/sh</li><li>/usr/bin/cp or /usr/bin/vim</li></ul><p>This is a non-negotiable check. Run it, know your system, and eliminate unnecessary risks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=319de8b218a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adam vs. AdamW: Understanding Weight Decay and Its Impact on Model Performance]]></title>
            <link>https://yassin01.medium.com/adam-vs-adamw-understanding-weight-decay-and-its-impact-on-model-performance-b7414f0af8a1?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7414f0af8a1</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Fri, 08 Nov 2024 15:08:10 GMT</pubDate>
            <atom:updated>2024-11-08T15:08:10.405Z</atom:updated>
            <content:encoded><![CDATA[<p>As machine learning engineers, we’re constantly seeking ways to improve our models’ performance. Two popular optimization algorithms, Adam and AdamW, have become staples in our toolkit.</p><p>While both are extensions of <a href="https://www.geeksforgeeks.org/ml-stochastic-gradient-descent-sgd/">SGD</a> (Stochastic Gradient Descent) with adaptive learning rates, they handle weight decay differently, impacting regularization, generalization, and convergence stability.</p><p>In this post, we’ll dive into the mathematics behind these optimizers, explore their differences through code example, and finally, I will provide practical recommendations for when to use each.</p><p><strong><em>Understanding Adam Optimizer</em></strong></p><p><strong>Adam </strong>is an optimization algorithm that adapts the learning rate for each parameter. It does this by calculating two things:</p><ul><li><strong>Momentum:</strong> A running average of past gradients.</li><li><strong>RMSprop:</strong> A running average of the squared gradients.</li></ul><p><strong>The Math:</strong></p><ol><li><strong>Gradient Calculation</strong>:</li></ol><ul><li><strong>gt: </strong>Gradient of the loss function with respect to the parameters at time step t.</li></ul><p>2.<strong> Momentum Calculation</strong>:</p><ul><li><strong>mt:</strong> This is the momentum at time step t. It’s calculated as a weighted average of the current gradient and the previous momentum.</li></ul><pre>mt = β1 * mt-1 + (1 - β1) * gt</pre><ul><li>β1 is a hyperparameter, typically set to 0.9. It controls how much weight we give to past gradients.</li></ul><p>3. <strong>RMSprop Calculation</strong>:</p><ul><li><strong>vt:</strong> This is the RMSprop at time step t. It’s calculated as a weighted average of the squared current gradient and the previous RMSprop:</li></ul><pre>vt = β2 * vt-1 + (1 - β2) * gt^2</pre><ul><li>β2 is another hyperparameter, typically set to 0.999. It controls how much weight we give to past squared gradients.</li></ul><p>4. <strong>Bias Correction:</strong></p><ul><li>Because mt and vt are initialized to 0, the initial estimates are biased towards 0. To correct for this bias, we use:</li></ul><pre>mt_hat = mt / (1 - β1^t) <br>vt_hat = vt / (1 - β2^t)</pre><p>5. <strong>Updating Parameters:</strong></p><ul><li>Finally, we update the parameters using the following formula:</li></ul><pre>θt+1 = θt - η * mt_hat / (sqrt(vt_hat) + ε)</pre><ul><li>θt is the parameter at time step t.</li><li>η is the learning rate.</li><li>ε is a small number (usually 1e-8) to prevent division by zero.</li></ul><p>So Adam combines the benefits of momentum and RMSprop. Momentum helps accelerate the optimization process, while RMSprop helps adapt each parameter&#39;s learning rate.</p><blockquote><strong><em>The Problem with Regular Adam:</em></strong></blockquote><blockquote><em>In Adam, weight decay is often added as an L2 regularization term to the loss function: </em>L(θ) + (λ/2) * ||θ||^2However, <em>adding this term to the loss affects the adaptive learning rates, which can hinder optimal convergence.</em></blockquote><p><strong><em>Understanding AdamW Optimizer</em></strong></p><p>AdamW is a smarter version of Adam as it decouples weight decay from the gradient update step. Instead of adding weight decay to the loss function, it applies weight decay directly during the parameter update, leading to more consistent regularization and better generalization.</p><p><strong>The Math:</strong></p><ol><li><strong>Calculations (Same as Adam)</strong>:</li></ol><pre>mt = β1 * mt-1 + (1 - β1) * gt <br>vt = β2 * vt-1 + (1 - β2) * gt^2<br>mt_hat = mt / (1 - β1^t)<br>vt_hat = vt / (1 - β2^t)</pre><p>2. <strong>Parameter Update (AdamW)</strong>:</p><pre>θt+1 = θt - η * (mt_hat / (sqrt(vt_hat) + ε) + λ * θt)</pre><ul><li><strong>λ:</strong> is the weight decay coefficient applied directly to the parameter update.</li></ul><p>This formulation prevents weight decay from affecting the adaptive learning rates and allows for a more consistent regularization effect.</p><p>By separating weight decay from the gradient-based updates, AdamW achieves better generalization performance without interfering with the learning rate dynamics.</p><p><em>Key Differences Between Adam and AdamW</em></p><pre><br>+================+============================================+===========================================+<br>|     Aspect     |                    Adam                    |                   AdamW                   |<br>+================+============================================+===========================================+<br>| Weight Decay   | Applied via L2 regularization to the loss  | Applied directly during parameter updates |<br>+----------------+--------------------------------------------+-------------------------------------------+<br>| Impact         | Can interfere with adaptive learning rates | Decoupled, leading to consistent updates  |<br>+----------------+--------------------------------------------+-------------------------------------------+<br>| Generalization | May lead to overfitting in complex models  | Better regularization and generalization  |<br>+----------------+--------------------------------------------+-------------------------------------------+</pre><p>In Adam, weight decay is added to the loss function itself. This means the loss function becomes <em>L(θ) + (λ/2) * ||θ||²</em></p><p>Here, λ is the weight decay coefficient and ||θ||^2 is the L2 norm of the parameters.</p><p>This approach can interfere with the adaptive learning rates calculated by Adam. The reason is that the gradient of the weight decay term is proportional to the parameters themselves. This can lead to suboptimal updates, especially when the parameters are large values.</p><p><strong>Weight Decay in AdamW:</strong></p><p>In AdamW, weight decay is applied directly to the parameter update step, rather than being added to the loss function. This means the parameter update equation becomes:</p><pre>θt+1 = θt - η * (mt_hat / (sqrt(vt_hat) + ε) + λ * θt)</pre><p>Here, the weight decay term λ * θt is added directly to the update, without affecting the adaptive learning rates. This ensures that weight decay can be applied consistently without interfering with the optimization process.</p><blockquote>Code Example (Find the code <a href="https://colab.research.google.com/drive/1Gu50SpAlu1JXgQkbTs4383eUI6KlPHT8?usp=sharing">here</a>)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3IL3UWPxzIXOQQmsuZ8oaw.png" /></figure><blockquote>Code Visualization</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*MkKinCkJxO_8TMYVmK1E2A.png" /></figure><p><strong><em>Practical Recommendations:</em></strong></p><ul><li><strong>When to Choose Adam</strong>: You can use Adam for quick prototyping or simpler tasks where regularization is not crucial. It may converge faster initially but can suffer from poor generalization due to interference from weight decay.</li><li><strong>When to Choose AdamW</strong>: In case you have larger models or when training on complex, high-dimensional data, it’s better to choose AdamW, because the decoupled weight decay helps achieve better generalization and stable convergence.</li></ul><h4>Thanks for reading!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7414f0af8a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Your Blueprint to PyTorch’s Dataset Class]]></title>
            <link>https://yassin01.medium.com/your-blueprint-to-pytorchs-dataset-class-2106fc87fd4e?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2106fc87fd4e</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Mon, 21 Oct 2024 20:17:17 GMT</pubDate>
            <atom:updated>2024-10-21T20:37:24.896Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gYA5em4xLQRhcM8v" /><figcaption>source: GH repo</figcaption></figure><h3>Introduction 🌟</h3><p>When working with PyTorch, one of the key steps in your workflow is to manage and manipulate datasets efficiently. That’s where the Dataset class comes in, offering an intuitive and flexible way to handle data for machine learning tasks. Let&#39;s explore how the Dataset class works and walk through examples for regression, classification, and more advanced scenarios.</p><p>This</p><h3>What is the Dataset Class? 🤔</h3><p>The Dataset class is an abstract interface provided by PyTorch to represent datasets. It belongs to the <a href="https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader">torch.utils.data</a> package and is designed to work seamlessly with PyTorch&#39;s data loading utilities. The primary purpose of this class is to provide a consistent way to access data samples and their corresponding labels or targets.</p><p>To leverage the full potential of the Dataset class, it’s common to create a custom subclass. At a minimum, you need to implement two methods:</p><ul><li>__len__: Returns the size of the dataset.</li><li>__getitem__: Retrieves a sample at the given index idx.</li></ul><p>Let’s explore how to create custom datasets for various scenarios.</p><h3>Custom Dataset for Regression 📊</h3><p>Consider a scenario where you have input data X and corresponding target values y. Here’s how you can create a custom dataset class for regression:</p><pre># In this example, X is the feature matrix and y is the target vector. <br># The __getitem__ method returns the feature-target pair at the specified index idx.<br><br>import torch<br>from torch.utils.data import Dataset<br><br>class CustomRegressionDataset(Dataset):<br>    def __init__(self, X, y):<br>        self.X = torch.FloatTensor(X)<br>        self.y = torch.FloatTensor(y)<br><br>    def __len__(self):<br>        return len(self.y)<br><br>    def __getitem__(self, idx):<br>        return self.X[idx], self.y[idx]</pre><h3>Custom Dataset for Image Classification 🖼️</h3><p>For image classification tasks, we can modify our Dataset class to handle images and their corresponding labels:</p><pre>from PIL import Image<br>from torch.utils.data import Dataset<br><br>class CustomImageDataset(Dataset):<br>    def __init__(self, image_paths, labels, transform=None):<br>        self.image_paths = image_paths<br>        self.labels = labels<br>        self.transform = transform<br><br>    def __len__(self):<br>        return len(self.labels)<br><br>    def __getitem__(self, idx):<br>        image = Image.open(self.image_paths[idx]).convert(&#39;RGB&#39;)<br>        label = self.labels[idx]<br>        <br>        if self.transform:<br>            image = self.transform(image)<br>            <br>        return image, label</pre><p>Here, image_paths is a list of file paths to the images, and labels is the corresponding list of class labels. We&#39;ve also added an optional transform parameter to apply data augmentation or preprocessing.</p><h3>Returning Multiple Items from a Dataset 🎁</h3><p>Sometimes, you might need to return multiple items from your dataset, such as images, labels, and additional metadata. Here’s how you can achieve this:</p><pre>class CustomImageDatasetV2(Dataset):<br>    def __init__(self, image_paths, labels, metadata, transform=None):<br>        self.image_paths = image_paths<br>        self.labels = labels<br>        self.metadata = metadata<br>        self.transform = transform<br><br>    def __len__(self):<br>        return len(self.labels)<br><br>    def __getitem__(self, idx):<br>        image = Image.open(self.image_paths[idx]).convert(&#39;RGB&#39;)<br>        label = self.labels[idx]<br>        meta = self.metadata[idx]<br>        <br>        if self.transform:<br>            image = self.transform(image)<br>            <br>        sample = {&#39;image&#39;: image, &#39;label&#39;: label, &#39;metadata&#39;: meta}<br>        return sample</pre><p>This enhanced version includes additional metadata in the returned sample, which can be useful when your model relies on both the image and metadata during training or evaluation.</p><h3>DataLoader: Efficiently Handling Data Batches 🔄</h3><p>Now that we have our dataset, the next step is to use the DataLoader class. This powerful tool allows you to load batches of data for training and evaluation, handling shuffling, batching, and parallel data loading.</p><p>Here’s how to create a DataLoader using our regression dataset:</p><pre>from torch.utils.data import DataLoader<br><br>X = torch.rand(1000, 65)  # Example data<br>y = 5 * torch.sum(X, dim=1)<br>dataset = CustomRegressionDataset(X, y)<br>data_loader = DataLoader(dataset, batch_size=32, shuffle=True, num_workers=4)<br><br>for epoch in range(10):<br>    for batch_idx, (X_batch, y_batch) in enumerate(data_loader):<br>        print(f&quot;Epoch {epoch+1}, Batch {batch_idx+1}, X shape: {X_batch.shape}, y shape: {y_batch.shape}&quot;)</pre><p>In this example, the DataLoader will shuffle the data, provide batches of size 32, and use 4 worker threads to load the data in parallel, speeding up data loading for the dataset.</p><h3>Training a Model with DataLoader 🏋️‍♀️</h3><p>Let’s integrate our DataLoader into a simple training loop:</p><pre>import torch.nn as nn<br>import torch.optim as optim<br><br># Define a simple model<br>model = nn.Linear(65, 1)<br>criterion = nn.MSELoss()<br>optimizer = optim.SGD(model.parameters(), lr=0.01)<br><br># Training loop<br>for epoch in range(10):<br>    for batch_idx, (X_batch, y_batch) in enumerate(data_loader):<br>        outputs = model(X_batch)<br>        loss = criterion(outputs, y_batch)<br>        <br>        optimizer.zero_grad()<br>        loss.backward()<br>        optimizer.step()<br>        <br>        print(f&quot;Epoch {epoch+1}, Batch {batch_idx+1}, Loss: {loss.item():.4f}&quot;)</pre><h3>Handling Large Datasets 🐘</h3><p>When working with datasets that don’t fit in memory, you can modify your __getitem__ method to load data on-the-fly:</p><pre>import h5py # to read and write HDF5 files<br><br>class LargeDataset(Dataset):<br>    def __init__(self, h5py_file):<br>        self.file = h5py.File(h5py_file, &#39;r&#39;)<br>        self.data = self.file[&#39;data&#39;]<br>        self.labels = self.file[&#39;labels&#39;]<br><br>    def __len__(self):<br>        return len(self.labels)<br><br>    def __getitem__(self, idx):<br>        return torch.from_numpy(self.data[idx]), self.labels[idx]<br><br>    def __del__(self):<br>        self.file.close()</pre><h3>Data Augmentation within the Dataset Class 🔀</h3><p>Data augmentation is a powerful technique to increase the diversity of your training data. You can incorporate it directly into your Dataset class:</p><pre>from torchvision import transforms<br><br>class AugmentedImageDataset(Dataset):<br># This dataset applies random horizontal flips and slight rotations to the images <br># and increasing the variety of the training data.<br><br>    def __init__(self, image_paths, labels):<br>        self.image_paths = image_paths<br>        self.labels = labels<br>        self.transform = transforms.Compose([<br>            transforms.RandomHorizontalFlip(),<br>            transforms.RandomRotation(10),<br>            transforms.ToTensor(),<br>            transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))<br>        ])<br><br>    def __len__(self):<br>        return len(self.labels)<br><br>    def __getitem__(self, idx):<br>        image = Image.open(self.image_paths[idx]).convert(&#39;RGB&#39;)<br>        image = self.transform(image)<br>        return image, self.labels[idx]</pre><h3>Common Pitfalls and Gotchas ⚠️</h3><p>While working with PyTorch’s Dataset class, be aware of these common issues:</p><ol><li><strong>Memory Issues</strong>: Be cautious when loading large datasets entirely into memory. Use on-the-fly loading for big datasets.</li><li><strong>Type Mismatches:</strong> Ensure that your __getitem__ method returns tensors of the correct type and shape expected by your model.</li><li><strong>Slow Data Loading:</strong> If data loading is slow, check if you’re performing heavy computations in __getitem__. Consider moving time-consuming operations to the initialization phase.</li><li><strong>Forgetting to Close File Handles:</strong> When working with file-based datasets, remember to close file handles to prevent resource leaks.</li></ol><h3>Conclusion</h3><p>PyTorch’s Dataset class is a powerful tool for managing and preparing data for machine learning tasks. By creating custom datasets, you can handle a wide variety of data types and structures, from simple regression problems to complex image classification tasks with additional metadata.</p><p>Remember to leverage the DataLoader for efficient batching and parallel data loading.</p><p>Happy coding, and may your models train swiftly and generalize well! 🚀🧠💻</p><p>This blog is inspired by this <a href="https://github.com/mrdbourke/pytorch-deep-learning/blob/main/04_pytorch_custom_datasets.ipynb">GitHub repo</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2106fc87fd4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ From Model-First to Product-First: My Journey in Machine Learning ✨]]></title>
            <link>https://yassin01.medium.com/from-model-first-to-product-first-my-journey-in-machine-learning-163a9a8872e7?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/163a9a8872e7</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Tue, 15 Oct 2024 10:54:34 GMT</pubDate>
            <atom:updated>2024-10-15T10:54:34.881Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Na6pwabokLwYbCCPt4Hl5Q.jpeg" /><figcaption>Generated by DALL.E</figcaption></figure><p>When I first ventured into machine learning a year ago, like many others, I was entirely focused on building models. I immersed myself in datasets 📊, optimizing error metrics 📈, and working hard to build the most accurate models possible. This model-first mindset helped me grasp the fundamentals early in my career. However, it didn’t take long to realize that building models was just one piece of the puzzle when it comes to real-world ML applications.</p><h3>🔄 Transitioning to a Product-First Mindset</h3><p>The shift from focusing solely on models to thinking about the <strong>product</strong> was a <strong>game-changer</strong> for me. I have realized that in the real world, building an <strong>ML product</strong> is much more than just developing a great <strong>model</strong> — it’s about <strong>integrating that model into a system</strong> that solves real <strong>business problems</strong>.</p><p>Two critical areas stood out as I began this transition:</p><ol><li><strong>Business Problem Framing</strong></li><li><strong>MLOps</strong></li></ol><h3>🧩 Framing the Business Problem: More Than Just Code</h3><p>Before diving into model development, I learned the importance of <strong>understanding the business problem</strong> at hand. This requires <strong>collaboration </strong>with stakeholders, including those who may not have a technical background. <strong>Asking the right questions ❓</strong>, identifying key metrics 📏, and engaging with <strong>end-users 👩‍💼👨‍💼</strong> became essential steps in defining a clear baseline.</p><p><strong>Key Insights:</strong></p><ul><li>The true value of an ML product lies not just in its <strong>accuracy</strong> but in how well it <strong>solves the right problem</strong>.</li><li><strong>Aligning technical solutions with business goals</strong> ensures that the ML models create <strong>actual value</strong> for end-users, rather than just being <strong>theoretical exercises</strong>.</li></ul><h3>MLOps: Turning Models into Scalable Products</h3><p>The second critical shift was diving into <strong>MLOps, </strong>the set of practices that <strong>automates and monitors</strong> the entire lifecycle of the ML model. As I moved away from just <strong>training models</strong>, I began to contribute to building <strong>pipelines for data ingestion, model training, and inference</strong>.</p><p><strong>Key Insights:</strong></p><ul><li><strong>Setting up automated pipelines</strong> ensures that models not only function well today but can be <strong>updated and scaled</strong> to handle changes in data or requirements tomorrow.</li></ul><p>By integrating <strong>business framing</strong> and <strong>MLOps</strong> into my workflow, my approach to machine learning has <strong>transformed completely</strong>. I no longer see ML projects as just opportunities to <strong>build accurate models</strong>. Instead, I focus on building <strong>solutions that are both technically sound and aligned with business needs</strong>.</p><p>This new way of thinking has opened doors to more <strong>impactful applications</strong> of machine learning, helping me grow as an <strong>ML practitioner</strong> and allowing me to bring <strong>real-world value</strong> to the table.</p><h3>🌟 In Conclusion</h3><p>Whether you’re <strong>new to machine learning </strong>(like me)<strong> </strong>or an <strong>experienced practitioner</strong>, I encourage you to <strong>shift your perspective</strong>. Embrace the <strong>product-first mindset</strong>, invest in learning <strong>business problem framing</strong> and <strong>MLOps</strong>, and watch your ML solutions become more <strong>practical, scalable</strong>, and <strong>impactful</strong>! 💡✨</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=163a9a8872e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Saving and Loading Models in PyTorch: Best Practices]]></title>
            <link>https://yassin01.medium.com/saving-and-loading-models-in-pytorch-best-practices-cc4ce58e5bd7?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc4ce58e5bd7</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Sat, 12 Oct 2024 16:59:18 GMT</pubDate>
            <atom:updated>2024-10-12T17:25:31.823Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RMXD1hk_SS-LMol5LJfMkA.png" /></figure><p>When working with deep learning models in PyTorch, it’s essential to know how to save and load your models efficiently. There are two main ways to do this, but not all methods are recommended. In this quick blog, we’ll explore the different options, explain their differences, and discuss why saving the entire model isn’t ideal.</p><h3>1. Saving the Entire Model (Not Recommended)</h3><p>You can save the entire model using PyTorch’s <a href="https://pytorch.org/docs/stable/generated/torch.save.html#torch-save">torch.save()</a> method, which serializes the model, including its architecture, weights, and optimizer state.</p><pre>torch.save(model, &#39;model.pth&#39;)</pre><p>This method uses Python’s <a href="https://docs.python.org/3/library/pickle.html">pickle</a>utility under the hood, saving everything in one go. While it seems convenient, it has a downside: loading the model requires the exact same architecture definition and class to be present in your codebase. This makes the saved model less portable and harder to use across different projects or environments.</p><h3>2. Saving Only the Model Weights (Recommended)</h3><p>The recommended way to save models in PyTorch is by saving only the model’s learned parameters (weights and biases) using <a href="https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.state_dict">model.state_dict()</a>. This method saves the model&#39;s weights as a dictionary, making it easier to load them into any compatible architecture.</p><pre>torch.save(model.state_dict(), &#39;model_weights.pth&#39;)</pre><p>With this approach, you can easily load the saved weights into a model with the same architecture, even if the original model class isn’t present in the environment.</p><h3>Loading the Model</h3><p>Loading a model depends on how you saved it. Here’s how to load models using both approaches.</p><h4>Loading the Entire Model</h4><p>If you saved the entire model, you can load it directly using torch.load():</p><pre>model = torch.load(&#39;model.pth&#39;)<br>print(model)</pre><p>However, this method is less flexible because you need the original model definition in your code.</p><h4>Loading Only the Model Weights</h4><p>To load only the model weights, you need to reconstruct the model architecture first and then load the saved weights:</p><pre>model = SimpleNet(input_dim=65)  # Recreate the model<br>model.load_state_dict(torch.load(&#39;model_weights.pth&#39;))<br>print(model)</pre><p>This method allows for more flexibility since the model architecture can be defined separately.</p><h3>Why Not Save the Entire Model?</h3><p>While saving the entire model might seem easier, it comes with some limitations:</p><ul><li><strong>Compatibility issues</strong>: You must have the exact model class definition when loading.</li><li><strong>Less flexibility</strong>: If you update the model’s architecture later, the saved file becomes harder to reuse.</li><li><strong>Portability</strong>: Saved files become less portable across different projects or environments.</li></ul><h3>Conclusion</h3><p>For best practices in PyTorch, save the model’s parameters using model.state_dict(). This method ensures more flexibility, better compatibility across environments, and reduces dependency on the original model class when loading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc4ce58e5bd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Difference Between model.eval() and model.train() in PyTorch]]></title>
            <link>https://yassin01.medium.com/understanding-the-difference-between-model-eval-and-model-train-in-pytorch-48e3002ee0a2?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/48e3002ee0a2</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Mon, 07 Oct 2024 17:50:05 GMT</pubDate>
            <atom:updated>2024-10-12T15:58:40.277Z</atom:updated>
            <content:encoded><![CDATA[<p>In PyTorch, switching between training and evaluation modes is crucial to ensure your model behaves correctly during training and inference. Two important methods, <a href="https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.eval">model.eval()</a> and <a href="https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.train">model.train()</a>, control this behavior. Let’s explore what each method does and why it’s important.</p><h3>model.train()</h3><p>This is the default mode when you instantiate a PyTorch model. It tells the model that you’re in training mode. Some layers like Dropout and BatchNorm behave differently in training and evaluation. For example:</p><ul><li><strong>Dropout</strong> randomly zeroes some of the elements of the input tensor during training to prevent overfitting.</li><li><strong>BatchNorm</strong> normalizes input data based on the statistics (mean and variance) of the current batch.</li></ul><h3>model.eval()</h3><p>When you’re done training and need to evaluate your model on validation or test data, you need to switch to evaluation mode using model.eval(). This disables specific behaviors like dropout and ensures that batch normalization layers use the learned running statistics instead of batch-specific stats.</p><pre>model.eval()  # Set to evaluation mode<br><br>with torch.no_grad():  # Disable gradient calculation<br>    out_data = model(data)</pre><h3>Why Use torch.no_grad() with model.eval()?</h3><p>While model.eval() ensures correct layer behavior during inference, it doesn&#39;t disable gradient calculations. To avoid unnecessary memory usage and improve performance during evaluation, you should pair model.eval() with torch.no_grad(). This ensures gradients aren&#39;t computed for the operations inside the block.</p><p>Example: Switching Between Training and Evaluation</p><pre># Training mode<br>model.train()<br># Your training loop<br># ...<br># Now switch to evaluation mode for validation<br>model.eval()<br><br>with torch.no_grad():  # No gradient calculation for evaluation<br>    out_data = model(data)<br><br># Don&#39;t forget to switch back to training mode!<br>model.train()</pre><h3>Conclusion:</h3><ul><li>Use model.train() when training to enable layers like dropout and batch normalization to behave correctly.</li><li>Use model.eval() when evaluating or testing, especially when you&#39;re not optimizing the model.</li><li>Combine model.eval() with torch.no_grad() during evaluation to disable gradient computation and save memory.</li></ul><p>I hope this concise explanation with code clarifies the difference between these two modes!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48e3002ee0a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Reset Your Forgotten Sudo Password in Ubuntu WSL on Windows 11?]]></title>
            <link>https://yassin01.medium.com/how-to-reset-your-forgotten-sudo-password-in-ubuntu-wsl-on-windows-11-2ca2328242f9?source=rss-89a0a4cb9d2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ca2328242f9</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[sudo]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[wsl]]></category>
            <dc:creator><![CDATA[Ahmed Yassin]]></dc:creator>
            <pubDate>Mon, 22 Jul 2024 11:52:17 GMT</pubDate>
            <atom:updated>2024-07-22T11:52:17.861Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V1ASCVSOnZx9oLSH" /><figcaption>Image generated by: DALL-E</figcaption></figure><p>Forgetting the sudo password can be frustrating, especially when using the Ubuntu app in Windows Subsystem for Linux (WSL). Unlike traditional Linux systems, WSL has no separate boot process, making the usual recovery methods inapplicable. In this guide, I will walk you through resetting your password using a simple workaround.</p><blockquote>Step-by-Step Guide:</blockquote><ol><li><strong>Open a Windows Command Prompt as Administrator</strong></li></ol><p>Press Win + X and select Terminal (Admin) or Windows PowerShell (Admin).</p><p>2. <strong>Change the Default User to Root</strong></p><p>To access WSL as the root user, run the following command in the command prompt:</p><pre>ubuntu config --default-user root</pre><p>3. <strong>Open Ubuntu (WSL)</strong></p><p>Launch the Ubuntu app from the Start menu. It should open with root access without asking for a password.</p><p>4.<strong> Change the User Password</strong></p><p>In the Ubuntu terminal, use the passwd command to reset the password for your user account and replace your_username with your actual username:</p><pre>passwd your_username</pre><p>5. <strong>Change the Default User Back to Your Normal User</strong></p><p>Close the Ubuntu app and then revert the default user back to your normal user account:</p><pre>ubuntu config --default-user your_username</pre><p>By following these steps, you should be able to reset your forgotten sudo password in Ubuntu WSL on Windows 11 without needing to reinstall the application or lose any data.</p><p>If you found this guide helpful, please share it with others who might be experiencing the same issue. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ca2328242f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>