<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Stanley Lam on Medium]]></title>
        <description><![CDATA[Stories by Stanley Lam on Medium]]></description>
        <link>https://medium.com/@stanleylam909?source=rss-80c1a0309893------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4MyJOUqrUGV0jobLUqh6-Q.jpeg</url>
            <title>Stories by Stanley Lam on Medium</title>
            <link>https://medium.com/@stanleylam909?source=rss-80c1a0309893------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 09:14:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stanleylam909/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From Clicks to Thoughts: Apple’s First Step Toward a New Interface Era]]></title>
            <link>https://medium.com/design-bootcamp/from-clicks-to-thoughts-apples-first-step-toward-a-new-interface-era-7a0b115f0491?source=rss-80c1a0309893------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a0b115f0491</guid>
            <category><![CDATA[neuroscience]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Stanley Lam]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 14:49:50 GMT</pubDate>
            <atom:updated>2026-04-19T12:28:04.023Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A diagram illustrating the BCI HID interfacing Apple device with BCI device" src="https://cdn-images-1.medium.com/max/1024/1*Jm90GGqVhs9szmeYEyXZfw.png" /></figure><p>gImagine unlocking your phone, sending a message, or browsing apps without touching a screen, speaking, or even moving. Just by thinking.</p><p>This idea has lived in science fiction for decades, but it is now quietly becoming real. Apple has introduced a way for brain-computer interfaces (BCIs) to connect directly to devices like the iPhone and iPad, turning brain activity into actual interactions with software. (<a href="https://developer.apple.com/documentation/accessibility/brain-computer-interface-hid-reference-for-connecting-to-apple-platforms?changes=_9#Report-ID-3-BCI-input-pointer-report">Apple BCI HID</a>)</p><h3>What It Means to “Control a Device With Your Brain”</h3><p>A brain-computer interface is, at its core, a communication bridge. It creates a direct link between your brain’s neural activity and a computer, allowing signals from your brain to be interpreted as actions.</p><p>Normally, interacting with technology requires translation. You think of something, then your body converts that thought into movement, speech, or gestures. A BCI removes that intermediary step. It allows the system to listen directly to patterns in your brain and interpret what you intend to do.</p><p>In practice, this can look surprisingly simple. Someone might focus on a specific icon and select it, or imagine moving their hand and watch a cursor glide across a screen. What feels abstract at first quickly becomes intuitive, because the system is no longer responding to your body , it’s responding to your intention.</p><p>In recent demonstrations, people living with severe paralysis have been able to navigate tablets, open apps, and communicate using only their brain activity. (<a href="http://medium.com/r?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DYK8r5vdpozA%26utm_source%3Dchatgpt.com">Synchron’s commercial</a>)</p><p>For someone who cannot move or speak, this is not just technological progress. It is a restoration of independence. It is the ability to interact with the world again.</p><p>And historically, technologies that begin as accessibility tools often expand far beyond their original purpose. Touchscreens and voice assistants followed this path. Brain interfaces may be next.</p><h3>Why This Matters</h3><p>Every major leap in computing has been driven by a new way of interacting with machines. The command line made computers programmable. The mouse made them visual. Touchscreens made them intuitive. Voice made them conversational.</p><p>Brain interfaces introduce something different. They move interaction closer to thought itself.</p><p>This could make technology faster and more natural to use, not because devices are changing, but because the barrier between intention and action is shrinking. It also opens possibilities beyond screens, especially in areas like augmented reality, where traditional input methods are limited.</p><p>At the same time, the impact on accessibility cannot be overstated. For people who cannot rely on movement or speech, BCIs offer a direct channel to communicate and interact. What begins as assistive technology often becomes universal, and brain interfaces may follow that same trajectory.</p><h3>Before BCI HID: not first-class citizen</h3><p>Before Apple introduced a dedicated BCI HID interface, it was already technically possible to connect a brain-computer interface to Apple devices, but in a less native way. Most systems had to emulate standard input devices through the Human Interface Device (HID) protocol, effectively pretending to be a keyboard, mouse, or external switch. These inputs were then routed through accessibility features such as Switch Control, which interpret signals as navigation commands like “move to next item” or “select.”</p><p>In practice, this setup required several manual configuration. Each signal from the BCI had to be registered as a “switch,” mapped to a specific action, and tuned with parameters like scan speed and selection timing. Interaction was often constrained to a scanning interface, where the system cycles through on-screen elements and waits for a trigger to select one.</p><h3>Insight: Not All “Thought Control” Works the Same Way</h3><p>BCIs work in fundamentally different ways. Some BCI systems detects a brief signal when you notice something important, others tracks what you are continuously focusing on. And in some cases, it interprets signals you intentionally generate by imagining movement.</p><p>Regardless of how the signal is generated, the current BCI HID interface seems to treats all of these different signals in the same way: the output is ultimately translated into a small set of familiar actions like a click, a cursor movement, or a selection.</p><p>That simplicity is exactly what makes the system usable across apps and devices. But it also hints at a limitation. The brain doesn’t just produce discrete commands, but also rich, continuous information about intent, and mental state. When everything is reduced to a button press or a small cursor movement, much of that richness is compressed into a simpler form. The system captures what you <em>do</em>, but not always the full nuance of how your brain arrived there.</p><p>This leads to a subtle but important shift in perspective. Instead of thinking of BCIs as systems where the brain sends commands, it is more accurate to think of them as systems where the brain expresses intent, and the computer interprets it. Apple’s interface captures the result of that interpretation and makes it usable today, while quietly pointing toward a future where interfaces may begin to understand that intent more directly.</p><p>By taking the initiative to making brain signals compatible with existing systems, Apple has started to bridge the gap between lab experimentation and everyday technology. It has created a path for BCIs to move out of lab environments and into the broader ecosystem of apps and devices.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a0b115f0491" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/from-clicks-to-thoughts-apples-first-step-toward-a-new-interface-era-7a0b115f0491">From Clicks to Thoughts: Apple’s First Step Toward a New Interface Era</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I passed AWS Certified Solution Architect exam without spending a penny on resources]]></title>
            <link>https://aws.plainenglish.io/how-i-passed-aws-certified-solution-architect-exam-without-spending-a-penny-on-resources-a0b062421819?source=rss-80c1a0309893------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0b062421819</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws-certification]]></category>
            <dc:creator><![CDATA[Stanley Lam]]></dc:creator>
            <pubDate>Tue, 28 Oct 2025 07:05:47 GMT</pubDate>
            <atom:updated>2025-11-13T01:50:21.871Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*jVWp4iwlYo68HbBK" /></figure><h3>Background &amp; Motivation</h3><p>I’ve heard about this certification for a long time, especially back when cloud engineering was still on the rise about a decade ago. Some of my friends who took it said the <em>Practitioner</em> exam was too easy and suggested skipping straight to the <em>Associate</em> level, which I agree with. If there were no exam fees, there’d be no harm in taking the Practitioner first, but since there is, I don’t think it’s worth the extra cost. I had wanted to take this exam for quite some time, but other priorities, like grinding LeetCode and studying system design concepts, kept me occupied.</p><p>As I gained more hands-on experience with AWS and my understanding of system design, I finally decided to go for it when AWS ran a 50% off exam promotion. It felt like the right time.</p><h3>Study Resources</h3><h4>1. Coursera</h4><p><strong>Courses used:</strong></p><ul><li><em>AWS Fundamentals: Your First Steps into the Cloud</em></li><li><em>AWS Cloud Solutions Architect Professional Certificate</em></li></ul><p>These two Coursera programs cover most of the key concepts and services that appear on the exam. Unfortunately, Coursera no longer allows free auditing, so you’ll have to make the most of the 7-day trial, but it’s possible to complete the essentials within that window if you plan well.</p><h4>2. AWS Skill Builder Exam Prep Plan</h4><p><strong>Course:</strong> <em>AWS Certified Solutions Architect — Associate Exam Prep Plan</em></p><p>The free tier only provides access to the review section, but that’s honestly enough to understand what the exam will test you on. Since it’s the official prep resource, it’s both relevant and reliable.</p><h3>Practicing Is Key</h3><p>Practice questions are where the real learning happens. The more you do, the more you’ll start to recognize patterns in how AWS frames its questions and what details to focus on.</p><p>Here’s a solid (and free) practice resource:</p><p>👉 <a href="https://www.examtopics.com/exams/amazon/aws-certified-solutions-architect-associate-saa-c03/view/">ExamTopics AWS Solutions Architect — Associate (SAA-C03)</a></p><p>You can also use ChatGPT or Gemini to explain the reasoning behind each question. Both models are now capable of citing reliable sources, and I found their explanations surprisingly accurate.</p><p>If you’d like a more extensive mock exam question bank (around 800 questions), feel free to message me!</p><h3>Exam Strategy &amp; Time Management</h3><ul><li><strong>Time limit mindset:</strong> Aim to answer each question within <strong>two minutes</strong>.</li><li><strong>Scanning approach:</strong> After reading the question, quickly skim the differences between answer choices to identify key differentiators.</li><li><strong>Skip and return:</strong> Don’t get stuck on a single question — mark it and move on. You can revisit it later with a clearer head.</li></ul><h3>Study Tips</h3><p>When studying, categorize AWS services into broad types — <em>Compute, Storage, Networking, Security,</em> etc. Focus on the <strong>differentiators</strong> between services, like:</p><ul><li>Whether they’re <strong>serverless</strong> or not</li><li>Whether you have <strong>OS-level access</strong></li><li>Whether they’re <strong>fully managed</strong> or self-managed</li></ul><p>A solid grasp of <strong>networking fundamentals</strong> is also essential. I highly recommend revisiting this quick refresher:</p><p>👉 <a href="https://www.hellointerview.com/learn/system-design/core-concepts/networking-essentials">Networking Essentials by HelloInterview</a></p><p><strong>Bonus tip:</strong> AWS offers a <strong>30-minute extra time accommodation</strong> for non-native English speakers — definitely take advantage of it if applicable.</p><p>Once you pass the exam, you’ll also receive a <strong>50% discount coupon</strong> valid for the next three years, which is great if you plan to pursue further AWS certifications.</p><h3>Verdict</h3><p>So, is it easy?</p><p>With some cloud experience and a good understanding of how AWS services differ, it’s not a particularly difficult exam. I’d encourage anyone, especially those looking for junior or entry-level cloud roles to take it. It’s a strong way to show employers that you have a practical foundation in cloud concepts and solution architecture.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0b062421819" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/how-i-passed-aws-certified-solution-architect-exam-without-spending-a-penny-on-resources-a0b062421819">How I passed AWS Certified Solution Architect exam without spending a penny on resources</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting Facial Action Units in Real-Time: Which Tool Works Best?]]></title>
            <link>https://medium.com/@stanleylam909/detecting-facial-action-units-in-real-time-which-tool-works-best-3478184f1922?source=rss-80c1a0309893------2</link>
            <guid isPermaLink="false">https://medium.com/p/3478184f1922</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[facial-recognition]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[emotion-recognition]]></category>
            <category><![CDATA[affective-computing]]></category>
            <dc:creator><![CDATA[Stanley Lam]]></dc:creator>
            <pubDate>Sat, 11 Oct 2025 05:56:13 GMT</pubDate>
            <atom:updated>2025-10-11T05:58:43.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*OqCujgXwhSLRRbHiq3Trrg.png" /></figure><h3>Background</h3><p>I have been exploring ways to implement Facial Action Unit (FAU) detection in real time on a local device for my affective computing research. My goal was not just to use a standalone detection tool. I needed something that could be integrated into a larger application I am building.</p><p>I focused only on open-source models because I wanted full control over the system, the ability to run it locally without licensing restrictions, and the flexibility to modify the code as needed. Proprietary tools or cloud APIs were not suitable for my needs.</p><p>Another important consideration was user privacy. Since the video itself is not recorded and only the FAU data is captured, this approach provides better privacy protection for participants or users while still enabling meaningful affective analysis.</p><p>FAUs, which represent specific facial muscle movements such as raising an eyebrow or smiling, are very useful for understanding emotions, engagement, or attention in real time. I wanted a solution that could feed these signals directly into my app, allowing for live analysis rather than just offline processing.</p><p>In this article, I will share the models I tested and my experiences with them, highlighting both their strengths and limitations for integrated, real-time use.</p><h3>Comparison of FAU Detection Models</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*97cr-nQesyFbHHEXVMBGsw.png" /></figure><h3>OpenFace 3.0</h3><p><a href="https://github.com/CMU-MultiComp-Lab/OpenFace-3.0">OpenFace 3.0</a> is the latest iteration of the widely used facial behavior analysis toolkit. While the paper mentions <strong>26 FAUs</strong>, the demo scripts (e.g., demo2.py) only output <strong>8 FAUs</strong>:</p><ul><li><strong>AU1</strong> — Inner Brow Raiser</li><li><strong>AU2</strong> — Outer Brow Raiser</li><li><strong>AU4</strong> — Brow Lowerer</li><li><strong>AU6</strong> — Cheek Raiser</li><li><strong>AU9</strong> — Nose Wrinkler</li><li><strong>AU12</strong> — Lip Corner Puller</li><li><strong>AU25</strong> — Lips Part</li><li><strong>AU26</strong> — Jaw Drop</li></ul><p>Several users have raised issues in the OpenFace GitHub repository regarding support for accessing the full set of FAUs. OpenFace 3.0 offers arguably the most accurate landmark detection and AU analysis, it would be great if the maintainers could expand support for the full set of FAUs in future releases.</p><h3>OpenFace 2.2</h3><p>Relatively older (released in 2016 and last updated in 2019), <a href="https://github.com/TadasBaltrusaitis/OpenFace">OpenFace 2.2</a> is fast and capable of <strong>18 FAU intensities at 30 FPS</strong>.</p><p>Unlike some other tools, OpenFace 2.2 <strong>does not provide a Python API</strong>. To use it, you need to <strong>download the executable</strong> for your operating system and run it either on single images, folders of images, or video files. You can then access the results, such as AU intensities and landmarks, via the output CSV files. This approach is straightforward and works reliably, even though it does not allow direct Python function calls like some other libraries.</p><p>Here’s an example Python snippet to run FAU extraction with webcam and export into a csv using the executable:</p><pre>import os, time, subprocess<br>from pathlib import Path<br><br># Point to your OpenFace 2.2 install<br>FEATURE_EXE = Path(r&quot;C:\Program Files\OpenFace_2.2.0_win_x64\OpenFace_2.2.0_win_x64\FeatureExtraction.exe&quot;)<br>OPENFACE_DIR = FEATURE_EXE.parent<br><br># Choose where CSVs should be written<br>session_dir = r&quot;C:\Users\ARCLP\Documents\Code\experiment\openface_out\demo_session&quot;<br>os.makedirs(session_dir, exist_ok=True)<br><br># (Optional) save a session start epoch for later alignment<br>with open(os.path.join(session_dir, &quot;session_start_epoch.txt&quot;), &quot;w&quot;, encoding=&quot;utf-8&quot;) as f:<br>    f.write(str(time.time()))<br><br># Launch OpenFace (CSV will be saved automatically into session_dir)<br>args = [<br>    str(FEATURE_EXE),<br>    &quot;-device&quot;, &quot;0&quot;,           # pick your camera index<br>    &quot;-out_dir&quot;, session_dir,  # where CSV/visuals go<br>    &quot;-pose&quot;, &quot;-gaze&quot;, &quot;-aus&quot;, # which features to compute<br>]<br>proc = subprocess.Popen(args, cwd=str(OPENFACE_DIR))<br><br># ... run your experiment / wait for some time ...<br>time.sleep(10)<br><br># Stop when done<br>proc.terminate()</pre><p>This outputs a CSV containing AU intensities (_r) and AU presence (_c) along with landmarks and head pose.</p><h3>LibreFace</h3><p><a href="https://github.com/ihp-lab/LibreFace/tree/main">LibreFace</a> provides a Python API that supports processing static images or video files via libreface.get_facial_attributes(...). However, it currently lacks native support for real-time webcam streaming.</p><p>The developers note that real-time inference is possible via OpenSense, which wraps LibreFace into a zero-code pipeline:</p><ul><li>OpenSense components allow other modules to use LibreFace in real-time.</li><li>Example pipeline available: <a href="https://github.com/ihp-lab/OpenSense/releases/download/3.2.0/20230825__LibreFace__Injector__AzureKinect.pipe.json">OpenSense LibreFace injector</a>.</li></ul><p>⚠️ OpenSense operates as a standalone tool, which makes it unsuitable for integrating the FAU detection into my application</p><h3>Py-Feat</h3><p><a href="https://py-feat.org/pages/intro.html">Py-Feat</a> is ideal for <strong>offline analysis</strong> of images or video sequences. It offers:</p><ul><li>Detection of 20 AUs</li><li>Emotion recognition, head pose, and landmark extraction</li><li>Flexible Python API for research pipelines</li></ul><p>💡 Limitation: Py-Feat is slow for real-time inference, making it less practical for live streaming unless frame skipping is applied.</p><h3>Closing Thoughts</h3><ul><li>For <strong>integration into larger applications</strong>, OpenFace 2.2 remains the most practical choice due to its speed and reliable Python subprocess interface.</li><li>Py-Feat is excellent for offline experiments and research pipelines, while LibreFace via OpenSense enables real-time streaming but may be cumbersome for direct integration.</li><li>Given your hardware setup, GPU power, and how your app is built — do you think there’s still a need to fine-tune or build new real-time models for faster, local FAU detection? I’d love to hear what others have tried.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3478184f1922" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run a Diffusion Model Locally (without ComfyUI) — Using Qwen-Image-Edit with Nunchaku]]></title>
            <link>https://blog.cubed.run/how-to-run-a-diffusion-model-locally-without-comfyui-using-qwen-image-edit-with-nunchaku-4c0621343cd0?source=rss-80c1a0309893------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c0621343cd0</guid>
            <category><![CDATA[hugging-face]]></category>
            <category><![CDATA[stable-diffusion]]></category>
            <category><![CDATA[model-quantization]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-image-generator]]></category>
            <dc:creator><![CDATA[Stanley Lam]]></dc:creator>
            <pubDate>Thu, 02 Oct 2025 02:11:25 GMT</pubDate>
            <atom:updated>2025-10-15T23:46:35.618Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Run a Diffusion Model Locally (without ComfyUI) — Using Qwen-Image-Edit with Nunchaku</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fzIZODf1r-bEvOr9w-wOnw.png" /></figure><h3>Background</h3><p>I’ve been experimenting with image generation models and wanted to run them <strong>locally</strong> on my own hardware. My laptop setup is:</p><ul><li><strong>Intel Ultra 9 32GB RAM</strong></li><li><strong>NVIDIA RTX 4080 12GB VRAM</strong></li></ul><p>The key challenge? Most tutorials online point to <strong>ComfyUI</strong>, which is great for tinkering, but I only needed the <strong>generation pipeline</strong> to integrate directly into my application. That’s when I started exploring <strong>quantized diffusion models</strong> and tools like <strong>Nunchaku</strong>.</p><p>In this post, I’ll walk through a bit of background on quantized models, explain why Nunchaku is useful compared to the current Hugging Face API, and then show the exact steps I used to run <strong>Qwen-Image-Edit</strong> locally on my laptop.</p><h3>Quantization Models</h3><p>Diffusion models are notoriously heavy — often tens of gigabytes in full precision. Running a full model locally can be a pain if you don’t have enterprise GPUs.</p><p>That’s where <strong>quantization</strong> comes in. Instead of storing every weight at full 16/32-bit precision, quantized models compress them down (e.g. 4-bit, 5-bit) while keeping most of the performance intact.</p><ul><li>✅ Saves VRAM and RAM</li><li>✅ Runs faster on consumer GPUs</li><li>⚠️ Slight trade-off in fidelity</li></ul><p>On Hugging Face, you’ll often see these models in <strong>GGUF format</strong> (a general quantization format popularized by llama.cpp for LLMs, but now adopted for vision models too).</p><p>So instead of running a full 20GB model, you can load a quantized GGUF model and still get high-quality image outputs.</p><h3>Why Nunchaku?</h3><p>Hugging Face’s <strong>Diffusers</strong> library has recently added GGUF support, but there are still limitations:</p><ul><li>Pipelines like StableDiffusionPipeline <strong>don’t support quantized checkpoints yet</strong>.</li><li>You often have to manually stitch together encoders, decoders, and the UNet.</li></ul><p>While Diffusers technically lets you run GGUF models by manually loading components with from_single_file, you’d also need to handle the VAE, text encoder, and scheduler yourself — and write the sampling loop. This works, but in practice it’s cumbersome if all you want is quick local inference.</p><p>This is where <a href="https://nunchaku.tech/docs/nunchaku/index.html"><strong>Nunchaku</strong></a> comes in. It’s designed for <strong>running quantized diffusion models locally</strong> with optimized CUDA kernels. Think of it as the missing link: it fills the gap between “nice quantized weights on Hugging Face” and actually running them in a local pipeline.</p><h3>Implementation: Running Qwen-Image-Edit Locally</h3><p>Here’s a minimal setup I used to get <strong>Qwen-Image-Edit</strong> running with Nunchaku.</p><h3>1. Install Nunchaku</h3><p>Follow the official installation guide: <a href="https://nunchaku.tech/docs/nunchaku/installation/installation.html">Nunchaku Installation</a>. Make sure to <strong>match your PyTorch version, Python version, and platform</strong> (Windows/Linux, CUDA version).</p><h3>2. Download the Quantized Model</h3><p>Go to Hugging Face and download the<strong> </strong>quantized model<strong> </strong><a href="https://huggingface.co/nunchaku-tech"><strong>provided by Nunchaku</strong></a> for Qwen-Image-Edit.</p><p>When choosing the model, there are several parameters to consider. The <strong>r128</strong> model provides higher output quality than <strong>r32</strong>, though it runs slower. For users with <strong>non-Blackwell GPUs</strong> (pre-RTX 50 series), its is recommend downloading the <strong>in4</strong> variant. Those with <strong>Blackwell GPUs </strong>(50s-series) should select the <strong>fp4</strong> model for optimal performance. The <strong>4-step</strong> models generate results faster, whereas the <strong>8-step</strong> models provide smoother, more refined edits.</p><p>⚠ <strong>Important:</strong> Be careful <strong>not to download a quantized model that was developed by another party</strong> — it may be incompatible with Nunchaku.</p><h3>3. Run the Model in Python</h3><p><strong>Note:</strong> The following code snippet is provided directly from the <a href="https://nunchaku.tech/docs/nunchaku/usage/basic_usage.html">Nunchaku documentation</a>.</p><p>The two major parameters to consider when running inference are the number of steps and the CFG scale. Make sure the <strong>inference steps</strong> match the <strong>step count</strong> of the model you downloaded (e.g., 4-step or 8-step) for optimal performance. Increasing the <strong>CFG scale</strong> can improve alignment with the text prompt but may also slow down the generation process.</p><pre>import torch<br>from diffusers import QwenImageEditPipeline<br>from diffusers.utils import load_image<br><br>from nunchaku import NunchakuQwenImageTransformer2DModel<br>from nunchaku.utils import get_gpu_memory, get_precision<br><br># Replace with your file path of the model<br>transformer = NunchakuQwenImageTransformer2DModel.from_pretrained(<br>    f&quot;nunchaku-tech/nunchaku-qwen-image-edit/svdq-int4_r32-qwen-image-edit.safetensors&quot;<br>)<br><br>pipeline = QwenImageEditPipeline.from_pretrained(<br>    &quot;Qwen/Qwen-Image-Edit&quot;, transformer=transformer, torch_dtype=torch.bfloat16<br>)<br><br>if get_gpu_memory() &gt; 18:<br>    pipeline.enable_model_cpu_offload()<br>else:<br>    # use per-layer offloading for low VRAM. This only requires 3-4GB of VRAM.<br>    transformer.set_offload(<br>        True, use_pin_memory=False, num_blocks_on_gpu=1<br>    )  # increase num_blocks_on_gpu if you have more VRAM<br>    pipeline._exclude_from_cpu_offload.append(&quot;transformer&quot;)<br>    pipeline.enable_sequential_cpu_offload()<br><br>image = load_image(&quot;https://huggingface.co/datasets/nunchaku-tech/test-data/resolve/main/inputs/neon_sign.png&quot;)<br>image = image.convert(&quot;RGB&quot;)<br>prompt = &quot;change the text to read &#39;双截棍 Qwen Image Edit is here&#39;&quot;<br>inputs = {<br>    &quot;image&quot;: image,<br>    &quot;prompt&quot;: prompt,<br>    &quot;true_cfg_scale&quot;: 4.0,<br>    &quot;negative_prompt&quot;: &quot; &quot;,<br>    &quot;num_inference_steps&quot;: 10, # match the number of steps with your downloaded model<br>}<br><br>output = pipeline(**inputs)<br>output_image = output.images[0]<br>output_image.save(f&quot;qwen-image-edit-r{rank}.png&quot;)</pre><p>And that’s it — you’re editing images locally with a quantized diffusion model, without ever opening ComfyUI.</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c0621343cd0" width="1" height="1" alt=""><hr><p><a href="https://blog.cubed.run/how-to-run-a-diffusion-model-locally-without-comfyui-using-qwen-image-edit-with-nunchaku-4c0621343cd0">How to Run a Diffusion Model Locally (without ComfyUI) — Using Qwen-Image-Edit with Nunchaku</a> was originally published in <a href="https://blog.cubed.run/">Cubed</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>