<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tutorials &#8211; NoloWiz</title>
	<atom:link href="https://nolowiz.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>https://nolowiz.com</link>
	<description>Technology news, tips and tutorials</description>
	<lastBuildDate>Sat, 30 May 2026 04:38:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.13</generator>

<image>
	<url>https://nolowiz.com/wp-content/uploads/2021/01/cropped-android-chrome-512x512-2-32x32.png</url>
	<title>Tutorials &#8211; NoloWiz</title>
	<link>https://nolowiz.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Mastering Git Worktree: How to Work on Multiple Branches at Once</title>
		<link>https://nolowiz.com/mastering-git-worktree-how-to-work-on-multiple-branches-at-once/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Thu, 28 May 2026 13:03:53 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=7095</guid>

					<description><![CDATA[<p>If you&#8217;ve ever been in the middle of a feature branch and suddenly a critical bug pops up on main, you know the drill: Stash your changes. Checkout main. Fix the bug. Commit. Checkout back to your feature branch. Stash pop. Sound tedious? You&#8217;re not alone. But there&#8217;s a better way. Today, I&#8217;m going to ... <a title="Mastering Git Worktree: How to Work on Multiple Branches at Once" class="read-more" href="https://nolowiz.com/mastering-git-worktree-how-to-work-on-multiple-branches-at-once/" aria-label="More on Mastering Git Worktree: How to Work on Multiple Branches at Once">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/mastering-git-worktree-how-to-work-on-multiple-branches-at-once/">Mastering Git Worktree: How to Work on Multiple Branches at Once</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>If you&#8217;ve ever been in the middle of a feature branch and suddenly a critical bug pops up on main, you know the drill:</p>



<ol><li>Stash your changes.</li><li>Checkout main.</li><li>Fix the bug.</li><li>Commit.</li><li>Checkout back to your feature branch.</li><li>Stash pop. Sound tedious? You&#8217;re not alone.</li></ol>



<p>But there&#8217;s a better way. Today, I&#8217;m going to introduce you to one of Git&#8217;s most underrated features: git worktree!</p>



<h2>What Is Git Worktree?</h2>



<p>In simple terms, git worktree lets you work on multiple branches of the same repository simultaneously, each in its own directory.</p>



<p>Normally, Git only lets you be on one branch at a time. To switch branches, you either commit, stash, or discard your current work. With worktrees, you get separate working directories that all share the<br>same <code>.git</code> folder  meaning you can be on feature-x in one window and main in another, without any stashing or switching.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>The Problem It Solves</h2>



<p>Imagine you are working on a feature branch (<code>feature-x</code>) and a critical bug appears on the <code>main</code> branch.</p>



<ul><li><strong>Without worktree:</strong> You <code>stash</code> your changes, <code>checkout</code> main, fix the bug, <code>commit</code>, and then <code>stash</code> pop back to your feature.</li><li><strong>With worktree:</strong> You simply open a second terminal or directory for <code>main</code>, fix the bug, and leave your feature branch untouched in the first directory.</li></ul>



<p>That&#8217;s it. No stashing. No context switching. No lost mental momentum.</p>



<h2>How to Use It</h2>



<h3>1. Create a new worktree</h3>



<p>Run the following command :</p>



<pre class="wp-block-code"><code>git worktree add -b fix-bug ../fix-bug main</code></pre>



<p>This creates a new folder (<code>../fix-bug</code>), creates a new branch named <code>fix-bug</code> based on <code>main</code>, and checks it out for you automatically.</p>



<h3>2. List All Worktrees</h3>



<p>Run the below command to list all worktrees :</p>



<pre class="wp-block-code"><code>git worktree list</code></pre>



<p><strong>Output</strong> :</p>



<pre class="wp-block-code"><code>/path/to/repo       (master)
/path/to/fix-bug    (fix-bug)</code></pre>



<h3>3. Work on the new branch</h3>



<p>Navigate into your new directory (<code>cd ../fix-bug</code>). Here, you can make commits, run tests, or mess with dependencies completely independently from your original repository. Your main repo&#8217;s working directory remains completely untouched.</p>



<h3>4. Remove a Worktree</h3>



<p>When you are finished with your changes and have pushed or merged your work, you can clean up:</p>



<pre class="wp-block-code"><code>git worktree remove ../fix-bug</code></pre>



<p><strong>Note</strong>: This safely deletes the <code>../fix-bug</code> directory. It does <strong>not</strong> delete the branch itself from Git history. If you want to completely delete the branch too, you can now safely run <code>git branch -d fix-bug</code> from your main repository directory.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Common Use Cases</h2>



<ul><li><strong>Fixing urgent bugs</strong> &#8211; Work on main for a hotfix while keeping your feature branch clean in the main terminal.</li><li><strong>Testing</strong> &#8211; Test a specific branch without having to switch your current working state.</li><li><strong>Code reviews</strong> &#8211; Pull down a colleague&#8217;s PR in a separate folder without merging it into your local repo.</li><li><strong>Documentation</strong> &#8211; Work on both code and docs in parallel without switching branches.</li><li><strong>AI Agents &amp; Copilots</strong> &#8211;  In 2026, we see a massive spike in worktree usage driven by coding AI agents (like <a href="https://code.claude.com/docs/en/worktrees" target="_blank" rel="noreferrer noopener">Claude Code</a>, GitHub Copilot Workspace, or OpenAI Codex). These tools often spin up isolated background git worktrees to write features, run automated tests, and fix bugs without disrupting the developer’s active screen.</li></ul>



<h2>Git Worktree Anti-Patterns to avoid</h2>



<h3>1. Checking Out the Same Branch Twice</h3>



<pre class="wp-block-code"><code>git worktree add ../fix main   # fails if already on main</code></pre>



<p><strong>Why:</strong> Git hard-blocks this. Each worktree must be on a unique branch.</p>



<h3>2. Rebasing/Amending a Branch Another Worktree Is Using</h3>



<pre class="wp-block-code"><code># Worktree A is on feature-x
# In main worktree — DON'T do this:
git rebase -i HEAD~3 feature-x   # corrupts worktree A's HEAD</code></pre>



<p><strong>Why:</strong> History rewrite orphans the other worktree&#8217;s commits.</p>



<h3>3. Putting Worktrees Inside the Repo Folder</h3>



<pre class="wp-block-code"><code>git worktree add ./fix-bug -b fix-bug main   # inside repo</code></pre>



<p><strong>Why:</strong> Causes <code>.gitignore</code> headaches, accidental commits of worktree folders, and confusing <code>git status</code> output. Always place worktrees <strong>outside</strong> or as siblings:</p>



<pre class="wp-block-code"><code>git worktree add ../fix-bug -b fix-bug main  # Correct - sibling folder</code></pre>



<h3>4. Forgetting to Remove Stale Worktrees</h3>



<pre class="wp-block-code"><code># Manually deleted the folder but never ran:
git worktree remove fix-bug</code></pre>



<p><strong>Why:</strong> Git still tracks it internally. Builds up ghost entries. Always clean up:</p>



<pre class="wp-block-code"><code>git worktree prune    # removes stale entries
git worktree list     # verify</code></pre>



<h3>5. Running Git Commands That Affect Shared State From Wrong Worktree</h3>



<pre class="wp-block-code"><code># From fix-bug worktree — dangerous:
git branch -D feature-x     # deletes branch another worktree is on
git tag -f v1.0              # moves a tag others depend on
git gc --aggressive          # can corrupt shared object store mid-work</code></pre>



<p><strong>Why:</strong> All worktrees share the same <code>.git</code> &#8211; destructive commands affect everyone.</p>



<h3>6. Using Worktrees With Submodules Carelessly</h3>



<pre class="wp-block-code"><code>git worktree add ../feature -b feature main
# Submodules are NOT automatically initialized in new worktree</code></pre>



<p><strong>Why:</strong> Submodule state is not automatically carried over. You must manually run:</p>



<pre class="wp-block-code"><code>cd ../feature
git submodule update --init</code></pre>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Final Thoughts</h2>



<p>The git worktree is one of those features that, once you start using it, you wonder how you ever lived without it. It&#8217;s lightweight, it&#8217;s built into Git (no plugins needed), and it saves you from the stashing dance every time.</p>



<p></p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fmastering-git-worktree-how-to-work-on-multiple-branches-at-once%2F&amp;linkname=Mastering%20Git%20Worktree%3A%20How%20to%20Work%20on%20Multiple%20Branches%20at%20Once" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fmastering-git-worktree-how-to-work-on-multiple-branches-at-once%2F&amp;linkname=Mastering%20Git%20Worktree%3A%20How%20to%20Work%20on%20Multiple%20Branches%20at%20Once" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fmastering-git-worktree-how-to-work-on-multiple-branches-at-once%2F&amp;linkname=Mastering%20Git%20Worktree%3A%20How%20to%20Work%20on%20Multiple%20Branches%20at%20Once" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fmastering-git-worktree-how-to-work-on-multiple-branches-at-once%2F&amp;linkname=Mastering%20Git%20Worktree%3A%20How%20to%20Work%20on%20Multiple%20Branches%20at%20Once" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fmastering-git-worktree-how-to-work-on-multiple-branches-at-once%2F&#038;title=Mastering%20Git%20Worktree%3A%20How%20to%20Work%20on%20Multiple%20Branches%20at%20Once" data-a2a-url="https://nolowiz.com/mastering-git-worktree-how-to-work-on-multiple-branches-at-once/" data-a2a-title="Mastering Git Worktree: How to Work on Multiple Branches at Once"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/mastering-git-worktree-how-to-work-on-multiple-branches-at-once/">Mastering Git Worktree: How to Work on Multiple Branches at Once</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to use SearXNG as a Private Search API &#8211; Step-by-Step Guide</title>
		<link>https://nolowiz.com/how-to-use-searxng-as-a-private-search-api-step-by-step-guide/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Fri, 06 Feb 2026 12:32:49 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6906</guid>

					<description><![CDATA[<p>In this step by step guide we will discuss how to install and run SearXNG as private search API, which can be used by apps. What is SearXNG? SearXNG is a free, open-source, self-hosted metasearch engine that aggregates results from multiple search engines without tracking users. It solves the problems of privacy invasion, vendor lock-in, ... <a title="How to use SearXNG as a Private Search API &#8211; Step-by-Step Guide" class="read-more" href="https://nolowiz.com/how-to-use-searxng-as-a-private-search-api-step-by-step-guide/" aria-label="More on How to use SearXNG as a Private Search API &#8211; Step-by-Step Guide">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-use-searxng-as-a-private-search-api-step-by-step-guide/">How to use SearXNG as a Private Search API &#8211; Step-by-Step Guide</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this step by step guide we will discuss how to install and run SearXNG as private search API, which can be used by apps.</p>



<h2>What is SearXNG?</h2>



<p>SearXNG is a free, open-source, self-hosted metasearch engine that aggregates results from multiple search engines without tracking users. It solves the problems of privacy invasion, vendor lock-in, API costs, and search bias by giving developers full control over search data, sources, and usage.</p>



<p>Here are the<strong> </strong>key benefits of SearXNG:</p>



<ul><li><strong>Privacy-first</strong>: No user tracking, logging, or profiling.</li><li><strong>Self-hosted control</strong>: You own the data, configuration, and infrastructure.</li><li><strong>Multiple search engines</strong>: Aggregates results from many sources(Google,Bing,DuckDuckGo etc) in one query.</li><li><strong>Free &amp; open source</strong>: No API costs, no vendor lock-in.</li><li><strong>API-friendly</strong>: JSON output works well for apps and LLM pipelines.</li><li><strong>Customizable</strong>: Enable/disable engines, formats, languages, and filters.</li><li><strong>Lightweight &amp; fast</strong>: Runs efficiently with minimal resources.</li><li><strong>LLM-ready</strong>: Ideal for RAG, research agents, and private AI workflows.</li><li></li></ul>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Step 1: Install Docker and Docker Compose</h2>



<p>First we need to install SerXNG, we will use docker based installation and use.</p>



<ul><li>For Windows users, Download docker desktop  from docker&#8217;s <a href="https://www.docker.com/products/docker-desktop/" target="_blank" rel="noreferrer noopener">official site </a></li><li>Linux users should install docker and docker compose by following the <a href="https://docs.docker.com/desktop/setup/install/linux/" target="_blank" rel="noreferrer noopener">guide</a></li></ul>



<h2> Step 2: Install SearXNG</h2>



<p>Make a directory named &#8220;searxng&#8221;, and create file named <code>docker-compose.yml</code> inside this newly directory. Copy paste the below code.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
version: &quot;3.7&quot;

services:
  searxng:
    image: searxng/searxng:latest
    container_name: searxng
    ports:
      - &quot;8080:8080&quot;
    volumes:
      - ./searxng:/etc/searxng
    environment:
      - SEARXNG_BASE_URL=http://localhost:8080/
    restart: unless-stopped

</pre></div>


<p>Next run the below command :</p>



<pre class="wp-block-code"><code>docker-compose up</code></pre>



<p>Wait for the installation to finish, and check the browser by operning the URL http://localhost:8080/.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="813" height="538" src="https://nolowiz.com/wp-content/uploads/2026/02/searxng-first-run.png" alt="SearXNG running " class="wp-image-6917" srcset="https://nolowiz.com/wp-content/uploads/2026/02/searxng-first-run.png 813w, https://nolowiz.com/wp-content/uploads/2026/02/searxng-first-run-300x199.png 300w, https://nolowiz.com/wp-content/uploads/2026/02/searxng-first-run-768x508.png 768w, https://nolowiz.com/wp-content/uploads/2026/02/searxng-first-run-150x99.png 150w" sizes="(max-width: 813px) 100vw, 813px" /></figure>



<h2>Step 3: Enable API in SearXNG</h2>



<p>To enable and use the API, first install and configure SearXNG, then add JSON support in settings. We need edit the <code>searxng\searxng\settings.yaml</code> file add the json format in the formats settings as shown below :</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; title: ; notranslate">
search:
  formats:
    - html
    - json  # Add this for API
server:
  secret_key: &quot;your-random-secret-key&quot; 

</pre></div>


<p>Save the settings file and restart the SearXNG container.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<pre class="wp-block-code"><code>docker-compose restart</code></pre>



<p>Now we can make API requests to SearXNG enpoints, for more details about API please refer <a href="https://docs.searxng.org/dev/search_api.html" target="_blank" rel="noreferrer noopener">here </a>.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="960" height="589" src="https://nolowiz.com/wp-content/uploads/2026/02/Searxng-API-call.png" alt="SearXNG API test" class="wp-image-6929" srcset="https://nolowiz.com/wp-content/uploads/2026/02/Searxng-API-call.png 960w, https://nolowiz.com/wp-content/uploads/2026/02/Searxng-API-call-300x184.png 300w, https://nolowiz.com/wp-content/uploads/2026/02/Searxng-API-call-768x471.png 768w, https://nolowiz.com/wp-content/uploads/2026/02/Searxng-API-call-150x92.png 150w" sizes="(max-width: 960px) 100vw, 960px" /></figure>



<h2>Conclusion</h2>



<p>It is easier to setup SearXNGand expose its API endpoints, thanks to docker. <a href="https://nolowiz.com/ollama-api-run-large-language-models-locally-with-simple-apis/" target="_blank" rel="noreferrer noopener">Run Large Language Models Locally with Simple APIs</a></p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-searxng-as-a-private-search-api-step-by-step-guide%2F&amp;linkname=How%20to%20use%20SearXNG%20as%20a%20Private%20Search%20API%20%E2%80%93%20Step-by-Step%20Guide" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-searxng-as-a-private-search-api-step-by-step-guide%2F&amp;linkname=How%20to%20use%20SearXNG%20as%20a%20Private%20Search%20API%20%E2%80%93%20Step-by-Step%20Guide" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-searxng-as-a-private-search-api-step-by-step-guide%2F&amp;linkname=How%20to%20use%20SearXNG%20as%20a%20Private%20Search%20API%20%E2%80%93%20Step-by-Step%20Guide" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-searxng-as-a-private-search-api-step-by-step-guide%2F&amp;linkname=How%20to%20use%20SearXNG%20as%20a%20Private%20Search%20API%20%E2%80%93%20Step-by-Step%20Guide" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-searxng-as-a-private-search-api-step-by-step-guide%2F&#038;title=How%20to%20use%20SearXNG%20as%20a%20Private%20Search%20API%20%E2%80%93%20Step-by-Step%20Guide" data-a2a-url="https://nolowiz.com/how-to-use-searxng-as-a-private-search-api-step-by-step-guide/" data-a2a-title="How to use SearXNG as a Private Search API – Step-by-Step Guide"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-use-searxng-as-a-private-search-api-step-by-step-guide/">How to use SearXNG as a Private Search API &#8211; Step-by-Step Guide</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Install CUDA Driver on Ubuntu 24.04 LTS or Higher &#8211; A step-by-step guide</title>
		<link>https://nolowiz.com/how-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Sat, 29 Nov 2025 05:01:59 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6735</guid>

					<description><![CDATA[<p>In this tutorial, we will discuss step by step guide to install CUDA driver on Ubuntu 24.04 LTS or higher. We tested this using NVIDIA RTX 3060 12GB GPU on Ubuntu 24.04 LTS. First update the system by running the below commands : We need to disable Nouveau driver,Nouveau is an accelerated open-source graphics driver ... <a title="How to Install CUDA Driver on Ubuntu 24.04 LTS or Higher &#8211; A step-by-step guide" class="read-more" href="https://nolowiz.com/how-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide/" aria-label="More on How to Install CUDA Driver on Ubuntu 24.04 LTS or Higher &#8211; A step-by-step guide">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide/">How to Install CUDA Driver on Ubuntu 24.04 LTS or Higher &#8211; A step-by-step guide</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this tutorial, we will discuss step by step guide to install CUDA driver on Ubuntu 24.04 LTS or higher. We tested this using <a href="https://www.nvidia.com/en-in/geforce/rtx/" target="_blank" rel="noreferrer noopener">NVIDIA RTX </a>3060 12GB GPU on Ubuntu 24.04 LTS.</p>



<p>First update the system by running the below commands :</p>



<pre class="wp-block-code"><code>sudo apt update
sudo apt upgrade</code></pre>



<p></p>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354" crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2735334721002354" data-ad-slot="8835878737" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p>We need to disable Nouveau driver,Nouveau is an accelerated open-source graphics driver for NVIDIA GPUs, developed independently by the free software community to provide libre support without relying on NVIDIA&#8217;s proprietary drivers. Disable Nouveau driver by creating a blacklist file:</p>



<pre class="wp-block-code"><code>sudo bash -c "echo -e 'blacklist nouveau\noptions nouveau modeset=0' &gt; /etc/modprobe.d/blacklist-nvidia-nouveau.conf"
sudo update-initramfs -u</code></pre>



<p>Next, reboot the system eithe reboot manually or run the below command :</p>



<pre class="wp-block-code"><code>sudo reboot</code></pre>



<p>Install the prerequisites by running the command :</p>



<pre class="wp-block-code"><code>sudo apt install build-essential libglvnd-dev pkg-config</code></pre>



<p>Add the graphics drivers PPA to get the latest official NVIDIA drivers:</p>



<pre class="wp-block-code"><code>sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update</code></pre>



<p>Check available NVIDIA drivers and install the recommended one:</p>



<pre class="wp-block-code"><code>ubuntu-drivers devices</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="685" height="481" src="https://nolowiz.com/wp-content/uploads/2025/11/image-12.png" alt="" class="wp-image-6738" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-12.png 685w, https://nolowiz.com/wp-content/uploads/2025/11/image-12-300x211.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-12-150x105.png 150w" sizes="(max-width: 685px) 100vw, 685px" /></figure>



<p>Install latest/recommended driver version, I&#8217;m using NVIDIA RTX 3060 graphics card so using the driver nvidia-driver-570  :</p>



<pre class="wp-block-code"><code>sudo apt install nvidia-driver-570</code></pre>



<p></p>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354" crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2735334721002354" data-ad-slot="8835878737" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<p>Alternatively, to auto install the CUDA driver run the below command.</p>



<pre class="wp-block-code"><code>sudo ubuntu-drivers autoinstall</code></pre>



<p>Verify the installation by running the below command :</p>



<pre class="wp-block-code"><code>nvidia-smi</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="933" height="471" src="https://nolowiz.com/wp-content/uploads/2025/11/image-13.png" alt="NVIDIA driver verification" class="wp-image-6758" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-13.png 933w, https://nolowiz.com/wp-content/uploads/2025/11/image-13-300x151.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-13-768x388.png 768w, https://nolowiz.com/wp-content/uploads/2025/11/image-13-150x76.png 150w" sizes="(max-width: 933px) 100vw, 933px" /></figure>



<h2>Conclusion</h2>



<p>By following these simple steps it is easy to install CUDA driver on Ubuntu. Read about <a href="https://nolowiz.com/tp-link-ac1300-archer-t3u-ubuntu-driver-installation-a-step-by-step-guide/" target="_blank" rel="noreferrer noopener">TP-LINK AC1300 Archer T3U Ubuntu Driver Installation&nbsp;</a>.</p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide%2F&amp;linkname=How%20to%20Install%20CUDA%20Driver%20on%20Ubuntu%2024.04%20LTS%20or%20Higher%20%E2%80%93%20A%20step-by-step%20guide" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide%2F&amp;linkname=How%20to%20Install%20CUDA%20Driver%20on%20Ubuntu%2024.04%20LTS%20or%20Higher%20%E2%80%93%20A%20step-by-step%20guide" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide%2F&amp;linkname=How%20to%20Install%20CUDA%20Driver%20on%20Ubuntu%2024.04%20LTS%20or%20Higher%20%E2%80%93%20A%20step-by-step%20guide" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide%2F&amp;linkname=How%20to%20Install%20CUDA%20Driver%20on%20Ubuntu%2024.04%20LTS%20or%20Higher%20%E2%80%93%20A%20step-by-step%20guide" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fhow-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide%2F&#038;title=How%20to%20Install%20CUDA%20Driver%20on%20Ubuntu%2024.04%20LTS%20or%20Higher%20%E2%80%93%20A%20step-by-step%20guide" data-a2a-url="https://nolowiz.com/how-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide/" data-a2a-title="How to Install CUDA Driver on Ubuntu 24.04 LTS or Higher – A step-by-step guide"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-install-cuda-driver-on-ubuntu-24-04-lts-or-higher-a-step-by-step-guide/">How to Install CUDA Driver on Ubuntu 24.04 LTS or Higher &#8211; A step-by-step guide</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Regression Bug? Learn Git Bisect to Find the Problem Commit</title>
		<link>https://nolowiz.com/regression-bug-learn-git-bisect-to-find-the-problem-commit/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Sat, 22 Nov 2025 12:22:15 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6669</guid>

					<description><![CDATA[<p>In this tutorial we will discuss git bisect to find the commit that caused regression bug. Regression Bug A regression bug is an error that appears in software after a change like a new feature, update, or fix causing previously working functionality to break.It indicates the system has “regressed” in quality. This can happen in ... <a title="Regression Bug? Learn Git Bisect to Find the Problem Commit" class="read-more" href="https://nolowiz.com/regression-bug-learn-git-bisect-to-find-the-problem-commit/" aria-label="More on Regression Bug? Learn Git Bisect to Find the Problem Commit">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/regression-bug-learn-git-bisect-to-find-the-problem-commit/">Regression Bug? Learn Git Bisect to Find the Problem Commit</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this tutorial we will discuss git bisect to find the commit that caused regression bug.</p>



<h2>Regression Bug</h2>



<p>A<strong> </strong>regression bug is an error that appears in software after a change like a new feature, update, or fix causing previously working functionality to break.It indicates the system has “regressed” in quality. This can happen in typical software development.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>What is Git Bisect?</h2>



<h5>Let&#8217;s understand the problem :</h5>



<p>We know a feature was working before, now it&#8217;s broken. How do we find which commit broke it &#8211; without checking every commit?</p>



<p>The Solution is <a href="https://git-scm.com/docs/git-bisect" target="_blank" rel="noreferrer noopener">git bisect</a>!</p>



<p>Git Bisect helps find the exact commit that introduced a bug using binary search.</p>



<h2>The Core Idea Behind Git Bisect</h2>



<p>Binary Search is a fast way to find something inside a sorted list. Instead of checking items one by one, it splits the list in half each time  reducing search time from O(n) to O(log n).</p>



<p>Let&#8217;s see an example searching for 7 in a sorted list as shown below.</p>



<pre class="wp-block-code"><code>List: &#91;1, 2, 3, 4, 5, 6, 7, 8]

Search for “7”
              ↓
<strong>Step 1</strong> → middle = 4 (not found)
Search right half → &#91;5,6,7,8]

<strong>Step 2</strong> → middle = 6 (not found)
Search right half → &#91;7,8]

<strong>Step 3</strong> → middle = 7 <strong>(FOUND</strong>)</code></pre>



<p>Instead of checking 8 items, it found the answer in just 3 checks.</p>



<p>The same technique is used in git bisect to search for the commit that caused the bug.</p>



<h2>How to use git bisect</h2>



<p>Suppose we have simple calculator app with following commits. (We introduced a bug in commit <strong>57cd4b8 </strong>for this demo)</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="440" height="203" src="https://nolowiz.com/wp-content/uploads/2025/11/image.png" alt="Git commits log" class="wp-image-6678" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image.png 440w, https://nolowiz.com/wp-content/uploads/2025/11/image-300x138.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-150x69.png 150w" sizes="(max-width: 440px) 100vw, 440px" /></figure>



<p>The latest code is shown below commit ID : <strong>ac6beeb</strong></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
def add(a :int, b :int) -&gt; int:
    return a - b

def subtract(a :int, b :int) -&gt; int:
    return a - b    

def multiply(a :int, b :int) -&gt; int:
    return a * b

def divide(a :int, b :int) -&gt; float:
    if b == 0:
        raise ValueError(&quot;Cannot divide by zero.&quot;)
    return a / b

def modulus(a :int, b :int) -&gt; int:
    return a % b

if __name__ == &quot;__main__&quot;:
    result = add(3, 5)
    print(f&quot;The sum of 3 and 5 is: {result}&quot;)
</pre></div>


<p>We can see that add function is wrong when we run the application we will get the below output</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="312" height="60" src="https://nolowiz.com/wp-content/uploads/2025/11/image-1.png" alt="App output" class="wp-image-6681" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-1.png 312w, https://nolowiz.com/wp-content/uploads/2025/11/image-1-300x58.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-1-150x29.png 150w" sizes="(max-width: 312px) 100vw, 312px" /></figure>



<p>Now we have a regression bug, we need to find out the which commit introduced this bug. To finding this bug manually we need to test each commit for the bug, but git bisect will help us to find the buggy commit faster.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<p>First run the below command to list all the commits with commit IDs.</p>



<pre class="wp-block-code"><code>git log --oneline</code></pre>



<p>Run the below command to start the git bisect process :</p>



<pre class="wp-block-code"><code>git bisect start</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="432" height="54" src="https://nolowiz.com/wp-content/uploads/2025/11/image-2.png" alt="" class="wp-image-6684" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-2.png 432w, https://nolowiz.com/wp-content/uploads/2025/11/image-2-300x38.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-2-150x19.png 150w" sizes="(max-width: 432px) 100vw, 432px" /></figure>



<p>Next we need to give one known good commit where the feature(additon) worked and bad commit. We are going to use use the first commit for this demo (You can give previous good release commit ID)</p>



<pre class="wp-block-code"><code>git bisect good 8714580</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="465" height="52" src="https://nolowiz.com/wp-content/uploads/2025/11/image-3.png" alt="" class="wp-image-6685" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-3.png 465w, https://nolowiz.com/wp-content/uploads/2025/11/image-3-300x34.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-3-150x17.png 150w" sizes="(max-width: 465px) 100vw, 465px" /></figure>



<p>Finally, we need to give a bad commit for this demo Im using latest commit ID <strong>ac6beeb</strong> :</p>



<pre class="wp-block-code"><code>git bisect bad ac6beeb</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="593" height="77" src="https://nolowiz.com/wp-content/uploads/2025/11/image-4.png" alt="" class="wp-image-6686" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-4.png 593w, https://nolowiz.com/wp-content/uploads/2025/11/image-4-300x39.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-4-150x19.png 150w" sizes="(max-width: 593px) 100vw, 593px" /></figure>



<p>From the above logs we can see that bisecting started current commit is &#8220;update readme&#8221;. Let&#8217;s check app output</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="303" height="58" src="https://nolowiz.com/wp-content/uploads/2025/11/image-5.png" alt="" class="wp-image-6687" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-5.png 303w, https://nolowiz.com/wp-content/uploads/2025/11/image-5-300x57.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-5-150x29.png 150w" sizes="(max-width: 303px) 100vw, 303px" /></figure>



<p>It is working fine &#8211; the answser is correct, next we need to mark it as good by running the below command</p>



<pre class="wp-block-code"><code>git bisect good</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="750" height="72" src="https://nolowiz.com/wp-content/uploads/2025/11/image-6.png" alt="" class="wp-image-6689" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-6.png 750w, https://nolowiz.com/wp-content/uploads/2025/11/image-6-300x29.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-6-150x14.png 150w" sizes="(max-width: 750px) 100vw, 750px" /></figure>



<p>We are now moved to another commit that is &#8220;Update readme with supported operations&#8221;, again run the application or run unit tests.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="293" height="46" src="https://nolowiz.com/wp-content/uploads/2025/11/image-7.png" alt="" class="wp-image-6690" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-7.png 293w, https://nolowiz.com/wp-content/uploads/2025/11/image-7-150x24.png 150w" sizes="(max-width: 293px) 100vw, 293px" /></figure>



<p>Yes we got bad commit, mark it using the below command.</p>



<pre class="wp-block-code"><code>git bisect bad</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="618" height="70" src="https://nolowiz.com/wp-content/uploads/2025/11/image-8.png" alt="" class="wp-image-6692" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-8.png 618w, https://nolowiz.com/wp-content/uploads/2025/11/image-8-300x34.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-8-150x17.png 150w" sizes="(max-width: 618px) 100vw, 618px" /></figure>



<p>We finally found the commit that caused the bug that is &#8220;Implement multiplication&#8221;, commit ID : 57cd4b8.</p>



<p>Finally , we need to exit git from bisect mode by running the below command</p>



<pre class="wp-block-code"><code>git bisect reset</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="555" height="62" src="https://nolowiz.com/wp-content/uploads/2025/11/image-9.png" alt="" class="wp-image-6702" srcset="https://nolowiz.com/wp-content/uploads/2025/11/image-9.png 555w, https://nolowiz.com/wp-content/uploads/2025/11/image-9-300x34.png 300w, https://nolowiz.com/wp-content/uploads/2025/11/image-9-150x17.png 150w" sizes="(max-width: 555px) 100vw, 555px" /></figure>



<p></p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Learn Git Bisect to Find the Problem Commit #git #gitbisect #tutorial" width="900" height="506" src="https://www.youtube.com/embed/Us6Ztv3bhXY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<h2>Conclusion</h2>



<p>With Git Bisect, you let Git do the detective work for you &#8211; using the power of binary search to find the exact commit that introduced a bug. It’s fast, reliable, and perfect for regression issues. I hope this tutorial helpful for you. <a href="https://nolowiz.com/git-merge-vs-rebase-whats-the-difference/" target="_blank" rel="noreferrer noopener">Learn the difference between git rebase and git merge</a>.</p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fregression-bug-learn-git-bisect-to-find-the-problem-commit%2F&amp;linkname=Regression%20Bug%3F%20Learn%20Git%20Bisect%20to%20Find%20the%20Problem%20Commit" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fregression-bug-learn-git-bisect-to-find-the-problem-commit%2F&amp;linkname=Regression%20Bug%3F%20Learn%20Git%20Bisect%20to%20Find%20the%20Problem%20Commit" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fregression-bug-learn-git-bisect-to-find-the-problem-commit%2F&amp;linkname=Regression%20Bug%3F%20Learn%20Git%20Bisect%20to%20Find%20the%20Problem%20Commit" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fregression-bug-learn-git-bisect-to-find-the-problem-commit%2F&amp;linkname=Regression%20Bug%3F%20Learn%20Git%20Bisect%20to%20Find%20the%20Problem%20Commit" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fregression-bug-learn-git-bisect-to-find-the-problem-commit%2F&#038;title=Regression%20Bug%3F%20Learn%20Git%20Bisect%20to%20Find%20the%20Problem%20Commit" data-a2a-url="https://nolowiz.com/regression-bug-learn-git-bisect-to-find-the-problem-commit/" data-a2a-title="Regression Bug? Learn Git Bisect to Find the Problem Commit"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/regression-bug-learn-git-bisect-to-find-the-problem-commit/">Regression Bug? Learn Git Bisect to Find the Problem Commit</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>App-to-App Authentication with Keycloak &#8211; Step by Step Guide</title>
		<link>https://nolowiz.com/app-to-app-authentication-with-keycloak-step-by-step-guide/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Sun, 20 Jul 2025 10:22:35 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6547</guid>

					<description><![CDATA[<p>In this step-by-step guide, we will explore how to set up Keycloak for app-to-app authentication. Project In this demo, we are going to create a project named &#8220;Cool Project&#8221; . It has a FastAPI-based API server and client app. For app-to-app authentication/authorization, we will use the OAuth2 client credentials flow. OAuth 2.0 Client Credentials Flow ... <a title="App-to-App Authentication with Keycloak &#8211; Step by Step Guide" class="read-more" href="https://nolowiz.com/app-to-app-authentication-with-keycloak-step-by-step-guide/" aria-label="More on App-to-App Authentication with Keycloak &#8211; Step by Step Guide">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/app-to-app-authentication-with-keycloak-step-by-step-guide/">App-to-App Authentication with Keycloak &#8211; Step by Step Guide</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this step-by-step guide, we will explore how to set up Keycloak for app-to-app authentication.</p>



<h2>Project</h2>



<p>In this demo, we are going to create a project named &#8220;Cool Project&#8221; . It has a FastAPI-based API server and client app. For app-to-app authentication/authorization, we will use the OAuth2 client credentials flow.</p>



<p><a href="https://datatracker.ietf.org/doc/html/rfc6749#section-4.4" target="_blank" rel="noreferrer noopener">OAuth 2.0 Client Credentials Flow Specification &#8211; RFC 6749</a></p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<p>The components of our project are :</p>



<ul><li>Resource server &#8211; FastAPI server</li><li>Client &#8211; Client app ( For the simplicity of this demo, we will use Postman to call the APIs).</li><li>Authorization Server &#8211; Keycloak</li></ul>



<p>We will use the client ID and client secret of the client app to get an access token from the Keycloak authorization server. We will use this access token to call the FastAPI server APIs.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="964" height="598" src="https://nolowiz.com/wp-content/uploads/2025/07/coolproject-keycloak-app-to-app.png" alt="App to app authentication keycloak system " class="wp-image-6606" srcset="https://nolowiz.com/wp-content/uploads/2025/07/coolproject-keycloak-app-to-app.png 964w, https://nolowiz.com/wp-content/uploads/2025/07/coolproject-keycloak-app-to-app-300x186.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/coolproject-keycloak-app-to-app-768x476.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/coolproject-keycloak-app-to-app-150x93.png 150w" sizes="(max-width: 964px) 100vw, 964px" /></figure>



<h2>Keycloak</h2>



<p>Keycloak&nbsp;is an open-source identity and access management solution that provides single sign-on (SSO), authentication, and authorization for web and mobile applications. It supports modern security protocols like OAuth2 and OpenID Connect, integrates with LDAP and social logins, and offers centralized user management and customization. Keycloak supports the OAuth2 Client Credentials flow, which can be used for app-to-app authentication and authorization.</p>



<h2>Start Keycloak</h2>



<p>First, we need to download Keycloak.</p>



<p>Download the Keycloak zip file from <a href="https://www.keycloak.org/downloads" target="_blank" rel="noreferrer noopener">here</a> and extract the zip file. We are using Keycloak version 26.3.</p>



<p>After extracting the zip, enter the keycloak directory and run the following command in the command prompt:</p>



<pre class="wp-block-code"><code>bin\kc.bat start-dev</code></pre>



<p>Please note that we are running Keycloak in development mode. Open the URL <code>http://localhost:8080/</code>  in a browser. For this demo, we&#8217;re going to create an admin user.</p>



<p>Create an admin user with a username <code>admin</code> and password as <code>adminpass</code> Then log in to Keycloak using the admin user.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Create a realm for the project</h2>



<p>Next, we need to create a realm for our project. A<strong> </strong>realm in Keycloak is an isolated security and administrative domain where you manage users, applications, roles, and groups. In simple terms, we can think of it as a project with all the details.. Each realm controls authentication and authorization for its contained resources, ensuring that users and configurations are separated from other realms, enabling multi-tenancy and organized management.</p>



<p>Let&#8217;s create a cool project realm. Click on &#8220;Manage realms&#8221; on the left sidebar and create a realm as shown below.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="645" src="https://nolowiz.com/wp-content/uploads/2025/07/image-1-1024x645.png" alt="Keycloak realm" class="wp-image-6561" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-1-1024x645.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-1-300x189.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-1-768x484.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-1-150x94.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-1.png 1404w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2>Create client </h2>



<p>Next, we need to create a client in the coolproject realm.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="990" height="612" src="https://nolowiz.com/wp-content/uploads/2025/07/image-3.png" alt="Create keycloak client" class="wp-image-6565" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-3.png 990w, https://nolowiz.com/wp-content/uploads/2025/07/image-3-300x185.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-3-768x475.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-3-150x93.png 150w" sizes="(max-width: 990px) 100vw, 990px" /></figure>



<p>Click next, and on the next page, we need to turn on &#8220;Client authentication&#8221; and &#8220;Service account roles&#8221; as shown below :</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="605" src="https://nolowiz.com/wp-content/uploads/2025/07/image-4-1024x605.png" alt="Create keycloak client service account" class="wp-image-6566" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-4-1024x605.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-4-300x177.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-4-768x454.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-4-150x89.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-4.png 1035w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>The above settings enable us to use the OAuth2 client credentials flow.</p>



<p>Click next and leave everything as it is, and click save. Now, click on clients again on the left sidebar, as we can see the newly created client &#8220;client-app&#8221; listed as shown below :</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="630" src="https://nolowiz.com/wp-content/uploads/2025/07/image-5-1024x630.png" alt="Create keycloak clients" class="wp-image-6570" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-5-1024x630.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-5-300x185.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-5-768x473.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-5-150x92.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-5.png 1206w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2>Client ID and Client Secret</h2>



<p>In the OAuth2 Client credentials flow, we need the client ID and client secret. </p>



<p>Open the client-app from the left sidebar and we can see that Client ID is &#8220;client-app&#8221; as shown below :</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="404" src="https://nolowiz.com/wp-content/uploads/2025/07/image-6-1024x404.png" alt="Create keycloak client ID" class="wp-image-6573" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-6-1024x404.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-6-300x118.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-6-768x303.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-6-150x59.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-6.png 1084w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Next, we need the client secret. Click the credentials tab.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="510" src="https://nolowiz.com/wp-content/uploads/2025/07/image-7-1024x510.png" alt="Create keycloak client secret" class="wp-image-6574" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-7-1024x510.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-7-300x149.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-7-768x382.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-7-150x75.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-7.png 1055w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Open the <a href="http://localhost:8080/realms/coolproject/.well-known/openid-configuration" target="_blank" rel="noreferrer noopener" class="broken_link">http://localhost:8080/realms/coolproject/.well-known/openid-configuration</a> in a browser. We can see the token endpoint as shown below. We will use this URL in Postman to get an access token for the client app.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="346" src="https://nolowiz.com/wp-content/uploads/2025/07/image-8-1024x346.png" alt="Keycloak OpenID endpoints" class="wp-image-6578" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-8-1024x346.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-8-300x101.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-8-768x259.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-8-150x51.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-8.png 1490w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2>Add audience claim</h2>



<p>In the Client Credentials flow, there is no user; it&#8217;s an application-to-application (machine-to-machine) authentication. The <a href="https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3" target="_blank" rel="noreferrer noopener"><code>audience</code> (<code>aud</code>) claim</a> in the access token typically refers to the resource server, that is, the application or API that will receive and validate the token.</p>



<p>We need to add the audience claim to the access token payload. Open clients, then client scopes, and click one <code>client-app-dedicated</code> (a client scope that is ending <code>dedicated</code>).</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="441" src="https://nolowiz.com/wp-content/uploads/2025/07/image-9-1024x441.png" alt="Add audience claim" class="wp-image-6582" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-9-1024x441.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-9-300x129.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-9-768x331.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-9-150x65.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-9.png 1185w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Then turn off &#8220;Full scope allowed&#8221; (It will remove the default audience &#8220;account&#8221; ) as shown below.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="561" height="283" src="https://nolowiz.com/wp-content/uploads/2025/07/image-11.png" alt="Disable fullscope " class="wp-image-6584" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-11.png 561w, https://nolowiz.com/wp-content/uploads/2025/07/image-11-300x151.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-11-150x76.png 150w" sizes="(max-width: 561px) 100vw, 561px" /></figure>



<p>Next, we will create a new client scope for the audience with value as the resource server name.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="737" src="https://nolowiz.com/wp-content/uploads/2025/07/image-12-1024x737.png" alt="Add new audience" class="wp-image-6586" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-12-1024x737.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-12-300x216.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-12-768x553.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-12-150x108.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-12.png 1067w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Open the api-audience client scope and click Mapper, and create a new mapper for Audience. In the &#8220;included Custom Audience&#8221; section, we can give the REST API server name(apiserver). See the screenshots below for reference.</figcaption></figure>



<figure class="wp-block-image size-full"><img loading="lazy" width="652" height="796" src="https://nolowiz.com/wp-content/uploads/2025/07/image-14.png" alt="Add new audience client scope mapper" class="wp-image-6589" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-14.png 652w, https://nolowiz.com/wp-content/uploads/2025/07/image-14-246x300.png 246w, https://nolowiz.com/wp-content/uploads/2025/07/image-14-150x183.png 150w" sizes="(max-width: 652px) 100vw, 652px" /></figure>



<p>Next, open the client and add the newly created &#8220;api-audience&#8221; scope to the client-app. Open clients and client scopes, add api-audience as shown below:</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="560" src="https://nolowiz.com/wp-content/uploads/2025/07/image-15-1024x560.png" alt="Add audience client scope" class="wp-image-6591" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-15-1024x560.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-15-300x164.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-15-768x420.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-15-150x82.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-15.png 1111w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Ensure that api-audience assigned type is &#8220;Default&#8221; as shown below.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="1017" height="757" src="https://nolowiz.com/wp-content/uploads/2025/07/image-16.png" alt="" class="wp-image-6593" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-16.png 1017w, https://nolowiz.com/wp-content/uploads/2025/07/image-16-300x223.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-16-768x572.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-16-150x112.png 150w" sizes="(max-width: 1017px) 100vw, 1017px" /></figure>



<p>Now our client app configuration is ready.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Start Resource Server</h2>



<p>Next, we need to start the resource server. In this example, we are going to use a simple FastAPI application.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
from fastapi import FastAPI, Depends, HTTPException
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from jose import jwt
import httpx

app = FastAPI()
security = HTTPBearer()


KEYCLOAK_REALM = &quot;coolproject&quot;
KEYCLOAK_URL = &quot;http://localhost:8080&quot;
KEYCLOAK_OPENID_CONFIG = (
    f&quot;{KEYCLOAK_URL}/realms/{KEYCLOAK_REALM}/.well-known/openid-configuration&quot;
)

JWKS = None
from jose.utils import base64url_decode
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.backends import default_backend


async def verify_token(credentials: HTTPAuthorizationCredentials = Depends(security)):
    token = credentials.credentials
    jwks = await get_public_key()

    try:
        unverified_header = jwt.get_unverified_header(token)
        kid = unverified_header.get(&quot;kid&quot;)
        if not kid:
            raise Exception(&quot;Missing 'kid' in token header&quot;)

        key = next(k for k in jwks&#91;&quot;keys&quot;] if k&#91;&quot;kid&quot;] == kid)

        n = int.from_bytes(base64url_decode(key&#91;&quot;n&quot;].encode()), byteorder=&quot;big&quot;)
        e = int.from_bytes(base64url_decode(key&#91;&quot;e&quot;].encode()), byteorder=&quot;big&quot;)

        public_key = rsa.RSAPublicNumbers(e, n).public_key(default_backend())

        payload = jwt.decode(
            token,
            key=public_key,
            algorithms=&#91;&quot;RS256&quot;],
            audience=&quot;apiserver&quot;,
            issuer=f&quot;{KEYCLOAK_URL}/realms/{KEYCLOAK_REALM}&quot;,
        )
        print(payload)
        return payload

    except Exception as e:
        raise HTTPException(status_code=401, detail=f&quot;Invalid token: {str(e)}&quot;)


async def get_public_key():
    global JWKS
    if JWKS is None:
        async with httpx.AsyncClient() as client:
            r = await client.get(KEYCLOAK_OPENID_CONFIG)
            jwks_uri = r.json()&#91;&quot;jwks_uri&quot;]
            r2 = await client.get(jwks_uri)
            JWKS = r2.json()
    return JWKS


@app.get(&quot;/secure-data&quot;)
async def secure_data(user=Depends(verify_token)):
    return {&quot;message&quot;: &quot;You have access!&quot;, &quot;client&quot;: user&#91;&quot;sub&quot;]}


if __name__ == &quot;__main__&quot;:
    import uvicorn

    uvicorn.run(&quot;app:app&quot;, host=&quot;127.0.0.1&quot;, port=8000, reload=True)

</pre></div>


<p>Create a requirements.txt and install it</p>



<pre class="wp-block-code"><code>fastapi
httpx
python-jose&#91;cryptography]
uvicorn</code></pre>



<p>In the JWT decode, we need to give the audience as the &#8220;apiserver&#8221; that we configured</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
payload = jwt.decode(
            token,
            key=public_key,
            algorithms=&#91;&quot;RS256&quot;],
            audience=&quot;apiserver&quot;,
            issuer=f&quot;{KEYCLOAK_URL}/realms/{KEYCLOAK_REALM}&quot;,
        )
</pre></div>


<p>Start the FastAPI server. Next, we will get an access token using the /token request as shown below :</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="799" height="698" src="https://nolowiz.com/wp-content/uploads/2025/07/image-18.png" alt="Postman token request" class="wp-image-6599" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-18.png 799w, https://nolowiz.com/wp-content/uploads/2025/07/image-18-300x262.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-18-768x671.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-18-150x131.png 150w" sizes="(max-width: 799px) 100vw, 799px" /></figure>



<p>Finally, we will use this access token to call the APIs as shown below :</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="764" height="535" src="https://nolowiz.com/wp-content/uploads/2025/07/image-19.png" alt="Postman access resource using access token" class="wp-image-6601" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-19.png 764w, https://nolowiz.com/wp-content/uploads/2025/07/image-19-300x210.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-19-150x105.png 150w" sizes="(max-width: 764px) 100vw, 764px" /></figure>



<p>We can see that the access token payload contains the &#8220;aud&#8221; claim. </p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="212" src="https://nolowiz.com/wp-content/uploads/2025/07/image-20-1024x212.png" alt="Aud claim" class="wp-image-6603" srcset="https://nolowiz.com/wp-content/uploads/2025/07/image-20-1024x212.png 1024w, https://nolowiz.com/wp-content/uploads/2025/07/image-20-300x62.png 300w, https://nolowiz.com/wp-content/uploads/2025/07/image-20-768x159.png 768w, https://nolowiz.com/wp-content/uploads/2025/07/image-20-150x31.png 150w, https://nolowiz.com/wp-content/uploads/2025/07/image-20.png 1082w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2>Conclusion</h2>



<p>In conclusion, it is easier to set up an authorization server using client credential flow in Keycloak. You can read about <a href="https://nolowiz.com/how-to-serve-llm-using-the-openvino-model-server-on-windows/">How to serve LLM using the OpenVINO Model Server on Windows</a>.</p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fapp-to-app-authentication-with-keycloak-step-by-step-guide%2F&amp;linkname=App-to-App%20Authentication%20with%20Keycloak%20%E2%80%93%20Step%20by%20Step%20Guide" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fapp-to-app-authentication-with-keycloak-step-by-step-guide%2F&amp;linkname=App-to-App%20Authentication%20with%20Keycloak%20%E2%80%93%20Step%20by%20Step%20Guide" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fapp-to-app-authentication-with-keycloak-step-by-step-guide%2F&amp;linkname=App-to-App%20Authentication%20with%20Keycloak%20%E2%80%93%20Step%20by%20Step%20Guide" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fapp-to-app-authentication-with-keycloak-step-by-step-guide%2F&amp;linkname=App-to-App%20Authentication%20with%20Keycloak%20%E2%80%93%20Step%20by%20Step%20Guide" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fapp-to-app-authentication-with-keycloak-step-by-step-guide%2F&#038;title=App-to-App%20Authentication%20with%20Keycloak%20%E2%80%93%20Step%20by%20Step%20Guide" data-a2a-url="https://nolowiz.com/app-to-app-authentication-with-keycloak-step-by-step-guide/" data-a2a-title="App-to-App Authentication with Keycloak – Step by Step Guide"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/app-to-app-authentication-with-keycloak-step-by-step-guide/">App-to-App Authentication with Keycloak &#8211; Step by Step Guide</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to serve LLM using the OpenVINO Model Server on Windows</title>
		<link>https://nolowiz.com/how-to-serve-llm-using-the-openvino-model-server-on-windows/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Tue, 25 Feb 2025 14:41:50 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6340</guid>

					<description><![CDATA[<p>In this step-by-step guide, we will discuss the deployment of the Large Language Model (LLM) using the OpenVINO model server. This tutorial focuses on the serving of the TinyLlama chat model REST API endpoint using the openVINO model server. We know that OpenVINO is an open-source toolkit by Intel for optimizing and deploying deep learning ... <a title="How to serve LLM using the OpenVINO Model Server on Windows" class="read-more" href="https://nolowiz.com/how-to-serve-llm-using-the-openvino-model-server-on-windows/" aria-label="More on How to serve LLM using the OpenVINO Model Server on Windows">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-serve-llm-using-the-openvino-model-server-on-windows/">How to serve LLM using the OpenVINO Model Server on Windows</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this step-by-step guide, we will discuss the deployment of the Large Language Model (LLM) using the OpenVINO model server. This tutorial focuses on the serving of the TinyLlama chat model REST API endpoint using the openVINO model server. </p>



<p>We know that <a href="https://github.com/openvinotoolkit/openvino" target="_blank" rel="noreferrer noopener">OpenVINO </a>is an open-source toolkit by <a href="https://www.intel.com/content/www/us/en/homepage.html" target="_blank" rel="noreferrer noopener" class="broken_link">Intel </a>for optimizing and deploying deep learning models. It enhances model performance on Intel hardware, supports frameworks like PyTorch and TensorFlow, and offers tools for efficient inference across multiple platforms, including CPUs, GPUs, NPUs and VPUs.</p>



<p>Ensure the following dependencies are available on your Windows 11 machine :</p>



<ul><li>Python 3.11 or higher</li><li>git</li><li>curl (optional)</li></ul>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<h2>Model Conversion</h2>



<p>We need to convert the model LLM model to OpenVINO. Create a folder and a Python virtual environment, for that open command prompt and run the below commands : </p>



<pre class="wp-block-code"><code>mkdir model_converter
cd model_converter
python -m venv env
env\Scripts\activate</code></pre>



<p>Next, install the dependencies by running the below command : </p>



<pre class="wp-block-code"><code>pip install -r https://raw.githubusercontent.com/openvinotoolkit/model_server/refs/heads/main/demos/common/export_models/requirements.txt</code></pre>



<p>Then download the <a href="https://raw.githubusercontent.com/openvinotoolkit/model_server/refs/heads/main/demos/common/export_models/export_model.py" target="_blank" rel="noreferrer noopener">export_model.py</a> file to &#8220;model_converter&#8221; folder or use the below command :</p>



<pre class="wp-block-code"><code>curl https://raw.githubusercontent.com/openvinotoolkit/model_server/refs/heads/main/demos/common/export_models/export_model.py  --ssl-no-revoke -o export_model.py</code></pre>



<p>Create a folder named &#8220;models&#8221; by running the below command :</p>



<pre class="wp-block-code"><code>mkdir models</code></pre>



<p>Next, we need to convert the <a href="https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0" target="_blank" rel="noreferrer noopener">TinyLlama-1.1B-Chat-v1.0</a> model to OpenVINO using the below command :</p>



<pre class="wp-block-code"><code>python export_model.py text_generation --source_model TinyLlama/TinyLlama-1.1B-Chat-v1.0 --weight-format int4 --config_file_path models/config.json --model_repository_path models </code></pre>



<p></p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="505" src="https://nolowiz.com/wp-content/uploads/2025/02/openvino_model_conversion-1024x505.png" alt="OpenVINO model conversion for OVMS" class="wp-image-6358" srcset="https://nolowiz.com/wp-content/uploads/2025/02/openvino_model_conversion-1024x505.png 1024w, https://nolowiz.com/wp-content/uploads/2025/02/openvino_model_conversion-300x148.png 300w, https://nolowiz.com/wp-content/uploads/2025/02/openvino_model_conversion-768x379.png 768w, https://nolowiz.com/wp-content/uploads/2025/02/openvino_model_conversion-150x74.png 150w, https://nolowiz.com/wp-content/uploads/2025/02/openvino_model_conversion.png 1032w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>After conversion, the OpenVINO TinyLlama model is available in the &#8220;models&#8221; directory. We need the full path of &#8220;config.json&#8221; to serve the model with the OpenVINO model server. The converted OpenVINO model weights are int4 quantized.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="652" height="112" src="https://nolowiz.com/wp-content/uploads/2025/02/image-1.png" alt="" class="wp-image-6365" srcset="https://nolowiz.com/wp-content/uploads/2025/02/image-1.png 652w, https://nolowiz.com/wp-content/uploads/2025/02/image-1-300x52.png 300w, https://nolowiz.com/wp-content/uploads/2025/02/image-1-150x26.png 150w" sizes="(max-width: 652px) 100vw, 652px" /></figure>



<h2>Deploy model with OpenVINO Model Server</h2>



<p><a href="https://github.com/openvinotoolkit/model_server" target="_blank" rel="noreferrer noopener">OpenVINO Model Server</a> is a high-performance system for serving optimized machine learning models over standard network protocols like REST and <a href="https://grpc.io/" target="_blank" rel="noreferrer noopener">gRPC</a>. Built with C++ and optimized for Intel hardware, it leverages the OpenVINO toolkit for accelerated inference. OVMS offers gRPC and REST APIs, compatible with TensorFlow Serving and KServe, simplifying integration. It supports diverse frameworks and model formats, enabling scalable and efficient deployment for AI applications like image recognition and NLP. OVMS is open-source, flexible, and designed for production environments.</p>



<p>Download the OpenVINO model server for Windows from the GitHub releases page <a href="https://github.com/openvinotoolkit/model_server/releases/download/v2025.0/ovms_windows.zip" target="_blank" rel="noreferrer noopener">here </a>. We are using OpenVINO<img src="https://s.w.org/images/core/emoji/13.1.0/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Model Server 2025.0 for this tutorial, extract the zip(ovms_windows.zip) file.</p>



<p>Open the command prompt enter into the &#8220;ovms_windows&#8221; folder and run the below commands:</p>



<pre class="wp-block-code"><code>setupvars.bat</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="462" height="116" src="https://nolowiz.com/wp-content/uploads/2025/02/image.png" alt="OVMS setup" class="wp-image-6362" srcset="https://nolowiz.com/wp-content/uploads/2025/02/image.png 462w, https://nolowiz.com/wp-content/uploads/2025/02/image-300x75.png 300w, https://nolowiz.com/wp-content/uploads/2025/02/image-150x38.png 150w" sizes="(max-width: 462px) 100vw, 462px" /></figure>



<p>Next, we can start the OVMS to serve our model by running the below command :</p>



<pre class="wp-block-code"><code>ovms --config_path "&lt;&lt;Your converted models config.js path&gt;&gt;"  --rest_port 8000</code></pre>



<p>Now the OVMS running at http://localhost:8000. Verify model serving is ok by requesting the API endpoint<strong> http://localhost:8000/v1/config</strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" width="509" height="307" src="https://nolowiz.com/wp-content/uploads/2025/02/curl_ovms_output.png" alt="OVMS API configuration" class="wp-image-6367" srcset="https://nolowiz.com/wp-content/uploads/2025/02/curl_ovms_output.png 509w, https://nolowiz.com/wp-content/uploads/2025/02/curl_ovms_output-300x181.png 300w, https://nolowiz.com/wp-content/uploads/2025/02/curl_ovms_output-150x90.png 150w" sizes="(max-width: 509px) 100vw, 509px" /></figure>



<p>As we can see that model is available since the state is &#8220;available&#8221; in the above API response.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Use LLM</h2>



<p>OpenVINO model server provides chat completions API endpoint similar to OpenAI.The chat completion endpoint of OVMS is :</p>



<pre class="wp-block-code"><code>http:&#47;&#47;localhost:8000/v3/chat/completions</code></pre>



<p>Install OpenAI package:</p>



<pre class="wp-block-code"><code>pip install openai</code></pre>



<p>We can test the LLM using the below code :</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
from openai import OpenAI

client = OpenAI(
  base_url=&quot;http://localhost:8000/v3&quot;,
  api_key=&quot;unused&quot;
)

stream = client.chat.completions.create(
    model=&quot;TinyLlama/TinyLlama-1.1B-Chat-v1.0&quot;,
    messages=&#91;{&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;What is opencv?&quot;}],
    stream=True,
    temperature=0.1,
)
for chunk in stream:
    if chunk.choices&#91;0].delta.content is not None:
        print(chunk.choices&#91;0].delta.content, end=&quot;&quot;, flush=True)
</pre></div>


<p><strong>Output</strong></p>



<figure class="wp-block-image size-full"><img loading="lazy" width="697" height="114" src="https://nolowiz.com/wp-content/uploads/2025/02/image-3.png" alt="" class="wp-image-6374" srcset="https://nolowiz.com/wp-content/uploads/2025/02/image-3.png 697w, https://nolowiz.com/wp-content/uploads/2025/02/image-3-300x49.png 300w, https://nolowiz.com/wp-content/uploads/2025/02/image-3-150x25.png 150w" sizes="(max-width: 697px) 100vw, 697px" /></figure>



<h2>Conclusion</h2>



<p>In short, deploying your LLM model on Windows is simplified with the OpenVINO model server. Just remember to convert your chosen model with the appropriate quantization for optimal performance.</p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-serve-llm-using-the-openvino-model-server-on-windows%2F&amp;linkname=How%20to%20serve%20LLM%20using%20the%20OpenVINO%20Model%20Server%20on%20Windows" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-serve-llm-using-the-openvino-model-server-on-windows%2F&amp;linkname=How%20to%20serve%20LLM%20using%20the%20OpenVINO%20Model%20Server%20on%20Windows" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-serve-llm-using-the-openvino-model-server-on-windows%2F&amp;linkname=How%20to%20serve%20LLM%20using%20the%20OpenVINO%20Model%20Server%20on%20Windows" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-serve-llm-using-the-openvino-model-server-on-windows%2F&amp;linkname=How%20to%20serve%20LLM%20using%20the%20OpenVINO%20Model%20Server%20on%20Windows" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fhow-to-serve-llm-using-the-openvino-model-server-on-windows%2F&#038;title=How%20to%20serve%20LLM%20using%20the%20OpenVINO%20Model%20Server%20on%20Windows" data-a2a-url="https://nolowiz.com/how-to-serve-llm-using-the-openvino-model-server-on-windows/" data-a2a-title="How to serve LLM using the OpenVINO Model Server on Windows"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-serve-llm-using-the-openvino-model-server-on-windows/">How to serve LLM using the OpenVINO Model Server on Windows</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to use ComfyUI with FastSDCPU and OpenVINO</title>
		<link>https://nolowiz.com/how-to-use-comfyui-with-fastsdcpu-and-openvino/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Thu, 26 Dec 2024 07:04:24 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6310</guid>

					<description><![CDATA[<p>This tutorial will discuss how to use FastSD webserver with ComfyUI. FastSDCPU is a faster version of a stable diffusion application running on a CPU, based on OpenVINO and Pytorch implementations. Step 1: Download and Install FastSDCPU In this demo, we are using a Windows 11 machine to test, first download FastSD CPU release. Extract ... <a title="How to use ComfyUI with FastSDCPU and OpenVINO" class="read-more" href="https://nolowiz.com/how-to-use-comfyui-with-fastsdcpu-and-openvino/" aria-label="More on How to use ComfyUI with FastSDCPU and OpenVINO">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-use-comfyui-with-fastsdcpu-and-openvino/">How to use ComfyUI with FastSDCPU and OpenVINO</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This tutorial will discuss how to use FastSD webserver with ComfyUI. FastSDCPU is a faster version of a stable diffusion application running on a CPU, based on OpenVINO and Pytorch implementations.</p>



<h2>Step 1: Download and Install FastSDCPU</h2>



<p>In this demo, we are using a Windows 11 machine to test, first download <a href="https://github.com/rupeshs/fastsdcpu/releases" target="_blank" rel="noreferrer noopener">FastSD CPU release</a>. Extract the zip file and install it by following the steps :</p>



<ul><li>You need to install <a href="https://www.python.org/">Python 3</a> and <a href="https://docs.astral.sh/uv/#highlights" target="_blank" rel="noreferrer noopener">uv </a>&#8211; fast package manager for python.</li><li>Double click&nbsp;<code>install.bat</code>&nbsp;(It will take some time to install, depending on your internet speed.)</li><li>After the installation close this command prompt window</li><li>Double click the<code> start-webserver.bat</code> file to start FastSD CPU in webserver mode</li></ul>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="504" src="https://nolowiz.com/wp-content/uploads/2024/12/image-1-1024x504.png" alt="" class="wp-image-6326" srcset="https://nolowiz.com/wp-content/uploads/2024/12/image-1-1024x504.png 1024w, https://nolowiz.com/wp-content/uploads/2024/12/image-1-300x148.png 300w, https://nolowiz.com/wp-content/uploads/2024/12/image-1-768x378.png 768w, https://nolowiz.com/wp-content/uploads/2024/12/image-1-150x74.png 150w, https://nolowiz.com/wp-content/uploads/2024/12/image-1.png 1095w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p></p>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354" crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2735334721002354" data-ad-slot="8835878737" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Step 2: Download and Install ComfyUI</h2>



<p>Next, we will download ComfyUI from this official<a href="https://github.com/comfyanonymous/ComfyUI/releases/download/v0.3.9/ComfyUI_windows_portable_nvidia.7z" target="_blank" rel="noreferrer noopener"> repo</a> and extract the zip file. </p>



<h2>Step 3: Install ComfyUI extensions</h2>



<p>Enter into <code>ComfyUI_windows_portable\ComfyUI\custom_nodes</code> folder and clone the following extensions :</p>



<ul><li><a href="https://github.com/BetaDoggo/ComfyUI-FastSDCPU">BetaDoggo/ComfyUI-FastSDCPU</a></li><li><a href="https://github.com/pythongosssss/ComfyUI-Custom-Scripts">pythongosssss/ComfyUI-Custom-Scripts</a></li></ul>



<p>Run the following command to install extensions:</p>



<pre class="wp-block-code"><code>git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts.git
git clone https://github.com/BetaDoggo/ComfyUI-FastSDCPU</code></pre>



<h2>Step 4:  Faster generation of images using OpenVINO</h2>



<p><a href="https://www.intel.com/content/www/us/en/developer/tools/openvino-toolkit/overview.html" target="_blank" rel="noreferrer noopener">OpenVINO</a>&nbsp;(<strong>Open</strong>&nbsp;<strong>V</strong>isual&nbsp;<strong>I</strong>nference and&nbsp;<strong>N</strong>eural Network&nbsp;<strong>O</strong>ptimization) is an open-source toolkit for optimizing and deploying deep learning models on Intel hardware, including CPUs, GPUs, NPUs, VPUs, and FPGAs.&nbsp;FastSD uses OpenVINO to improve inference speeds on CPU and <a href="https://nolowiz.com/ai-pc-and-openvino-quick-and-simple-guide/" target="_blank" rel="noreferrer noopener">AIPCs</a>.</p>



<p>Next, we can start comfyUI by double-clicking <code>run_cpu.bat</code> file. </p>



<p></p>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354" crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2735334721002354" data-ad-slot="8835878737" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<p>Open the FastSD ComfyUI extension<a href="https://github.com/BetaDoggo/ComfyUI-FastSDCPU" target="_blank" rel="noreferrer noopener"> page</a> and drag and drop the first image to your ComfyUi running at http://127.0.0.1:8188/</p>



<p>Write a prompt, select the model <code>rupeshs/sd-turbo-openvino</code> , and run. (if you get a NAN error change <code>token_merging</code> value to 0)</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="555" src="https://nolowiz.com/wp-content/uploads/2024/12/comfyi_fastsdcpu_openvino-1024x555.png" alt="" class="wp-image-6321" srcset="https://nolowiz.com/wp-content/uploads/2024/12/comfyi_fastsdcpu_openvino-1024x555.png 1024w, https://nolowiz.com/wp-content/uploads/2024/12/comfyi_fastsdcpu_openvino-300x163.png 300w, https://nolowiz.com/wp-content/uploads/2024/12/comfyi_fastsdcpu_openvino-768x417.png 768w, https://nolowiz.com/wp-content/uploads/2024/12/comfyi_fastsdcpu_openvino-150x81.png 150w, https://nolowiz.com/wp-content/uploads/2024/12/comfyi_fastsdcpu_openvino.png 1464w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="How to use ComfyUI with FastSDCPU #cpu #comfyui #fastsdcpu #ai" width="900" height="506" src="https://www.youtube.com/embed/UAXGjpEtnQI?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-comfyui-with-fastsdcpu-and-openvino%2F&amp;linkname=How%20to%20use%20ComfyUI%20with%20FastSDCPU%20and%20OpenVINO" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-comfyui-with-fastsdcpu-and-openvino%2F&amp;linkname=How%20to%20use%20ComfyUI%20with%20FastSDCPU%20and%20OpenVINO" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-comfyui-with-fastsdcpu-and-openvino%2F&amp;linkname=How%20to%20use%20ComfyUI%20with%20FastSDCPU%20and%20OpenVINO" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-comfyui-with-fastsdcpu-and-openvino%2F&amp;linkname=How%20to%20use%20ComfyUI%20with%20FastSDCPU%20and%20OpenVINO" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fhow-to-use-comfyui-with-fastsdcpu-and-openvino%2F&#038;title=How%20to%20use%20ComfyUI%20with%20FastSDCPU%20and%20OpenVINO" data-a2a-url="https://nolowiz.com/how-to-use-comfyui-with-fastsdcpu-and-openvino/" data-a2a-title="How to use ComfyUI with FastSDCPU and OpenVINO"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-use-comfyui-with-fastsdcpu-and-openvino/">How to use ComfyUI with FastSDCPU and OpenVINO</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Short-Circuiting in Python</title>
		<link>https://nolowiz.com/short-circuiting-in-python/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Tue, 20 Aug 2024 15:44:22 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6188</guid>

					<description><![CDATA[<p>In this article, we will discuss the short-circuiting technique in Python programming. What is Short Circuiting? Short-circuiting is a technique many programming languages use when evaluating boolean logic expressions to save computing power by skipping unnecessary parts of the expression. Python provides 2 short-circuit operators : or and The or Operator Python evaluates the left-hand ... <a title="Short-Circuiting in Python" class="read-more" href="https://nolowiz.com/short-circuiting-in-python/" aria-label="More on Short-Circuiting in Python">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/short-circuiting-in-python/">Short-Circuiting in Python</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this article, we will discuss the short-circuiting technique in Python programming.</p>



<h2>What is Short Circuiting?</h2>



<p>Short-circuiting is a technique many programming languages use when evaluating boolean logic expressions to save computing power by skipping unnecessary parts of the expression.</p>



<p>Python provides 2 short-circuit operators :</p>



<ul><li>or</li><li>and</li></ul>



<h3>The or Operator</h3>



<p>Python evaluates the left-hand side of the <code>or</code> expression first. If it is <code>True</code>, Python doesn&#8217;t evaluate the right-hand side because the entire expression will be <code>True</code> regardless of the right-hand side.</p>



<pre class="wp-block-code"><code> 50 &gt; 20 or 0 &gt; 1</code></pre>



<p>Here, the first expression starting from left 50&gt;20   is true. So Python will skip evaluating expressions on the right-hand side (0&gt;1).</p>



<p>Another example :</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
a = True
b = False
result = a or b  # Python only evaluates `a`, and the result is `True`
</pre></div>


<p>This avoids unnecessary computation on the right-hand side of the &#8220;or&#8221; operator.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h3>The and Operator</h3>



<p>For &#8220;and&#8221; operator, If the left-hand side expression is <code>False</code>, Python doesn&#8217;t evaluate the right-hand side because the entire expression will be <code>False</code> regardless of the right-hand side.</p>



<p>Let&#8217;s check the below example :</p>



<pre class="wp-block-code"><code>
1 &gt; 20 and 30 &gt; 4
</code></pre>



<p>The left-hand side expression( 1&gt;20)  is <code>False</code> so Python will skip evaluating right-hand side expressions.</p>



<h2>How can we confirm that short-circuiting is skipping the computation?</h2>



<p>The expression 1/0 raises an error(Division by zero) as shown below:</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="380" height="86" src="https://nolowiz.com/wp-content/uploads/2024/08/image.png" alt="zero by division error" class="wp-image-6196" srcset="https://nolowiz.com/wp-content/uploads/2024/08/image.png 380w, https://nolowiz.com/wp-content/uploads/2024/08/image-300x68.png 300w, https://nolowiz.com/wp-content/uploads/2024/08/image-150x34.png 150w" sizes="(max-width: 380px) 100vw, 380px" /></figure>



<figure class="wp-block-image size-full"><img loading="lazy" width="199" height="61" src="https://nolowiz.com/wp-content/uploads/2024/08/image-1.png" alt="and short circuiting example in python" class="wp-image-6197" srcset="https://nolowiz.com/wp-content/uploads/2024/08/image-1.png 199w, https://nolowiz.com/wp-content/uploads/2024/08/image-1-150x46.png 150w" sizes="(max-width: 199px) 100vw, 199px" /></figure>



<p>Python skips the 1/0 expression evaluation since 1&gt;20 is False.</p>



<p>Similarly, we can confirm <strong>or</strong> operator short-circuiting too.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="176" height="44" src="https://nolowiz.com/wp-content/uploads/2024/08/image-2.png" alt="" class="wp-image-6198" srcset="https://nolowiz.com/wp-content/uploads/2024/08/image-2.png 176w, https://nolowiz.com/wp-content/uploads/2024/08/image-2-150x38.png 150w" sizes="(max-width: 176px) 100vw, 176px" /></figure>



<p>Here also division by zero is not raised because 1/0 is not evaluated.</p>



<p></p>



<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354"
     crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-2735334721002354"
     data-ad-slot="8835878737"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Advantages of Short Circuiting in Python</h2>



<h3>1. Avoiding errors</h3>



<p>Short-circuiting can help avoid errors by skipping unnecessary evaluations.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
user = {'name': 'John', 'age': 30}
if user and user&#91;'address']:
    print(user&#91;'address']&#91;'city'])
</pre></div>


<p>If user is None, accessing user[&#8216;address&#8217;] would raise an error. But with short circuiting, the second part is only evaluated if user is true(Not None), preventing the error.</p>



<h3>2.&nbsp;Improving Performance</h3>



<p>Short-circuiting can improve performance by avoiding unnecessary computation..</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
if is_even(num) and is_prime(num):
    print(&quot;Number is both even and prime&quot;)
</pre></div>


<p>If num is odd, checking if it&#8217;s prime is unnecessary, so short circuiting skips it.</p>



<h3>3.&nbsp;Concise Conditional Logic</h3>



<p>Short circuiting allows writing concise conditional logic. For example:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
is_loaded = True
content = is_loaded and get_content()
</pre></div>


<p>If is_loaded is False, get_content() is never called, but content is still assigned False.</p>



<h3>4.&nbsp;Assigning Default Values</h3>



<p>Short circuiting is commonly used to assign default values:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
user_name = user.get('name') or 'Anonymous'
</pre></div>


<p>If user.get(&#8216;name&#8217;) returns None, user_name is assigned the default value &#8216;Anonymous&#8217;.</p>



<h2>Conclusion</h2>



<p>In summary, short circuiting in Python provides a way to write efficient, concise, and error-resistant code by skipping unnecessary computations based on the result of earlier parts of a boolean expression.</p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fshort-circuiting-in-python%2F&amp;linkname=Short-Circuiting%20in%20Python" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fshort-circuiting-in-python%2F&amp;linkname=Short-Circuiting%20in%20Python" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fshort-circuiting-in-python%2F&amp;linkname=Short-Circuiting%20in%20Python" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fshort-circuiting-in-python%2F&amp;linkname=Short-Circuiting%20in%20Python" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fshort-circuiting-in-python%2F&#038;title=Short-Circuiting%20in%20Python" data-a2a-url="https://nolowiz.com/short-circuiting-in-python/" data-a2a-title="Short-Circuiting in Python"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/short-circuiting-in-python/">Short-Circuiting in Python</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Anomaly Detection Using Anomalib and OpenVINO &#8211; Step by Step by Guide</title>
		<link>https://nolowiz.com/anomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Mon, 17 Jun 2024 15:51:50 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6101</guid>

					<description><![CDATA[<p>Anomaly detection is an important technique in manufacturing, fraud detection, network security, finance, and healthcare. In this step-by-step tutorial, we will discuss a way to detect anomalies using Intel&#8217;s Anomalib. What is Anomalib? Anomalib is a deep-learning Python library designed to collect and benchmark state-of-the-art anomaly detection algorithms for both public and private datasets. Some ... <a title="Anomaly Detection Using Anomalib and OpenVINO &#8211; Step by Step by Guide" class="read-more" href="https://nolowiz.com/anomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide/" aria-label="More on Anomaly Detection Using Anomalib and OpenVINO &#8211; Step by Step by Guide">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/anomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide/">Anomaly Detection Using Anomalib and OpenVINO &#8211; Step by Step by Guide</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Anomaly detection is an important technique in manufacturing, fraud detection, network security, finance, and healthcare. In this step-by-step tutorial, we will discuss a way to detect anomalies using Intel&#8217;s Anomalib.</p>



<h2>What is Anomalib?</h2>



<p><a href="https://github.com/openvinotoolkit/anomalib" target="_blank" rel="noreferrer noopener">Anomalib </a>is a deep-learning Python library designed to collect and benchmark state-of-the-art anomaly detection algorithms for both public and private datasets.</p>



<p>Some key features are :</p>



<ul><li>Python API and CLI available for model training, inference, and benchmarking</li><li>Simple and modular API</li><li>Models can be exported to <a href="https://www.intel.com/content/www/us/en/developer/tools/openvino-toolkit/overview.html" target="_blank" rel="noreferrer noopener">OpenVINO </a>for faster inference on <a href="https://www.intel.com/content/www/us/en/products/details/processors/core-ultra.html" target="_blank" rel="noreferrer noopener">Intel </a>hardware</li></ul>



<p>Let&#8217;s start by creating a Python virtual environment:</p>



<pre class="wp-block-code"><code>python -m venv env</code></pre>



<p>Copy the path to the <strong>activate.bat</strong> file in t<strong>he env </strong>folder and run :</p>



<pre class="wp-block-code"><code>F:\demo\anomalydetection\env\Scripts\activate.bat</code></pre>



<p> The above command will activate the virtual environment</p>



<p>Now install the required Python dependencies by running the following commands:</p>



<pre class="wp-block-code"><code>pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cpu 
pip install anomalib&#91;full]==1.1.0</code></pre>



<p>Now the development environment is ready. </p>



<p></p>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354" crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2735334721002354" data-ad-slot="8835878737" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Download MVTec anomaly detection dataset </h2>



<p>We will use <a href="https://www.mvtec.com/company/research/datasets/mvtec-ad">MVTec anomaly detection dataset</a>. It contains different categories of images train and test data.</p>



<p><a href="https://www.mvtec.com/company/research/datasets/mvtec-ad/downloads" target="_blank" rel="noreferrer noopener">Download the full MVTec anomaly detection dataset.</a></p>



<p>You can read more about the MVTech anomaly detection data research paper <a href="https://www.mvtec.com/fileadmin/Redaktion/mvtec.com/company/research/datasets/mvtec_ad.pdf" target="_blank" rel="noreferrer noopener" class="broken_link">here</a>.</p>



<div class="wp-block-image"><figure class="aligncenter size-full"><img loading="lazy" width="703" height="682" src="https://nolowiz.com/wp-content/uploads/2024/06/mvtech-anomaly-detection-dataset.png" alt="MVTec anomaly dataset extracted view on windows" class="wp-image-6111" srcset="https://nolowiz.com/wp-content/uploads/2024/06/mvtech-anomaly-detection-dataset.png 703w, https://nolowiz.com/wp-content/uploads/2024/06/mvtech-anomaly-detection-dataset-300x291.png 300w, https://nolowiz.com/wp-content/uploads/2024/06/mvtech-anomaly-detection-dataset-150x146.png 150w" sizes="(max-width: 703px) 100vw, 703px" /><figcaption>MVTech Anomaly Dataset extracted</figcaption></figure></div>



<p>For this tutorial, we will use bottle data. The bottle folder has the following directories :</p>



<ul><li>train &#8211; This folder contains all good bottle images (<em><strong>209 images</strong></em>).</li><li>test &#8211; This folder contains all good and defective bottle images (<strong><em>83 images</em></strong>).</li><li>ground_truth &#8211; Contains segmented images</li></ul>



<p>Let&#8217;s check good and defective bottle images.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="600" height="346" src="https://nolowiz.com/wp-content/uploads/2024/06/bottle-image.jpg" alt="Good image and defective bottle image" class="wp-image-6118" srcset="https://nolowiz.com/wp-content/uploads/2024/06/bottle-image.jpg 600w, https://nolowiz.com/wp-content/uploads/2024/06/bottle-image-300x173.jpg 300w, https://nolowiz.com/wp-content/uploads/2024/06/bottle-image-150x87.jpg 150w" sizes="(max-width: 600px) 100vw, 600px" /></figure>



<h2>Workflow of Anomalib</h2>



<p>The typical workflow of anomalib has the following steps :</p>



<ul><li>Training &#8211;  Training the model to recognise the normal pattern.</li><li>Validation/Test &#8211; Validating the model and metrics and testing model performance on the test dataset.</li><li>Optimization (optional) &#8211; Optimizing model to an efficient form for example FP16 or int8.</li><li>Deployment &#8211; The trained model can be deployed using tools Torch, Lightning, ONNX, OpenVINO, and Gradio.</li></ul>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" width="1024" height="481" src="https://nolowiz.com/wp-content/uploads/2024/06/high_level_workflow-1-1024x481.png" alt="High level workflow of anomalib" class="wp-image-6126" srcset="https://nolowiz.com/wp-content/uploads/2024/06/high_level_workflow-1-1024x481.png 1024w, https://nolowiz.com/wp-content/uploads/2024/06/high_level_workflow-1-300x141.png 300w, https://nolowiz.com/wp-content/uploads/2024/06/high_level_workflow-1-768x361.png 768w, https://nolowiz.com/wp-content/uploads/2024/06/high_level_workflow-1-1536x722.png 1536w, https://nolowiz.com/wp-content/uploads/2024/06/high_level_workflow-1-2048x963.png 2048w, https://nolowiz.com/wp-content/uploads/2024/06/high_level_workflow-1-150x71.png 150w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>High-level workflow of anomalib (Image courtesy: Anomalib)</figcaption></figure></div>



<h2>Training</h2>



<p>Data modules are responsible for providing the data for training, validation, and testing. We need to prepare a datamodule let&#8217;s initialize it.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
datamodule = MVTec(
        root=r&quot;F:\demo\mvtec_anomaly_detection&quot;,
        category=&quot;bottle&quot;,
        task=TaskType.CLASSIFICATION,
        val_split_mode=ValSplitMode.SYNTHETIC,  # synthetically generate validation data
        image_size=(256, 256),
        val_split_ratio=0.2,
        train_batch_size=32,
        eval_batch_size=32,
        num_workers=2,
    )
</pre></div>


<p>MVTec constructor arguments are :</p>



<ul><li>root &#8211;  Root path of extracted MVTec anomaly dataset</li><li>category &#8211; bottle</li><li>task &#8211; Classification </li><li>val_split_mode &#8211; No validation data is available we need to use synthetic data</li><li>image_size &#8211; Images resized to 256 x 256</li><li>train_batch_size &#8211; training batch size</li><li>eval_batch_size &#8211; evaluation batch size</li><li>num_workers &#8211; Number of workers</li></ul>



<p>Next, we need to initialize a model and engine. Here we are using the <a href="https://anomalib.readthedocs.io/en/latest/markdown/guides/reference/models/image/padim.html" target="_blank" rel="noreferrer noopener">Padim model</a> for the demo.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
 #Model and engine
model = Padim()
engine = Engine()
</pre></div>


<p>Train the model by calling the <span class="has-inline-color has-vivid-red-color">engine.fit</span> method.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
# Train the model
engine.fit(
        datamodule=datamodule,
        model=model,
    )

</pre></div>


<p>After the training, a results folder will be created and the trained lighting model will be saved F:\demo\anomalydetection\<strong>results\Padim\MVTec\bottle\v0\weights\lightning</strong>\<strong>model.ckpt</strong>. We will use this model path in the next steps.</p>



<p>The full source code of the training is available <a href="https://github.com/rupeshs/anomalydetection/blob/main/train.py" target="_blank" rel="noreferrer noopener">here (train.py)</a> .</p>



<p></p>



<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2735334721002354" crossorigin="anonymous"></script>
<!-- article-horizontal -->
<ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-2735334721002354" data-ad-slot="8835878737" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>



<p></p>



<h2>Test the trained model</h2>



<p>To test the model we need a datamodule, model, and engine.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
 test_results = engine.test(
        model=model,
        datamodule=datamodule,
        ckpt_path=r&quot;F:\demo\anomalydetection\results\Padim\MVTec\bottle\v0\weights\lightning\model.ckpt&quot;,
    )
    print(test_results)
</pre></div>


<p>Test output as shown below with <span class="has-inline-color has-vivid-red-color">image_AUROC </span>and <span class="has-inline-color has-vivid-red-color">image_F1Score</span>. The full source code of testing is available <a href="https://github.com/rupeshs/anomalydetection/blob/main/test.py" target="_blank" rel="noreferrer noopener">here (test.py)</a>.</p>



<figure class="wp-block-image size-full"><img loading="lazy" width="745" height="409" src="https://nolowiz.com/wp-content/uploads/2024/06/test_output.png" alt="Anomaly detection testing" class="wp-image-6143" srcset="https://nolowiz.com/wp-content/uploads/2024/06/test_output.png 745w, https://nolowiz.com/wp-content/uploads/2024/06/test_output-300x165.png 300w, https://nolowiz.com/wp-content/uploads/2024/06/test_output-150x82.png 150w" sizes="(max-width: 745px) 100vw, 745px" /></figure>



<h3>Metrics</h3>



<p>The following metrics are used image_F1Score and image_AUROC.</p>



<p><strong>F1 Score </strong></p>



<p>The F1 score is a measure of the performance of a classification model, combining precision and recall into a single value. It is the harmonic mean of precision and recall. It ranges from 0 to 1, with higher values indicating better performance. </p>



<p><strong>Precision </strong>tells us how many of the predicted positive cases are actually positive. It is a measure of the accuracy of the positive predictions. For example, high precision is essential in spam detection.</p>



<p><strong>Recall</strong> indicates how many of the actual positive cases were captured by the model. It measures the model’s ability to identify all relevant cases. High recall is crucial in scenarios where missing a positive case is costly. medical diagnosis, failing to identify a disease can have serious consequences.</p>



<p><strong>AUROC</strong></p>



<p>The AUROC (Area Under the Receiver Operating Characteristic Curve) metric evaluates a binary classifier&#8217;s performance. It measures the area under the ROC curve, which plots the true positive rate against the false positive rate at various threshold settings. A higher AUROC indicates better model discrimination between classes.</p>



<p>For more details about Anomalib metrics <a href="https://anomalib.readthedocs.io/en/latest/markdown/guides/reference/metrics/index.html" target="_blank" rel="noreferrer noopener">here</a>.</p>



<h2>Export model to OpenVINO</h2>



<p>We can export the model to OpenVINO for faster inference on Intel hardware.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
openvino_model_path = engine.export(
        model=model,
        export_type=ExportType.OPENVINO,
        export_root=r&quot;F:\demo\anomalydetection\models&quot;,  # OpenVINO model will be saved here
        ckpt_path=r&quot;F:\demo\anomalydetection\results\Padim\MVTec\bottle\v0\weights\lightning\model.ckpt&quot;,
    )
print(f&quot;OpenVINO Model saved to {str(openvino_model_path)}&quot;)
</pre></div>


<p>The OpenVINO model will be exported to &#8220;F:\demo\anomalydetection\models&#8221; directory.</p>



<p>Full source code of OpenVINO export <a href="https://github.com/rupeshs/anomalydetection/blob/main/ov_export.py" target="_blank" rel="noreferrer noopener">here (ov_export.py)</a>.</p>



<h2>OpenVINO model inference</h2>



<p>Now we do inference on saved model as shown below:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
from typing import Any

from anomalib import TaskType
from anomalib.data.utils import read_image
from anomalib.deploy import OpenVINOInferencer
from anomalib.utils.visualization.image import ImageVisualizer, VisualizationMode
from PIL import Image


def get_predictions(
    image_path: str,
    metadata_path: str,
    model_path: str,
) -&gt; Any:
    image = read_image(path=image_path)
    inferencer = OpenVINOInferencer(
        path=model_path,  # Path to the OpenVINO IR model.
        metadata=metadata_path,  # Path to the metadata file.
        device=&quot;CPU&quot;,
    )
    predictions = inferencer.predict(image=image)
    return predictions

</pre></div>


<p>The get_predictions functions will predict the result. Let&#8217;s test a broken bottle image.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
if __name__ == &quot;__main__&quot;:
    predictions = get_predictions(
        r&quot;F:\demo\mvtec_anomaly_detection\bottle\test\broken_large\000.png&quot;,
        r&quot;F:\demo\anomalydetection\models\weights\openvino\metadata.json&quot;,
        r&quot;F:\demo\anomalydetection\models\weights\openvino\model.bin&quot;,
    )

</pre></div>


<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="405" src="https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_broken-1-1024x405.jpg" alt="Model dected anomalous image" class="wp-image-6155" srcset="https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_broken-1-1024x405.jpg 1024w, https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_broken-1-300x119.jpg 300w, https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_broken-1-768x304.jpg 768w, https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_broken-1-150x59.jpg 150w, https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_broken-1.jpg 1263w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>From the above, we can see that the image is <strong>anomalous(82%</strong>) in nature. Finally, test a normal image.</p>



<figure class="wp-block-image size-large"><img loading="lazy" width="1024" height="408" src="https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_normal-1024x408.jpg" alt="Model dected normal image" class="wp-image-6158" srcset="https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_normal-1024x408.jpg 1024w, https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_normal-300x120.jpg 300w, https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_normal-768x306.jpg 768w, https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_normal-150x60.jpg 150w, https://nolowiz.com/wp-content/uploads/2024/06/anomaly_detection_normal.jpg 1254w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>Full source code of the OpenVINO inference and visualization <a href="https://github.com/rupeshs/anomalydetection/blob/main/ov_infer.py" target="_blank" rel="noreferrer noopener">here (ov_infer.py)</a>.</p>



<h2>Conclusion</h2>



<p>In conclusion, using anomalib we can easily create anomaly detection model. OpenVINO inference helps to speed up inference on intel hardware. The full source code is available as a <a href="https://github.com/rupeshs/anomalydetection" target="_blank" rel="noreferrer noopener">GitHub repo please check it out</a>.</p>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fanomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide%2F&amp;linkname=Anomaly%20Detection%20Using%20Anomalib%20and%20OpenVINO%20%E2%80%93%20Step%20by%20Step%20by%20Guide" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fanomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide%2F&amp;linkname=Anomaly%20Detection%20Using%20Anomalib%20and%20OpenVINO%20%E2%80%93%20Step%20by%20Step%20by%20Guide" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fanomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide%2F&amp;linkname=Anomaly%20Detection%20Using%20Anomalib%20and%20OpenVINO%20%E2%80%93%20Step%20by%20Step%20by%20Guide" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fanomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide%2F&amp;linkname=Anomaly%20Detection%20Using%20Anomalib%20and%20OpenVINO%20%E2%80%93%20Step%20by%20Step%20by%20Guide" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fanomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide%2F&#038;title=Anomaly%20Detection%20Using%20Anomalib%20and%20OpenVINO%20%E2%80%93%20Step%20by%20Step%20by%20Guide" data-a2a-url="https://nolowiz.com/anomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide/" data-a2a-title="Anomaly Detection Using Anomalib and OpenVINO – Step by Step by Guide"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/anomaly-detection-using-anomalib-and-openvino-step-by-step-by-guide/">Anomaly Detection Using Anomalib and OpenVINO &#8211; Step by Step by Guide</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to rebase the GitHub pull request</title>
		<link>https://nolowiz.com/how-to-rebase-the-github-pull-request/</link>
		
		<dc:creator><![CDATA[Rupesh Sreeraman]]></dc:creator>
		<pubDate>Thu, 06 Jun 2024 14:44:46 +0000</pubDate>
				<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://nolowiz.com/?p=6085</guid>

					<description><![CDATA[<p>In this short tutorial, you will learn how to rebase a GitHub pull request. For this demo, I&#8217;m using the OpenVINO repository. This method can be used when you already created PR in GitHub and it is out of sync with the master. Clone a copy of your repository and run the following command : ... <a title="How to rebase the GitHub pull request" class="read-more" href="https://nolowiz.com/how-to-rebase-the-github-pull-request/" aria-label="More on How to rebase the GitHub pull request">Read more</a></p>
<p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-rebase-the-github-pull-request/">How to rebase the GitHub pull request</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this short tutorial, you will learn how to rebase a GitHub pull request.</p>



<p>For this demo, I&#8217;m using the <a href="https://github.com/openvinotoolkit/openvino" target="_blank" rel="noreferrer noopener">OpenVINO</a> repository. This method can be used when you already created PR in GitHub and it is out of sync with the master. Clone a copy of your repository and run the following command :</p>



<pre class="wp-block-code"><code>git remote add upstream https://github.com/openvinotoolkit/openvino.git</code></pre>



<p><code><strong>remote</strong></code>: A subcommand used to manage set of repositories tracked by your local repository.</p>



<p><code><strong>add</strong></code>: Adds a new remote repository.</p>



<p><code><strong>upstream</strong></code>: The name given to the new remote repository. This is a common convention, often used to refer to the original repository(OpenVINO) from which a fork was created.</p>



<p>Typically, the above command is used in the context of working with forks. For example, if you have forked the OpenVINO repository to your own GitHub account and cloned it to your local machine, you would use this command to keep track of the original OpenVINO repository (referred to as <code>upstream</code>) so you can pull in the latest changes from the original project.</p>



<p>Next, run the following command :</p>



<pre class="wp-block-code"><code>git fetch upstream</code></pre>



<p>The command <code>git fetch upstream</code> is used in Git to fetch updates from a remote repository named <code>upstream</code>. </p>



<p>When you execute <code>git fetch upstream</code>, Git will:</p>



<ol><li>Connect to the remote repository named <code>upstream</code>.</li><li>Download any changes (commits, branches, tags, etc.) that have been made in the <code>upstream</code> repository since you last fetched.</li><li>Update your local repository&#8217;s remote-tracking branches for <code>upstream</code>, typically <code>upstream/master</code>, <code>upstream/develop</code>, etc.</li></ol>



<p>Now &#8220;checkout&#8221; your feature branch  <strong>onnx-fe-bitwise-not </strong>:</p>



<pre class="wp-block-code"><code>git checkout onnx-fe-bitwise-not</code></pre>



<p>Now rebase with upstream/master :</p>



<pre class="wp-block-code"><code>git rebase upstream/master</code></pre>



<p>When you run <code>git rebase upstream/master</code>, Git will:</p>



<ol><li>Fetch the latest changes from the <code>upstream</code> remote repository&#8217;s <code>master</code> branch (if you haven&#8217;t already).</li><li>Move the base of your current branch to the tip of the <code>upstream/master</code> branch.</li><li>Replay (reapply) your local commits on top of the <code>upstream/master</code> branch.</li></ol>



<p>Finally, we can push the changes and update the MR.</p>



<pre class="wp-block-code"><code>git push origin onnx-fe-bitwise-not --force</code></pre>



<figure class="wp-block-image size-full"><img loading="lazy" width="715" height="710" src="https://nolowiz.com/wp-content/uploads/2024/06/feature2.png" alt="Github branch after rebase" class="wp-image-6093" srcset="https://nolowiz.com/wp-content/uploads/2024/06/feature2.png 715w, https://nolowiz.com/wp-content/uploads/2024/06/feature2-300x298.png 300w, https://nolowiz.com/wp-content/uploads/2024/06/feature2-150x149.png 150w, https://nolowiz.com/wp-content/uploads/2024/06/feature2-120x120.png 120w, https://nolowiz.com/wp-content/uploads/2024/06/feature2-96x96.png 96w" sizes="(max-width: 715px) 100vw, 715px" /><figcaption>After rebasing the c3 and c4 commits in the feature branch moved to tip of the main branch as c3&#8242; and c4&#8242;</figcaption></figure>
<p><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-rebase-the-github-pull-request%2F&amp;linkname=How%20to%20rebase%20the%20GitHub%20pull%20request" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-rebase-the-github-pull-request%2F&amp;linkname=How%20to%20rebase%20the%20GitHub%20pull%20request" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-rebase-the-github-pull-request%2F&amp;linkname=How%20to%20rebase%20the%20GitHub%20pull%20request" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_copy_link" href="https://www.addtoany.com/add_to/copy_link?linkurl=https%3A%2F%2Fnolowiz.com%2Fhow-to-rebase-the-github-pull-request%2F&amp;linkname=How%20to%20rebase%20the%20GitHub%20pull%20request" title="Copy Link" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fnolowiz.com%2Fhow-to-rebase-the-github-pull-request%2F&#038;title=How%20to%20rebase%20the%20GitHub%20pull%20request" data-a2a-url="https://nolowiz.com/how-to-rebase-the-github-pull-request/" data-a2a-title="How to rebase the GitHub pull request"></a></p><p>The post <a rel="nofollow" href="https://nolowiz.com/how-to-rebase-the-github-pull-request/">How to rebase the GitHub pull request</a> appeared first on <a rel="nofollow" href="https://nolowiz.com">NoloWiz</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
