<?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 Syed Muhammad Ali Musa Raza on Medium]]></title>
        <description><![CDATA[Stories by Syed Muhammad Ali Musa Raza on Medium]]></description>
        <link>https://medium.com/@alimusa2514?source=rss-7c2405dcbf9b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*A6UKdCYUjr9D0-T6D-fbqg.jpeg</url>
            <title>Stories by Syed Muhammad Ali Musa Raza on Medium</title>
            <link>https://medium.com/@alimusa2514?source=rss-7c2405dcbf9b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:39:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alimusa2514/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[The Diary of a CEO: Insights from the First Pillar — Part 2]]></title>
            <link>https://medium.com/@alimusa2514/the-diary-of-a-ceo-insights-from-the-first-pillar-part-2-e304d9f99d4c?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e304d9f99d4c</guid>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[growth]]></category>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[personal-development]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Wed, 05 Jun 2024 14:17:06 GMT</pubDate>
            <atom:updated>2024-06-05T14:21:47.525Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Diary of a CEO: Insights from the First Pillar — Part 2</h3><h4>By STEVEN BARTLETT</h4><p>Welcome back to the series of book summaries for <strong>“The Diary of a CEO”</strong>. In this second installment, we continue to uncover the profound insights and experiences shared by Steven Bartlett on his journey to becoming a successful entrepreneur. With a blend of personal anecdotes and deep reflections, Bartlett opens up about his experiences, sharing the invaluable lessons he’s learned on his path from a struggling startup founder to a thriving CEO. Dive in with me as we explore more of the lessons and stories that have shaped his remarkable career.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*xG7LFlx2w0YzltkwHkUOaA.png" /><figcaption>Image generated from Dalle-3</figcaption></figure><p>This summary will guide you through the next five laws of first pillar of his wisdom, uncovering the core principles that have guided him to success.</p><h4>PILLAR I: THE SELF — Next 5 laws</h4><h3>LAW 5: You must lean in to bizarre behavior</h3><ul><li>Leaning out isn’t about being “wrong” — it’s about being so arrogantly sure that you’re right that you refuse to listen, learn, and pay attention to new information. This is due to cognitive dissonance.</li><li><strong>Cognitive dissonance</strong> describes the tension you experience when your thoughts conflict with your behavior. It helps explain why so many of us live with contradictory ideas and values. It can also stop us from changing our minds when we should, even when it could save careers, jobs, businesses, or lives.</li><li>Cognitive dissonance is most painful when we encounter facts or evidence that destabilize or conflict with how we see ourselves, undermine our identity and confidence, or make us feel threatened.</li><li>In business, anyone who is too rigidly fixed to an ideology probably won’t provide the solution. Resolving a problem often requires enough humility to disregard your initial hypothesis and listen to what the market is telling you.</li><li>As soon as we make a decision, we automatically begin justifying and rationalizing it. Quite quickly, any doubts we initially had will disappear.</li><li>When we don’t understand something, someone, a new idea, or technology, and when that new thing challenges our identity, intelligence, or livelihood, instead of listening and <strong>leaning in</strong> — in an attempt to ease our cognitive dissonance — we too often lean out and attack them. This might make us feel good, but an ostrich with its head in the sand is at great risk of being eaten.</li><li>Passionate criticism of a technology is usually a positive indicator of its potential — it’s a sign that there’s something worth leaning into, someone is threatened, and innovation is coming.</li><li>Even if a new innovation doesn’t beget a wave of critics, it’s important to remember that innovation disrupts because it’s different. It should look weird, feel unconventional, be misunderstood, and sound wrong, stupid, dumb, or even illegal.</li><li>All too often, what matters to people is not whether an idea is true or effective, but whether it fits with the preconceptions of a dominant convention or incumbent.</li><li>New things put egos, status, jobs, and identities at stake. If we feel someone is “on the other side,” there is dissonance before they’ve said a word.</li><li>Change is only going to get faster — so expect your feelings of cognitive dissonance — the feeling that something doesn’t make sense and conflicts with what you already know — to increase.</li><li>Admitting we’re wrong, rather than reflexively jumping to self-justification or dismissal, requires self-reflection and, at least temporarily, dissonance.</li><li>To reduce dissonance, one technique is to default to believing that two seemingly conflicting ideas can be true at the same time and having a bias to keep them separate, a technique called the <strong>“Shimon Peres Solution”</strong>.</li><li>Your most important beliefs should not be binary; lean-in people can see the merit of the old way and the new way at the same time, without the compulsion to reject or condemn either.</li><li>Those that have the patience and conviction to do this will undoubtedly own the future. Those that don’t will continue to be left behind.</li></ul><blockquote><strong>In moments of dissonance, the key is to resist the temptation of judgment — which is often just an attempt to ease our cognitive dissonance — to lean in, to study, and ask honest questions:</strong></blockquote><ol><li>Why am I believing what I believe?</li><li>Is it possible that I’m wrong?</li><li>Am I leaning out because I don’t understand?</li><li>Am I following the party line?</li><li>Are these my own beliefs or the beliefs of people like me?</li><li>Those that have the patience and conviction to do this will undoubtedly own the future. Those that don’t will continue to be left behind.</li></ol><p><strong><em>Taking no risks will be your biggest risk. You have to risk failure to succeed. You have to risk heartbreak to love. You have to risk criticism for the applause. You have to risk the ordinary to achieve the extraordinary. If you live avoiding risk, you’re risking missing out on life.</em></strong></p><h3>LAW 6: Ask, don’t tell — The question/behavior effect</h3><ul><li>Questions, unlike statements, elicit an active response — they make people think. When facts are on your side, questions become much more effective than simply making a statement.</li><li>Good intentions aren’t enough to create meaningful change. However, a well-designed question might be.</li><li>Asking is better than telling when it comes to influencing your own or another’s behavior. If you question a person about performing a future behavior, the likelihood of that behavior happening will change. Questions prompt a psychological reaction that is different from the reaction to statements.</li><li><strong>The question/behavior effect</strong> is even more powerful with questions that can only be answered with either yes or no.</li><li>The question/behavior effect is at its strongest when questions are used to encourage behavior that fits the receiver’s personal and social ambitions, bringing them closer to who they want to be.</li><li>Starting questions with <strong>“will”</strong> implies ownership and action. The great thing about a <strong>“Yes”</strong> or <strong>“No”</strong> <strong>question</strong> is it doesn’t give you any wiggle room to deceive yourself. It forces you to commit one way or the other.</li></ul><p><strong><em>Ask Questions of your actions, and your actions will answer.</em></strong></p><h3>LAW 7: Never compromise on your Self-Story</h3><ul><li>You can’t quit when no one is watching — you don’t ever want to put that spirit inside yourself. You’ve got to keep those demons out.</li><li>“I hated every minute of my training, but I said, ‘Don’t quit, suffer now and live the rest of your life as a champion.’” — <strong>Muhammad Ali</strong></li><li>Our <strong>self-story</strong> isn’t just influenced by the first-party evidence we’ve collected about ourselves; it’s also profoundly influenced by the stereotypes around us.</li><li>Your self-story develops most rapidly during early childhood and adolescence but continues to form and change as we collect more evidence about ourselves throughout our adult life.</li><li><strong>Mental toughness</strong> is required for enduring success and is principally derived from having a positive self-story. To build your self-story, you need evidence, and that evidence is derived from the choices you make in the face of adversity.</li><li>Your self-story, along with your mental toughness, grit, or resilience, is more important than anything else for achieving your goals in business and in life.</li><li><strong>Self-concept</strong> is defined as our personal belief of who we are, encompassing all our thoughts and feelings about ourselves — physically, personally, and socially. It includes our beliefs about our capabilities, potential, and competence.</li><li>Individuals with a low self-concept view themselves as weak, incompetent, and unwelcome, lose interest in life, become pessimistic about life, and give up easily.</li><li>Individual <strong>resilience</strong> is influenced by having a positive self-story. It makes us more optimistic, helps us persevere longer in the face of adversity, handle stress better, and achieve our goals more easily.</li><li>A person’s character is created, built, or destroyed when no one is watching.</li><li>Everything you do — with or without an audience — provides evidence to you about who you are and what you’re capable of.</li><li>What we believe about ourselves creates our thoughts and feelings; our thoughts and feelings determine our actions; our actions create our evidence. To create new evidence, you must change your actions.</li></ul><p><strong><em>The most convincing sign that someone will achieve new results in the future is new behavior in the present.</em></strong></p><h3>LAW 8: Never fight a bad habit</h3><blockquote><strong>Habit Loops consist of:</strong></blockquote><ol><li><strong>Cue</strong>: The trigger for habitual behavior</li><li><strong>Routine</strong>: The habitual behavior</li><li><strong>Reward</strong>: The result/impact of the habitual behavior</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*-L8DiICkDnewAnTLPoCiGg.png" /><figcaption>The Habit Loop</figcaption></figure><ul><li>Social media companies get their users addicted to their products by exploiting these habit loops.</li><li>Have you ever noticed that when you focus too much on stopping something, you ultimately end up rebounding and doing it more? This is because humans are action-oriented creatures.</li><li>Our brain associates rewards with actions, so you need to pair an action with a reward if you want to change a habit.</li><li>The more you try to suppress an action or thought, the more likely you are to take the action or think about that thought. This is strong evidence for the <strong>Power of Manifestation</strong> — you get what you think about — but it’s also further evidence that trying to fight a habit or not think about a habit is a foolish strategy.</li><li>If you want to break a habit, get some sleep, as sleep is the foundation of success, not an inhibitor of it. You’ll succeed if you feel good, if you’re not overstressed, and if you’ve had a good night’s sleep.</li><li>Willpower appears to diminish the more we use it. Rather than being simply a skill, willpower is more like a muscle, and as with any muscle in the body, it gets tired as it works harder.</li><li>Making sure your habits are small and achievable enough to be sustainable — without the need for major sacrifice, which will deplete your willpower reserves — is incredibly important.</li><li>If you want to overcome a habit, do not fight against it. Work with your habit loop and use positive action to replace it. Do not take on more than one habit at once.</li></ul><p><strong><em>Sleep. Lift, Move, Smile, Laugh, Listen, Read, Save, Hydrate, Fast, Build, Create. Your habits are your future.</em></strong></p><h3>LAW 9: Always prioritize your first foundation</h3><ul><li>You only get one mind, and you only get one body. So, it’s got to last a lifetime.</li><li>Your health should, in fact, be your top priority. There is no greater form of gratitude than taking care of yourself.</li><li>Those who think they have no time for bodily exercise will sooner or later have to find time for illness.</li><li>Take care of your body; it is, after all, the only vehicle you get to own, the only vessel you’ll use to explore the world, and the only house you can ever truly call home.</li></ul><p><strong><em>Your health is your first foundation.</em></strong></p><h4>Additional Links:</h4><p>To check out more about the book:</p><blockquote><a href="https://stevenbartlett.com/doac#:~:text=The%20Diary%20of%20a%20CEO%20is%20an%20unfiltered%20journey%20into,and%20created%20stories%20worth%20studying.">The Diary Of A CEO — Website</a></blockquote><blockquote><a href="https://www.youtube.com/@TheDiaryOfACEO">The Diary Of A CEO — Podcast</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e304d9f99d4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Diary of a CEO: Insights from the First Pillar — Part I]]></title>
            <link>https://medium.com/@alimusa2514/the-diary-of-a-ceo-insights-from-the-first-pillar-part-i-c98a79414d0a?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c98a79414d0a</guid>
            <category><![CDATA[entrepreneurship]]></category>
            <category><![CDATA[diary-of-a-ceo]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[leadership]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Sun, 26 May 2024 06:34:13 GMT</pubDate>
            <atom:updated>2024-05-26T07:02:04.753Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Diary of a CEO: Insights from the First Pillar — Part I</h3><h4>By STEVEN BARTLETT</h4><p>I will dive deep into the insightful world of <strong>The Diary of a CEO</strong> by <em>Steven Bartlett.</em> This book offers a unique and candid glimpse into the mind of one of the most influential young entrepreneurs of our time. Through a series of reflections and personal anecdotes, Bartlett shares the lessons he’s learned on his journey from a struggling startup founder to a successful CEO.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*xG7LFlx2w0YzltkwHkUOaA.png" /><figcaption>Image generated from Dalle-3</figcaption></figure><p>This summary will guide you through the first four of first pillar of his wisdom, uncovering the core principles that have guided him to success.</p><h3>PILLAR I: THE SELF — First 4 laws</h3><h4>LAW 1: Fill your five buckets in the right order</h4><blockquote><strong>The five buckets:</strong></blockquote><ol><li>What you know (your <strong>knowledge</strong>)</li><li>What you can do (your <strong>skills</strong>)</li><li>Who you know (your <strong>network</strong>)</li><li>What you have (your <strong>resources</strong>)</li><li>What the world thinks of you (your <strong>reputation</strong>)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hq1myZolBiNO31JIZal5nA.jpeg" /><figcaption>The five buckets</figcaption></figure><ul><li>The sum of the five buckets is the sum of your professional potential.</li><li>The fullness of these buckets will determine how big, believable and achievable your dreams are to you, and to those that hear them.</li><li>Someone fortunate enough to have five full buckets has all the potential needed to change the world.</li><li>A <strong>professional earthquake</strong> is defined as an unpredictable career event that adversely impacts you. This could be anything: a technological innovation that disrupts the whole industry, being fired by your employer or if you’re a founder, your company going under.</li><li>There are only two buckets that any such professional earthquake can never empty- it can take away your network, it can take your resources, it can impact your reputation, but it can never <strong>remove</strong> your knowledge and it can never <strong>unlearn</strong> your skills.</li><li>The first two buckets are your longevity, your foundation and the clearest predictor of your future.</li><li>Applied knowledge is skill, and the more you can expand and apply your knowledge, the more value you’ll create in the world. The value will be repaid in a growing network, abundant resources and a robust reputation. So Make sure you fill your buckets in the <strong>right order</strong>.</li></ul><p><strong><em>Those who hoard gold have riches for a moment. Those who hoard knowledge and skills have riches for a lifetime. True prosperity is what you know and what you can do.</em></strong></p><h4>LAW 2: To master it you must create an obligation to teach it</h4><ul><li>If you want to learn something, read about it. If you want to understand something, write about it. If you want to master something, teach it.</li><li><strong>“Skin in the game”</strong> is an important psychological tool to harness if you want to accelerate your learning curve in any area of your life. Having skin in the game raises the stakes of your learning by building deeper psychological incentives to perform a behavior. The “<strong>skin</strong>” can be anything from money to personal public commitment.</li><li>Human behavior is more strongly driven by the motivation to avoid losses than to pursue gains, which scientists call “<strong>Loss Aversion</strong>”. So give yourself something to lose.</li><li>If you want to master something, do it <strong>publicly</strong> and do it <strong>consistently</strong>.</li><li>Being able to simplify an idea and successfully share it with others is both the path to understanding it and the proof that you do.</li><li>One of the ways we mask our lack of understanding of an idea is using more words, bigger words and less necessary words.</li><li>The person who learns the most in any classroom is the teacher.</li></ul><p><strong><em>You don’t become a master because you’re able to retain knowledge. You become a master when you’re able to release it.</em></strong></p><h4>LAW 3: You must never disagree</h4><ul><li><strong>Healthy conflict</strong> strengthens relationships because those involved are working against a problem; <strong>unhealthy conflict</strong> weakens a relationship because those involved are working against each other.</li><li>If you want to keep someone’s brain lit up and receptive to your point of view, you must not stand your response with a statement of disagreement.</li><li>The strength of any carefully reasoned, logical argument isn’t likely to be recognized when you open with disagreement — regardless of how much evidence you have or how objectively correct you are.</li><li><strong>To never disagree</strong> — is the critical skill that will allow you to become an effective negotiator, speaker, salesperson, business leader, writer — and partner.</li><li>Art of becoming a great communicator, conversationalist or partner is first listening so that the other person feels “<strong>heard”</strong>, and then making sure you reply in a way that makes them feel “<strong>understood”</strong>.</li><li>The key to changing someone’s mind is finding a shared belief or motive that will keep their brain open to your point of view.</li></ul><p><strong><em>Our words should be bridges to comprehension, not barriers to connection. Disagree less, understand more.</em></strong></p><h4>LAW 4: You do not get to choose what you believe</h4><ul><li>The fundamental beliefs you hold about yourself, others and the world — <strong>you’ve chosen none of them</strong>.</li><li>One of the brain’s main purposes is to predict by spotting patterns and making assumptions based on those patterns, it must do so as efficiently and in as little time as possible. Beliefs allow the brain to make such forecasts quickly.</li><li>If we trust someone’s authority on a matter we are very likely to defer to their authority, adopt their belief and do what they say.</li></ul><blockquote><strong>Four factors determine whether a new piece of evidence will change an existing belief:</strong></blockquote><ol><li>A person’s current evidence</li><li>Their confidence in their current evidence</li><li>The new evidence</li><li>Their confidence in that new evidence</li></ol><ul><li>Don’t try and break or argue with someone’s existing evidence; instead focus on implanting completely new evidence, and make sure you’ve highlighted the incredibly positive impact this new evidence will have on them.</li><li>Asking someone to explain the detail and logic underpinning their strongly held beliefs is a profoundly powerful way to reduce their conviction. This works for limiting beliefs too. If someone is struggling with their self-belief and believes they’re worthless, having them explain in as much detail as they can, why they feel that way, and questioning their responses, is an effective way to get them to relinquish that belief.</li><li>Do the thing you fear, and keep on doing it. That is the quickest and surest way ever yet discovered to conquer fear.</li><li>Beliefs change when a person gets new counteracting evidence that they have a high degree of subjective confidence in.</li><li>A person is more likely to believe the validity of the new evidence if its source agrees with their other existing beliefs.</li><li>Evidence that offers <strong>positive outcomes</strong> is the easiest evidence for someone to believe.</li><li>If you want to change someone’s belief, don’t attack it.</li><li><strong>Unchallenged limiting beliefs</strong> are the greatest barrier between who we are and who we could be.</li></ul><p><strong><em>Stop telling yourself you’re not qualified, good enough or worthy. Growth happens when you start doing the things you’re not qualified to do.</em></strong></p><h3>Additional Links:</h3><p>To check out more about the book:</p><p><a href="https://stevenbartlett.com/doac#:~:text=The%20Diary%20of%20a%20CEO%20is%20an%20unfiltered%20journey%20into,and%20created%20stories%20worth%20studying.">The Diary Of A CEO - Website</a></p><p><a href="https://www.youtube.com/@TheDiaryOfACEO">The Diary Of A CEO - Podcast</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c98a79414d0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PyTorch Essentials: Building Foundations in Generative AI]]></title>
            <link>https://medium.com/@alimusa2514/pytorch-essentials-building-foundations-in-generative-ai-36fff055264c?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/36fff055264c</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deeplearing]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Mon, 13 Nov 2023 11:47:14 GMT</pubDate>
            <atom:updated>2023-11-13T11:50:14.021Z</atom:updated>
            <content:encoded><![CDATA[<h4>Exploring the Core Principles and Impact of PyTorch in Creative AI Applications</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-aResBCHT3ciXQR3zzSVpQ.png" /><figcaption>PyTorch</figcaption></figure><p>In the rapidly evolving world of artificial intelligence, generative AI stands out for its ability to create new, original content. From art to music, the implications are vast and deeply intriguing. At the heart of many of these generative AI innovations is PyTorch, an open-source machine learning library known for its flexibility, efficiency, and user-friendly interface. This blog delves into the core principles of PyTorch and its significant impact on creative AI applications.</p><h3>PyTorch</h3><blockquote><strong><em>What is PyTorch?</em></strong></blockquote><p>PyTorch is an open-source machine learning library widely used for deep learning applications. Developed by Facebook’s AI Research lab, it stands out for its ease of use, flexibility, and dynamic computational graph, which allows for intuitive coding and rapid iteration. PyTorch provides a rich ecosystem of tools and libraries, supporting both CPU and GPU computation, making it highly efficient for a wide range of applications, from computer vision and natural language processing to generative AI. Its user-friendly interface and extensive documentation make it a popular choice among researchers and developers for building and experimenting with complex AI models.</p><blockquote><strong><em>Use Cases</em></strong></blockquote><p>PyTorch is primarily used for developing and training deep learning models, leveraging its dynamic computation graph for efficient and flexible model design. Its primary usage spans across various domains of artificial intelligence:</p><ul><li><strong>Computer Vision:</strong> For tasks like image classification, object detection, and image generation.</li><li><strong>Natural Language Processing (NLP):</strong> Used in language translation, sentiment analysis, and text generation.</li><li><strong>Generative AI:</strong> Creating generative adversarial networks (GANs) and variational autoencoders (VAEs) for generating new, synthetic data like images, text, or audio.</li><li><strong>Reinforcement Learning: </strong>Designing algorithms for game playing, robotics, and decision-making applications.</li><li><strong>Time Series Analysis:</strong> Used in forecasting and anomaly detection in finance, weather prediction, and more.</li></ul><p>PyTorch’s intuitive design and strong GPU acceleration make it ideal for both academic research and industrial applications, facilitating rapid prototyping and scalable deployment of AI models.</p><h3>PyTorch in Generative AI</h3><blockquote><strong><em>Core Principles and Ecosystem</em></strong></blockquote><p>PyTorch’s dynamic computational graph, robust ecosystem, and GPU acceleration capabilities make it a go-to choice for AI researchers and enthusiasts. The library’s intuitive design allows for seamless experimentation with complex models, a key feature for generative AI development. Beyond its core, PyTorch is supported by an array of tools like <strong>torchvision </strong>and <strong>torchgan</strong>, further broadening its applicability in creative domains.</p><h3>Building Blocks of Generative Models in PyTorch</h3><blockquote><strong><em>Types and Implementation</em></strong></blockquote><p>Generative models such as GANs (Generative Adversarial Networks) and VAEs (Variational Autoencoders) form the backbone of generative AI. PyTorch’s architecture lends itself well to the implementation of these models. For instance, constructing a basic GAN in PyTorch can be quite straightforward:</p><pre># Basic PyTorch GAN Model Example (Simplified)<br>import torch<br>import torch.nn as nn<br><br># Define the Generator<br>class Generator(nn.Module):<br>    # Implementation details here<br><br># Define the Discriminator<br>class Discriminator(nn.Module):<br>    # Implementation details here<br><br># Instantiate the models<br>generator = Generator()<br>discriminator = Discriminator()</pre><h3>Advanced Techniques and Best Practices</h3><blockquote><strong><em>Optimization and Handling Challenges</em></strong></blockquote><p>Training generative models involves unique challenges. Techniques like batch normalization and learning rate scheduling can significantly impact the model’s performance and stability. A particularly notorious issue in GANs is ‘mode collapse,’ which requires careful strategy and tuning to avoid.</p><h3>PyTorch and Creative AI Applications</h3><blockquote><strong><em>From Concept to Real-World Impact</em></strong></blockquote><p>PyTorch’s influence extends beyond research labs to real-world applications in creative fields. Its adaptability has powered numerous projects in art generation, music creation, and more, showcasing the library’s versatility. Community contributions play a vital role in this, continually pushing the boundaries of what’s possible with PyTorch in creative AI.</p><h3>Future of Generative AI with PyTorch</h3><blockquote><strong><em>Emerging Trends and Learning Resources</em></strong></blockquote><p>As the field of generative AI advances, PyTorch continues to evolve, embracing trends like diffusion models. For those interested in diving deeper, resources like official PyTorch tutorials and online courses are invaluable.</p><h3>Conclusion</h3><blockquote><strong><em>The Journey Ahead</em></strong></blockquote><p>PyTorch stands as a pillar in the generative AI landscape, blending power with usability. Whether you’re a seasoned practitioner or just starting, the library offers a path to explore the fascinating world of generative AI. The journey into this realm of endless creative possibilities is just beginning, and PyTorch is an excellent companion for the adventure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36fff055264c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Crafting The Perfect Upwork Proposal Using ChatGPT Prompts: Your Path to Proposal Perfection]]></title>
            <link>https://medium.com/@alimusa2514/crafting-the-perfect-upwork-proposal-using-chatgpt-prompts-your-path-to-proposal-perfection-5899abcbaa2a?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5899abcbaa2a</guid>
            <category><![CDATA[proposal]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[upwork]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Tue, 10 Oct 2023 13:34:13 GMT</pubDate>
            <atom:updated>2023-10-10T13:34:13.798Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Comprehensive Guide</h4><blockquote><strong><em>Introduction:</em></strong></blockquote><p>In a bustling marketplace like Upwork, standing out from the crowd is paramount. But what if you had a secret weapon? Something that not just gets your proposal noticed but keeps the client hooked? Enter ChatGPT prompts. ChatGPT, a language model developed by OpenAI, has emerged as a trusty sidekick for freelancers eager to enhance their proposal game. While many have heard of it, few truly harness its power in crafting exceptional, personalized job proposals. If this all sounds new to you, don’t worry. This article dives into the realm of crafting personalized, compelling Upwork proposals using ChatGPT prompts. You’ll learn about pivotal strategies and prompting styles that can significantly uplift your proposal’s quality, resonating with potential clients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PZ5MRXaDjsgRlm3DC0y3GA.png" /><figcaption>Job Posting</figcaption></figure><blockquote><strong><em>Requirements:</em></strong></blockquote><p>This step involves defining your project’s scope, goals and timeline. Outlining these aspects gives you a solid foundation to build your proposal. Take time to contemplate key questions such as:</p><ul><li>Details about who you are and what you do?</li><li>What is the main objective of your proposal?</li><li>What problem does it solve?</li><li>What is your target audience?</li><li>How much time do you need?</li></ul><p>Once you figure these out, you’ll have enough information to create a proposal.</p><blockquote><strong><em>Brainstorming The Key Points For Your Proposal:</em></strong></blockquote><p>You can use ChatGPT to brainstorm ideas and add more to your overall project.</p><p>Example Prompt:</p><pre>Generate the main objectives to include in a proposal for a writer who wants <br>to write their way to success!</pre><blockquote><strong><em>Get the Standard Proposal Outline in Your Industry:</em></strong></blockquote><p>Different projects and industries call for specific outlines and structures when it comes to proposals. It’s crucial to tailor your proposal to the format that’s standard for your field. Doing this not only helps in organizing your thoughts but also makes it easier for your audience to follow along since they’re likely familiar with the layout. ChatGPT is here to help by whipping up a blank standard outline for your proposal. If there are certain sections your audience expects to see, just let ChatGPT know and it’ll incorporate them in the outline for you.</p><p>Example Prompt:</p><pre>Generate a standard proposal outline for a job in article/blog writing.</pre><blockquote><strong><em>Tell about yourself:</em></strong></blockquote><p>Once you have a standard proposal outline, now it’s time for you to personalize it. To personalize the proposal, you need to enter details about yourself like who are you? What do you do? What is your experience in this field? Incorporate your skills, experiences, and past successes in the proposal.</p><p>Example Prompt:</p><pre>I am a Machine Learning and Prompt Engineer. I have 2 years of prior experience <br>in this field. I write articles/blogs on medium about the latest technologies<br>and advancements in the field of Artificial Intelligence.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8zgBkZRreOtkpt_R2OL8pg.png" /><figcaption>Tell about yourself</figcaption></figure><blockquote><strong><em>Research the Client and Job Post:</em></strong></blockquote><p>Even with ChatGPT, it’s possible to sound generic. The antidote? The more specific your prompt, the more personalized your output. Note down specific details from the job post. What are the client’s pain points? What exactly are they looking for? Jot down any specifics about the business, brand voice, or past projects. Establishing a clear understanding will inform how you tailor your ChatGPT prompts.</p><p>Example Prompt:</p><pre>Provide a proposal introduction for &#39;Brewed Moments&#39;, a rustic coffee shop in <br>Seattle looking for vintage-themed posters highlighting their new summer brew.</pre><blockquote><strong><em>Understanding the Power of Personalization:</em></strong></blockquote><p>Clients receive a myriad of proposals for one job post. The only way to stand out? Make it about them. Show that you’ve done your homework. When you personalize, you resonate. This creates a subconscious connection between you and the potential client. For this just copy the whole description of the job and paste it into ChatGPT and ask it to tailor your proposal according to the job description.</p><p>Example Prompt:</p><pre>We are seeking a motivated individual who loves writing about company news <br>and other facts related to businesses!<br><br>This job is different from the usual - it&#39;s an opportunity for you to be a <br>significant part of our journey as entrepreneurs, where your work will play a <br>crucial role in our success.<br><br>Here&#39;s What You Get:<br><br>Future Profits:<br>We can&#39;t offer immediate pay, but we believe in the potential of our project. <br>As we grow, we will share the profits with our team.<br><br>Portfolio Enhancement:<br>If you are a writer looking to build up your portfolio, this is your chance. <br>Your articles will be featured on our website, helping you gain recognition <br>and showcase your skills.<br><br>Meet Interesting People:<br>We engage with fascinating startups and tech experts every day. When you <br>join our team, you will dive into the world of tech entrepreneurship, make <br>valuable connections, and learn from the best.<br><br>This is the job description. So make an Upwork proposal for me keeping in mind<br>all the things I stated earlier about myself.</pre><blockquote><strong><em>Creating a Connection:</em></strong></blockquote><p>Use ChatGPT to craft a narrative in your proposal that connects with the client on a personal level. Share your enthusiasm for the project and explain why you’re the right fit, leveraging ChatGPT to articulate your thoughts persuasively.</p><p>Example Prompt:</p><pre>Tell me reasons why i would be the right fit for the job keeping in mind <br>the information I provided about myself.</pre><blockquote><strong><em>Write Out the Full Proposal:</em></strong></blockquote><p>With your outline at hand, you can now flesh out the proposal and fill in the gaps. ChatGPT can assist you in writing the full content of your proposal, ensuring that each section is coherent, well-structured, and persuasive. A prerequisite to this is that you thoroughly study the outline and decide which parts you want to expand. You can provide key points, and ChatGPT will transform them into well-written paragraphs that convey your ideas effectively.</p><p>Example Prompt:</p><pre>Expand on the understanding of the project and the personal development <br>section in the outline you just wrote. Include that the project will take a <br>total of two months to complete.</pre><blockquote><strong><em>Setting up the tone for your proposal:</em></strong></blockquote><p>You can personalize any specific tone, emotion, or keyword you want it to use in its response.</p><p>Example Prompt:</p><pre>Rewrite this text as this is an Upwork proposal and the tone should be <br>professional throughout the proposal. Include Keywords such as Motivated <br>Individual, Portfolio Enhancement and Tech Entrepreneurship:<br>PASTE YOUR TEXT HERE</pre><blockquote><strong><em>Polishing your proposal:</em></strong></blockquote><p>You can use ChatGPT to proofread your proposal to look for any typing and grammatical mistakes.</p><p>Example Prompt:</p><pre>Proofread this text also insure there are no spelling mistakes/type errors<br>and no grammatical mistakes as this an Upwork proposal: PASTE YOUR TEXT HERE</pre><blockquote><strong><em>Refine and Personalize Further:</em></strong></blockquote><p>ChatGPT will give you a draft. It’s your job to add the finishing touches. Maybe you’ve noticed the client likes a particular design style from their website or has a fondness for a specific color palette — integrate these observations.</p><blockquote><strong><em>Wrap It Up with a Bang:</em></strong></blockquote><p>Your proposal’s conclusion is your final pitch. Here’s a tip: Use ChatGPT to brainstorm compelling ways to close your proposal.</p><p>Example Prompt:</p><pre>Provide a memorable concluding sentence for a proposal targeting for a<br>writer who wants to write their way to success!</pre><blockquote><strong><em>Visual Engagement:</em></strong></blockquote><p>Pair your well-crafted text with visuals generated using platforms such as Canva or Midjourney to enrich your proposal. Whether through flow diagrams, pie charts, or any other poster style you prefer, these visuals can help convey the essence of your proposal to the employer effectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qT56f-ZqftI9Z4770p5Z9A.png" /><figcaption>Visualization of your proposal</figcaption></figure><blockquote><strong><em>Over-reliance on ChatGPT:</em></strong></blockquote><p>Remember, ChatGPT is a tool. Use it for ideation and drafts but always add your human touch to finalize.</p><blockquote><strong><em>Conclusion:</em></strong></blockquote><p>With the power of ChatGPT and the art of personalization, your Upwork proposals won’t just be proposals. The blend of human creativity and AI’s processing power can significantly elevate your freelance career, making you a sought-after professional on Upwork’s competitive platform. They’ll be a reflection of the dedication, research, and personal touch that you bring to the table. So just stand out, resonate, and watch as those job offers come pouring in.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5899abcbaa2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vector Databases]]></title>
            <link>https://medium.com/@alimusa2514/vector-databases-fd40f962db58?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd40f962db58</guid>
            <category><![CDATA[pinecone]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[vector]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Wed, 20 Sep 2023 12:46:14 GMT</pubDate>
            <atom:updated>2023-09-20T12:46:14.556Z</atom:updated>
            <content:encoded><![CDATA[<h4>Vector Databases: The Future of Efficient Data Search</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVk9H8fkcnvtNDveWub6Sw.png" /><figcaption>Vector Databases</figcaption></figure><blockquote><strong><em>Introduction:</em></strong></blockquote><p>A vector database indexes and stores vector embeddings for fast retrieval and similarity search. These embeddings are typically high-dimensional and are generated by machine learning models, especially deep learning models.</p><blockquote><strong><em>Why Vector Databases?</em></strong></blockquote><p>Traditional relational databases are optimized for structured data with well-defined schema, but they are not ideal for searching through high-dimensional vectors efficiently. As machine learning models and applications such as recommendation systems, natural language processing, and image recognition have grown in popularity, so too has the need for efficient storage and querying of vector data. Vector databases help fill this gap.</p><blockquote><strong><em>Key Features of Vector Databases:</em></strong></blockquote><ol><li><strong>Similarity Search:</strong> One of the primary operations in vector databases is similarity search, where given a vector, the database retrieves the most similar vectors from the dataset. This operation is often based on distance metrics like cosine similarity or Euclidean distance.</li><li><strong>Scalability:</strong> Vector databases are designed to handle large-scale datasets, often containing billions of vectors.</li><li><strong>Indexing:</strong> To speed up similarity searches, vector databases use specialized indexing techniques such as Approximate Nearest Neighbors (ANN) algorithms. These methods provide a trade-off between search accuracy and speed.</li><li><strong>Integration with Machine Learning:</strong> Vector databases often provide native support or integrations for popular machine learning frameworks, allowing easy storage and retrieval of embeddings.</li></ol><blockquote><strong><em>How do they work:</em></strong></blockquote><p>Vector databases uses cleaver algorithms to calculate the vector embeddings. This is done by the machine learning models. It uses two main techniques as follows:</p><blockquote><strong><em>Vector Embeddings:</em></strong></blockquote><p>These embeddings are just a list of numbers that represents the data in a different way. For example we can calculate the embeddings for a single word, a sentence or an image. Now when we have the numerical data, the computer can understand it easily. Now the the easiest possibility we get is to find the other similar vectors and it can be done by finding the distance between those vectors and then doing a nearest neighbor search. This way we can find the similar items in the database. It can be in any number of dimensions. As the number of dimensions increase the time in finding these items would go up, so for this another technique is used for searching — Vector Indexing.</p><blockquote><strong><em>Vector Indexing:</em></strong></blockquote><p>Vector indexing is needed for efficient search. Index is a data structure which facilitates the search process. So the indexing step maps the vectors to a new data structure that will enable faster searching. Without proper indexing, searching through high-dimensional vectors would be computationally expensive, especially for large datasets. The purpose of vector indexing is to optimize this search process by creating a structure that allows for approximate nearest neighbor (ANN) search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*WAwOwYD2TwjlRkukRvRMRg.png" /><figcaption>Vector Database mechanism</figcaption></figure><blockquote><strong><em>Use Cases for Vector Databases:</em></strong></blockquote><ol><li><strong>Long Term Memory for Large Language Models: </strong>Store and efficiently retrieve specific knowledge or patterns as high-dimensional vectors. This integration enhances the model’s consistency, adaptability, and scalability in knowledge retrieval.</li><li><strong>Semantic Search(NLP): </strong>Search for content based on semantic meaning rather than exact keyword matches.</li><li><strong>Document Clustering(NLP):</strong> Group similar articles, papers, or documents based on their vector representations.</li><li><strong>Question Answering(NLP):</strong> Find the most relevant answer or document given a question in vector form.</li><li><strong>Recommendation Systems:</strong> For platforms like e-commerce, music, or movies, items can be represented as vectors. Given a user’s past behavior (also as a vector), similar items can be recommended.</li><li><strong>Voice Recognition and Search:</strong> Convert voice recordings into vectors and search for similar voice patterns or commands.</li><li><strong>Video Retrieval:</strong> Extract features from videos to represent them as vectors, enabling video search based on content.</li><li><strong>Fraud Detection:</strong> Transaction behaviors can be vectorized, and unusual patterns (vectors deviating from typical patterns) can be flagged as potential fraud.</li><li><strong>Personalized Advertising:</strong> Advertisements can be represented as vectors, and users’ preferences or behavior can also be vectorized. This allows platforms to serve the most relevant ads to users.</li><li><strong>E-commerce Search:</strong> Products can be transformed into vectors based on their descriptions, images, or reviews. When a user searches, they can be presented with products that are semantically closer to their query.</li></ol><blockquote><strong><em>Examples of Popular Vector Databases:</em></strong></blockquote><ol><li><strong>Milvus:</strong> An open-source vector database that supports massive-scale vector data and provides advanced similarity search capabilities.</li><li><strong>Faiss (Facebook AI Similarity Search):</strong> Developed by Facebook AI Research (FAIR), Faiss is a library that allows efficient similarity search and clustering of dense vectors. While it’s not a database per se, it’s often used in conjunction with databases to provide vector search capabilities.</li><li><strong>Pinecone:</strong> A managed vector database service designed for machine learning applications. It provides scalable and efficient similarity search capabilities.</li><li><strong>Weaviate:</strong> An open-source vector search engine that combines the power of vector search with traditional database functionalities.</li><li><strong>Elasticsearch with Vector Plugins:</strong> Elasticsearch, a popular search engine, can be extended with plugins to support vector searches.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd40f962db58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Fine Tune GPT 3.5 Turbo]]></title>
            <link>https://medium.com/@alimusa2514/how-to-fine-tune-gpt-3-5-turbo-8253ed30fe09?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8253ed30fe09</guid>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[gpt-3]]></category>
            <category><![CDATA[gpt-4]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Tue, 12 Sep 2023 08:37:50 GMT</pubDate>
            <atom:updated>2023-09-12T11:27:40.333Z</atom:updated>
            <content:encoded><![CDATA[<h4>Step by step guide on how to fine tune GPT-3.5 Turbo</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9bZsEi1y5yNnYBuuyceNPw.png" /><figcaption>Logo</figcaption></figure><blockquote><strong><em>Fine Tuning:</em></strong></blockquote><p>Fine-tuning refers to the process of taking a pre-trained model (a model trained on a large dataset) and adapting it to a new, but related, task. Instead of training a model from scratch, which can be time-consuming and require a lot of data, fine-tuning leverages the knowledge captured in the pre-trained model to achieve better performance on the new task with potentially less data.</p><blockquote><strong><em>Use cases:</em></strong></blockquote><ol><li>Setting the style, tone, format, or other qualitative aspects</li><li>Improving reliability at producing a desired output</li><li>Correcting failures to follow complex prompts</li><li>Handling many edge cases in specific ways</li><li>Performing a new skill or task that’s hard to articulate in a prompt</li></ol><blockquote><strong><em>Preparing your dataset:</em></strong></blockquote><p>When you’ve concluded that fine-tuning is the optimal approach (after maximizing the effectiveness of your prompt and pinpointing persistent model issues), it’s time to get your data ready for training. Craft a varied collection of sample conversations that closely mirror the interactions you expect the model to handle during real-time usage in a production environment. Keeping in mind the lowest possible dataset size should be 10, but a size of 100 is a decent size to fine tune your dataset.</p><blockquote><strong><em>Generating your OpenAI API Key:</em></strong></blockquote><p>once you have made your OpenAI account, then you need to generate your OpenAI API Key. So, for this go to your account photo which is on the top right corner of your screen. Then select <strong>View API Keys</strong>. It will take you to the API keys section. Click on the create new secret key button to create a new secret key. Then name your secret key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52yYxGw8aI2I5jHVIcK9jQ.png" /></figure><p>After this click on the create secret key button on the bottom left of the tab. It will then give you your key and once it displays it to you, make sure to store it on your device in a word file or any other file you would like to use because it will not show it to you again for security purposes.</p><blockquote><strong><em>Adding credit to your OpenAI account:</em></strong></blockquote><p>You will need to add some credit into your account for fine tuning, so for this go to <strong>Manage account,</strong> click on<strong> </strong><a href="https://platform.openai.com/account/billing/overview"><strong>Billing </strong></a>on the left side of your screen and then add click on add P<a href="https://platform.openai.com/account/billing/payment-methods"><strong>ayment method</strong></a><strong>. </strong>Once you have entered your credit card or any other payment method, then you will have to enter the credit balance. For pricing of the fine tuning of different OpenAI models you can go to the pricing page by clicking on <a href="https://openai.com/pricing">Pricing </a>which is just below the payment methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H7O2RSuV0-koNsv_I_HxSg.png" /></figure><blockquote><strong><em>Installing required libraries:</em></strong></blockquote><p>First you need to install all these libraries in your Windows PowerShell.</p><ol><li>pip install openai</li><li>pip install requests</li><li>pip install tiktoken</li><li>pip install -U tokenizers</li></ol><blockquote><strong><em>Making connection with the OpenAI API using your API key:</em></strong></blockquote><p>Use the following code is used to make connection with the OpenAI and the output shows some data to check for its working.</p><pre>#Importing the OpenAi library<br>import openai<br>import requests<br><br>url = &quot;https://api.openai.com/v1/chat/completions&quot;<br><br>YOUR_OPENAI_API_KEY = &quot;YOUR_API_KEY_HERE&quot;  # Replace with your actual API key<br><br>headers = {<br>    &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    &quot;Authorization&quot;: f&quot;Bearer YOUR_API_KEY&quot;<br>}<br><br>data = {<br>    &quot;model&quot;: &quot;gpt-3.5-turbo&quot;,<br>    &quot;messages&quot;: [{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Say this is a test!&quot;}],<br>    &quot;temperature&quot;: 0.7<br>}<br><br>response = requests.post(url, headers=headers, json=data)<br><br>print(response.json())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*geXHNKecRQHVb_JY8HB7NA.png" /><figcaption>output</figcaption></figure><blockquote><strong><em>Checking the dataset:</em></strong></blockquote><p>The following code is to check and load your dataset. It will display the head of the dataset.</p><pre>import pandas as pd<br>import json<br><br># Load the JSON file into a variable<br>with open(&#39;PATH_OF_YOUR_DATASET&#39;, &#39;r&#39;) as file:<br>    dataset = json.load(file)<br><br># Convert the JSON data to a pandas DataFrame for easier manipulation (optional)<br>df = pd.DataFrame(dataset)<br><br># Display the first few rows of the DataFrame to check the data<br>df.head()</pre><p>Following are the analysis you need to know about your dataset before fine tuning it:</p><blockquote><strong><em>Checking the number of examples in the dataset:</em></strong></blockquote><p>To check the number of examples in your dataset and the first example of the dataset, use the following code:</p><pre>import json<br>from collections import defaultdict <br><br>print(&quot;Num examples:&quot;, len(dataset))<br>print(&quot;First example:&quot;)<br><br>first_example = dataset[0]<br>print(&quot;Prompt:&quot;, first_example[&quot;prompt&quot;])<br>print(&quot;Completion:&quot;, first_example[&quot;completion&quot;])</pre><blockquote><strong><em>Checking for Errors in the dataset:</em></strong></blockquote><p>Using this code you can check the dataset for errors before fine tuning it:</p><pre>from collections import defaultdict<br><br># Format error checks for the provided dataset structure<br>format_errors = defaultdict(int)<br><br>for ex in dataset:  # Adjusted to access the first element of dataset<br>    if not isinstance(ex, dict):<br>        format_errors[&quot;data_type&quot;] += 1<br>        continue<br>        <br>    # Check for existence of &quot;prompt&quot; and &quot;completion&quot; keys<br>    if &quot;prompt&quot; not in ex or &quot;completion&quot; not in ex:<br>        format_errors[&quot;missing_key&quot;] += 1<br>        continue<br>        <br>    # Check if &quot;prompt&quot; and &quot;completion&quot; are non-empty strings<br>    if not ex[&quot;prompt&quot;] or not isinstance(ex[&quot;prompt&quot;], str):<br>        format_errors[&quot;invalid_prompt&quot;] += 1<br>        <br>    if not ex[&quot;completion&quot;] or not isinstance(ex[&quot;completion&quot;], str):<br>        format_errors[&quot;invalid_completion&quot;] += 1<br><br># Displaying the format errors<br>if format_errors:<br>    print(&quot;Found errors:&quot;)<br>    for k, v in format_errors.items():<br>        print(f&quot;{k}: {v}&quot;)<br>else:<br>    print(&quot;No errors found&quot;)</pre><blockquote><strong><em>Distribution Calculations for every key:</em></strong></blockquote><p>The following code will calculate the distributions for every prompt and completion keys as :</p><pre>import tiktoken<br>import numpy as np<br><br># Load the encoding (adjust the model name if needed)<br>encoding = tiktoken.get_encoding(&quot;cl100k_base&quot;)<br><br>def num_tokens_from_prompt_and_completion(data_entry):<br>    num_tokens = 0<br>    # Counting tokens for the &quot;prompt&quot;<br>    num_tokens += len(encoding.encode(data_entry[&quot;prompt&quot;]))<br>    # Counting tokens for the &quot;completion&quot;<br>    num_tokens += len(encoding.encode(data_entry[&quot;completion&quot;]))<br>    return num_tokens<br><br>def num_completion_tokens_from_data_entry(data_entry):<br>    return len(encoding.encode(data_entry[&quot;completion&quot;]))<br><br># Use the dataset to compute token counts for each entry<br>prompt_and_completion_token_counts = [num_tokens_from_prompt_and_completion(entry) for entry in dataset]<br>completion_token_counts = [num_completion_tokens_from_data_entry(entry) for entry in dataset]<br><br># Print the distribution for the token counts<br>print_distribution(prompt_and_completion_token_counts, &quot;prompt and completion tokens&quot;)<br>print_distribution(completion_token_counts, &quot;completion tokens&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*0GsofA0wD-VHksXUVPISbQ.png" /><figcaption>output</figcaption></figure><blockquote><strong><em>Distributions for every prompts and completions:</em></strong></blockquote><p>The following code will count the number of tokens for every prompt and will give you the minimum and maximum number of tokens of prompts and completions and their combined number of tokens too along with their means and medians for distributions. As the limit for fine tuning a prompt completion pair is 4096 tokens so it will also tell you about the number of examples that are above that limit or else it will not fine tune any amount of tokens above that.</p><pre># Token counts<br>prompt_lens = []<br>completion_lens = []<br>total_lens = []<br><br>for ex in dataset:<br>    prompt_len = len(encoding.encode(ex[&quot;prompt&quot;]))<br>    completion_len = len(encoding.encode(ex[&quot;completion&quot;]))<br>    <br>    prompt_lens.append(prompt_len)<br>    completion_lens.append(completion_len)<br>    total_lens.append(prompt_len + completion_len)<br>    <br>print_distribution(prompt_lens, &quot;num_tokens_per_prompt&quot;)<br>print_distribution(completion_lens, &quot;num_tokens_per_completion&quot;)<br>print_distribution(total_lens, &quot;num_total_tokens_per_example&quot;)<br><br># Check for examples that may exceed the 4096 token limit<br>n_too_long = sum(l &gt; 4096 for l in total_lens)<br>print(f&quot;\n{n_too_long} examples may be over the 4096 token limit, they will be truncated during fine-tuning&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSM4EsSYsfv_sAIBhw3rOw.png" /><figcaption>output</figcaption></figure><blockquote><strong><em>Token Count and Pricing:</em></strong></blockquote><p>The following code will give you the total token count of your dataset and its pricing for fine tuning it as:</p><pre># Constants for Pricing and default n_epochs estimate<br>MAX_TOKENS_PER_EXAMPLE = 4096<br><br>TARGET_EPOCHS = 3<br>MIN_TARGET_EXAMPLES = 100<br>MAX_TARGET_EXAMPLES = 25000<br>MIN_DEFAULT_EPOCHS = 1<br>MAX_DEFAULT_EPOCHS = 25<br><br># Adjustments based on the constants<br>n_epochs = TARGET_EPOCHS<br>n_train_examples = len(dataset)<br>if n_train_examples * TARGET_EPOCHS &lt; MIN_TARGET_EXAMPLES:<br>    n_epochs = min(MAX_DEFAULT_EPOCHS, MIN_TARGET_EXAMPLES // n_train_examples)<br>elif n_train_examples * TARGET_EPOCHS &gt; MAX_TARGET_EXAMPLES:<br>    n_epochs = max(MIN_DEFAULT_EPOCHS, MAX_TARGET_EXAMPLES // n_train_examples)<br><br># Replacing convo_lens with total_lens for token counts<br>n_billing_tokens_in_dataset = sum(min(MAX_TOKENS_PER_EXAMPLE, length) for length in total_lens)<br>print(f&quot;Dataset has ~{n_billing_tokens_in_dataset} tokens that will be charged for during training&quot;)<br>print(f&quot;By default, you&#39;ll train for {n_epochs} epochs on this dataset&quot;)<br>print(f&quot;By default, you&#39;ll be charged for ~{n_epochs * n_billing_tokens_in_dataset} tokens&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*0k8k-yzO2rxN2eVx6n2zlA.png" /></figure><blockquote><strong><em>OpenAI dataset format for fine tuning:</em></strong></blockquote><p>Normally the format of the dataset is in JSON, for example:</p><pre>[ { &quot;prompt&quot;: &quot;What&#39;s the capital of France?&quot;},<br>{ &quot;completion&quot;: &quot;Paris, as if everyone doesn&#39;t know that already.&quot;} ]</pre><p>The format your dataset should be in is JSONL format. The following examples shows just that:</p><pre>{&quot;messages&quot;: [{&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: &quot;Marv is a factual chatbot that is also sarcastic.&quot;}, <br>{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;What&#39;s the capital of France?&quot;},<br>{&quot;role&quot;: &quot;assistant&quot;, &quot;content&quot;: &quot;Paris, as if everyone doesn&#39;t know that already.&quot;}]}</pre><p>Most datasets are in the JSON format so for to convert them into the JSONL format the following code converts JSON to JSONL:</p><pre># Convert JSON to JSONL<br>with open(&quot;dataset_for_finetuning.json&quot;, &quot;r&quot;) as json_file:<br> data = json.load(json_file)<br>jsonl_filename = &quot;dataset_for_finetuning.jsonl&quot;<br>with open(jsonl_filename, &quot;w&quot;) as jsonl_file:<br> for entry in data:<br> jsonl_file.write(json.dumps(entry) + &quot;\n&quot;)<br>jsonl_filename</pre><blockquote><strong><em>Creating a fine tuning job:</em></strong></blockquote><p>Using the following code you can fine tune your dataset:</p><pre>import os<br>import openai<br>import time<br><br># Set your OpenAI API key<br>openai.api_key = &quot;YOUR_API_KEY&quot;<br><br># Change the filename to match the name of your dataset file<br>file_name = &quot;dataset_for_finetuning.jsonl&quot;<br><br>file_upload = openai.File.create(file=open(file_name, &quot;rb&quot;), purpose=&quot;fine-tune&quot;)<br>print(&quot;Uploaded file id&quot;, file_upload.id)<br><br>while True:<br>    print(&quot;Waiting for file to process...&quot;)<br>    file_handle = openai.File.retrieve(id=file_upload.id)<br>    if len(file_handle) and file_handle.status == &quot;processed&quot;:<br>        print(&quot;File processed&quot;)<br>        break<br>    time.sleep(3)<br><br># Start the fine-tuning job<br>job = openai.FineTuningJob.create(training_file=file_upload.id, model=&quot;gpt-3.5-turbo&quot;)<br><br>while True:<br>    print(&quot;Waiting for fine-tuning to complete...&quot;)<br>    job_handle = openai.FineTuningJob.retrieve(id=job.id)<br>    if job_handle.status == &quot;succeeded&quot;:<br>        print(&quot;Fine-tuning complete&quot;)<br>        print(&quot;Fine-tuned model info&quot;, job_handle)<br>        print(&quot;Model id&quot;, job_handle.fine_tuned_model)<br>        break<br>    time.sleep(3)</pre><p>It will take some time to fine tune, depending on your device’s computing power. Output will be like this for some time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*qxJT7mFG7EhoNllFWRalqw.png" /><figcaption>output</figcaption></figure><p>Once the fine tuning is finished, it will give you the details about the fine tuned model in the output as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*xOXNqv5ftNSSCQaN5-3UEw.png" /></figure><p>To use your fine tuned model go to the <a href="https://platform.openai.com/playground">OpenAI playground</a> and then select your fine tuned model to use it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N0LiXrgRnGU32Sve2Bj2Rw.png" /></figure><p>Then you can enter your prompt in the user section and the model will respond to it according to your fine tuned model.</p><p><strong>For more information</strong> go to OpenAI documentation to learn more about it and the steps to fine tune your model.</p><ul><li><a href="https://platform.openai.com/docs/guides/fine-tuning">OpenAI Platform</a></li><li><a href="https://github.com/openai/openai-cookbook/blob/main/examples/Chat_finetuning_data_prep.ipynb">openai-cookbook/examples/Chat_finetuning_data_prep.ipynb at main · openai/openai-cookbook</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8253ed30fe09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My DevOps Journey]]></title>
            <link>https://medium.com/@alimusa2514/my-devops-journey-b39f2085a93e?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b39f2085a93e</guid>
            <category><![CDATA[learning-and-development]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Wed, 07 Jun 2023 15:23:18 GMT</pubDate>
            <atom:updated>2023-06-07T15:23:18.498Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Unleashing the Power of DevOps: A Journey of Continuous Transformation</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PhIuLnroiVST0Pfba1swZg.png" /></figure><h3>Introduction</h3><p>Gone are the days when development and operations teams operated in silos, often leading to miscommunication, delays, and bottlenecks. DevOps breaks down these barriers and fosters a culture of collaboration, where developers, system administrators, quality assurance engineers, and other stakeholders work together towards a common goal: delivering reliable software applications at a rapid pace.</p><p>At its core, DevOps is a mindset — a shift in thinking that promotes transparency, agility, and innovation. It encourages teams to automate repetitive tasks, streamline processes, and leverage cutting-edge tools and technologies. By integrating development and operations seamlessly, organizations can achieve faster deployments, shorter time to market, improved stability, and enhanced customer satisfaction.</p><p>In this blog, we will embark on an exciting journey through the world of DevOps. We will explore its key principles, methodologies, and best practices, shedding light on how they can transform the way software is developed, tested, deployed, and maintained. From continuous integration and continuous delivery (CI/CD) pipelines to infrastructure as code, containerization, and cloud-native architectures, we will dive into the foundational concepts that drive DevOps success.</p><h3>The Journey</h3><blockquote><strong>Everything I learned</strong></blockquote><ol><li><strong>GitHub — </strong>widely popular platform, plays a crucial role in the realm of DevOps. It serves as a central hub for version control, collaboration, and automation, enabling development and operations teams to work together seamlessly.</li><li><strong>Docker — </strong>has transformed the way applications are developed, tested, and deployed in the DevOps landscape. Its ability to simplify packaging, ensure consistency, and enable portability has made it an invaluable tool for organizations seeking to enhance their software delivery processes. By embracing Docker, businesses can achieve faster deployments, improved scalability, and increased efficiency, ultimately driving innovation and success in the modern era of software development.</li><li><strong>Podman — </strong>provides a lightweight and secure alternative to Docker, allowing developers and operations teams to manage containers efficiently. With its focus on compatibility, ease of use, and robust security features, Podman offers a flexible solution for containerization in the DevOps ecosystem. It enables seamless container management, improved resource utilization, and enhanced isolation, making it a valuable tool for organizations seeking reliable and scalable container deployments.</li><li><strong>Kyverno — </strong>is a powerful policy management tool for Kubernetes that simplifies and automates policy enforcement. With its declarative approach and intuitive policies, Kyverno enables organizations to maintain security, compliance, and best practices in their Kubernetes clusters. It provides an efficient solution for validating and mutating resources, ensuring consistency and adherence to policies across the entire application lifecycle. By integrating Kyverno into their DevOps workflows, organizations can enhance cluster governance, reduce human error, and achieve a higher level of control and reliability in their Kubernetes deployments.</li><li><strong>Kubernetes — </strong>has emerged as the de facto standard for container orchestration, revolutionizing the management and scalability of containerized applications. With its robust features and ecosystem, Kubernetes provides organizations with a powerful platform for automating deployment, scaling, and management of applications in distributed environments. It simplifies the complexity of container orchestration, enhances resource utilization, and ensures high availability and resilience. By embracing Kubernetes, organizations can unlock the full potential of containerization, accelerate software delivery, and drive innovation in the world of DevOps.</li><li><strong>Service Mesh —</strong> a service mesh is a critical component in modern application architectures, providing a dedicated infrastructure layer for managing and securing microservices communication. With its advanced features like traffic management, observability, and security, a service mesh simplifies the complexity of microservices-based systems. It enables organizations to achieve better control, visibility, and reliability in their distributed applications. By adopting a service mesh, organizations can enhance their DevOps practices, improve scalability, and ensure seamless communication between microservices, ultimately leading to efficient and resilient application deployments.</li></ol><blockquote><strong>Everything I experienced</strong></blockquote><ol><li><strong>Cloud Native Community — </strong>has become a driving force behind the adoption and advancement of modern software development practices. With its focus on scalability, resilience, and agility, the community has fostered the development of innovative technologies like containers, microservices, orchestration platforms, and more. The Cloud Native community promotes collaboration, knowledge sharing, and standardization, allowing organizations to leverage the full potential of cloud-native architectures. By embracing the principles and technologies advocated by the Cloud Native community, organizations can accelerate their digital transformation, optimize resource utilization, and build scalable and resilient applications in today’s dynamic and fast-paced digital landscape.</li><li><strong>Kubernetes Community Days Pakistan — </strong>the highly anticipated Kubernetes Community Day hosted by our instructor, Mr. Saim Safdar, at FAST NUCES, Islamabad, was a highlight of the course. The event featured a wide variety of workshops, with eigtheen sessions covering various areas of Kubernetes. The addition of prominent international speakers, who contributed their essential experience and anecdotes, made this day truly exceptional. The event not only provided unmatched learning opportunities, but it also help built vital contacts among industry peers.</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FFoHlScDO6x8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DFoHlScDO6x8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FFoHlScDO6x8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/431c39130dc8468d972cbae343007a23/href">https://medium.com/media/431c39130dc8468d972cbae343007a23/href</a></iframe><p>And the playlist goes on….</p><p>3.<strong> Fundamentals for Istio by Solo.io — </strong>Istio is the most popular service mesh deployed into production across the cloud-native ecosystem. It provides the foundational pieces to implement zero-trust networking, get deeper observability into a distributed system, and smart routing control for safer software releases. This credential, by Solo.io, certifies that recipients possess the foundational skills needed to get started with Istio: installing, securing and adding services. It is a predecessor to the Essentials badge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*14wxguqgrqIqyiLwtBgurw.png" /></figure><h3><strong>Conclusion</strong></h3><p>The journey into DevOps has uncovered a wealth of concepts and practices, such as continuous integration and continuous delivery (CI/CD), infrastructure as code, containerization, and cloud-native architectures. These concepts provide the foundation for organizations to create robust software pipelines, increase efficiency, and adapt to the ever-changing demands of the digital landscape. It is important to remember that DevOps is not just about technology; it is a mindset shift that requires open communication, collaboration, and a willingness to embrace change. Organizations that successfully embrace DevOps principles and cultivate a DevOps culture will reap the benefits of increased productivity, improved software quality, and faster time to market.</p><p>Thank you for joining me on this DevOps adventure. Together, let us continue to unleash the full potential of DevOps and revolutionize the way we build and deliver software solutions in the digital era.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b39f2085a93e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes Usage Cost Management]]></title>
            <link>https://medium.com/@alimusa2514/kubernetes-usage-cost-management-16522d514bd2?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/16522d514bd2</guid>
            <category><![CDATA[cost-management]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Sat, 13 May 2023 14:44:06 GMT</pubDate>
            <atom:updated>2023-05-13T14:44:06.415Z</atom:updated>
            <content:encoded><![CDATA[<p>How much does the Kubernetes cost to run?</p><p>Kubernetes is an open-source container orchestration system that automates the deployment, scaling, and management of containerized applications. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF). Kubernetes as a platform allows teams to scale up applications at a rapid pace but this may come at a significant cost if done inefficiently.</p><p>Cost management for Kubernetes is an important aspect of running containerized workloads in the cloud. Kubernetes is a powerful tool for managing containers and applications, but it can also be expensive to run if not managed properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*bk0yiXJNv96BojXAUuI7zQ.png" /></figure><p>Here are some tips for cost management in Kubernetes:</p><p><strong>Right-size your Kubernetes cluster:</strong> Make sure your Kubernetes cluster is the right size for your workload. You don’t want to pay for resources that you’re not using, but you also don’t want to run out of resources during peak usage. Use tools like Kubernetes Horizontal Pod Auto-scaler (HPA) to automatically scale your resources up or down based on demand.</p><p><strong>Use resource limits:</strong> Set resource limits for your containers so they don’t use more resources than necessary. This can help prevent resource contention and ensure that your cluster runs smoothly. Kubernetes has built-in mechanisms to enforce these limits, so it’s easy to set up.</p><p><strong>Optimize container images:</strong> Make sure your container images are optimized for size and performance. This can help reduce the amounts of resources your containers consume and save you money in the long run. Use tools like Docker Slim or Google’s Container-Structure-Test to optimize your container images.</p><p><strong>Use Kubernetes native services:</strong> Kubernetes offers many native services like load balancers, DNS, and storage. Using these services can save you money compared to using external services. For example, using a Kubernetes Load Balancer service is cheaper than using a cloud provider’s load balancer service.</p><p><strong>Monitor and analyze usage:</strong> Monitor your Kubernetes cluster usage and analyze the data to identify areas where you can save money. Use tools like Prometheus and Grafana to monitor your cluster and visualize the data. Look for patterns in usage and adjust your resources accordingly.</p><p>By following these tips, you can effectively manage costs in your Kubernetes cluster and ensure that you’re only paying for the resources you need.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16522d514bd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kyverno — The emerging default policy tool]]></title>
            <link>https://medium.com/@alimusa2514/kyverno-the-emerging-default-policy-tool-786aec5e6beb?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/786aec5e6beb</guid>
            <category><![CDATA[kyverno]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Fri, 31 Mar 2023 07:00:07 GMT</pubDate>
            <atom:updated>2023-03-31T07:16:02.849Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Kyverno — The emerging default policy tool</strong></h3><p>Kyverno is an emerging and open-source Kubernetes-native policy engine designed to help Kubernetes users define and enforce policies on their cluster. It allows users to define policies in a declarative way using Kubernetes resources, such as ConfigMaps and Custom Resource Definitions (CRDs), and applies them dynamically to the cluster’s objects, such as pods and deployments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*CGnedHh-c0qAvug3PcKnjQ.png" /></figure><p>Kyverno’s policies are defined using Kubernetes-native YAML files, which makes them easy to understand and integrate with existing Kubernetes infrastructure. Policies can be created for a wide range of use cases, including security, compliance, resource management, and application deployment.</p><h3><strong>Features:</strong></h3><ol><li><strong>Policy as code:</strong> Kyverno allows you to define policies in the form of YAML files, which can be version-controlled and audited like any other code.</li><li><strong>Context-aware policy enforcement:</strong> Kyverno policies are enforced in real-time, and are context-aware, meaning they can evaluate the state of the Kubernetes objects they’re applied to, and make decisions based on that information.</li><li><strong>Mutating and validating webhooks:</strong> Kyverno can act as a Kubernetes admission controller, providing both validating and mutating webhooks. This allows it to dynamically modify resources as they’re being created or updated, ensuring they comply with policy.</li><li><strong>Flexible policy management:</strong> Kyverno provides a flexible policy management system that allows you to apply policies to different namespaces, labels, and resources. This makes it easy to manage policies across a large, complex Kubernetes deployment.</li><li><strong>Easy integration with CI/CD pipelines:</strong> Kyverno can integrate with CI/CD pipelines to ensure that policies are enforced as part of your application deployment process. This helps to catch policy violations early in the development cycle, before they become bigger issues.</li></ol><h3><strong>Policies:</strong></h3><p>Kyverno also includes a powerful policy library that covers a wide range of use cases, as follows:</p><ul><li>Policies as Kubernetes resources (no new language to learn!)</li><li>validate, mutate, generate, or cleanup (remove) any resource</li><li>verify container images for software supply chain security</li><li>inspect image metadata</li><li>match resources using label selectors and wildcards</li><li>validate and mutate using overlays (like Kustomize!)</li><li>synchronize configurations across Namespaces</li><li>block non-conformant resources using admission controls, or report policy violations</li><li>self-service reports (no proprietary audit log!)</li><li>self-service policy exceptions</li><li>test policies and validate resources using the Kyverno CLI, in your CI/CD pipeline, before applying to your cluster</li><li>manage policies as code using familiar tools like git and kustomize</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qN35Cy9IgLdoQsS9B1d3KQ.png" /></figure><p>Kyverno allows cluster administrators to manage environment specific configurations independently of workload configurations and enforce configuration best practices for their clusters. Kyverno can be used to scan existing workloads for best practices, or can be used to enforce best practices by blocking or mutating API requests.</p><h3><strong>Conclusion:</strong></h3><p>Kyverno is a powerful tool for managing Kubernetes resources that can help organizations improve security, compliance, and efficiency in their Kubernetes environments that is why it is being adopted by many companies worldwide and the count is still on. So, in short It is here to stay.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=786aec5e6beb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Operating High Traffic Websites on Kubernetes]]></title>
            <link>https://medium.com/@alimusa2514/operating-high-traffic-websites-on-kubernetes-571c09e6629c?source=rss-7c2405dcbf9b------2</link>
            <guid isPermaLink="false">https://medium.com/p/571c09e6629c</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[kubernetes-cluster]]></category>
            <category><![CDATA[kubectl]]></category>
            <category><![CDATA[load-balancer]]></category>
            <category><![CDATA[prometheus]]></category>
            <dc:creator><![CDATA[Syed Muhammad Ali Musa Raza]]></dc:creator>
            <pubDate>Wed, 22 Feb 2023 07:30:24 GMT</pubDate>
            <atom:updated>2023-02-22T07:43:38.167Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>How to scale automatically our resources in Kubernetes when we have high traffic on websites</strong></h4><p><strong>How do we distribute the traffic based on the requests coming in?</strong></p><p>In order to distribute the traffic between pods, we need to use a load balancer for the frontend and the backend know as <strong>front-end service</strong> and <strong>backend service</strong> respectively. The load balancer sends the traffic to the pods using their IP addresses. On top of that to distribute the traffic between both the services using an external load balancer which is a deployment and a service know as <strong>Ingress.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*r8YVmdaBTlYbZaaw8F4vhg.png" /></figure><p><strong>Load Balancer</strong></p><p>A Load balancer is automatically provisioned. It works only if there is a cloud provider and it is for the Layer4 services only as it supports TCP and UDP. It does not work with HTTP requests. You can forward the requests based on the paths while keeping a low latency. You can apply policies such as authentication and great limiting.</p><p><strong>How do we communicate with the cluster? How do we create these resources?</strong></p><p>Ingress itself is a programmable route. In-order to communicate and create multiple Ingress controllers you have to use a tool <strong>kubectl </strong>which is a command line tool. To create the resources such as replicas of the Ingress a configuration file has to be written.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*1PaPv0pwa1yhobxuj3vPRw.png" /></figure><p><strong>What if there were tons of traffic?</strong></p><p>For this scenario you will need to create multiple replicas of the Ingress to balance the traffic. You will have to set the number of replicas manually depending on the traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*AfpEcuGAkEG-1cTFn2JVsg.png" /></figure><p><strong>How do you set the number of replicas automatically depending upon the traffic?</strong></p><p>To set the number of Ingress controllers automatically, you will have to use a resource in Kubernetes called Horizontal Pod Autoscaler. You will query the scale-up or scale-down the metrics accordingly. The Autoscaler will increase the number of replicas whenever an instance is added or it reduces the number of requests. You will need to use an open-source project called Prometheus which is a great monitoring system to collect the metrics from pods and then stores them. In-order to automatically scale things based on requests coming in you will need to use another open-source project called KEDA (Kubernetes Event Driven Autoscaling). It allows to us to drive the auto-scaling of the Kubernetes workload based on the number of events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*akF6uEbA5gS5JftZ5XDsmw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=571c09e6629c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>