<?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 Momin Aman on Medium]]></title>
        <description><![CDATA[Stories by Momin Aman on Medium]]></description>
        <link>https://medium.com/@mominaman?source=rss-f123689882fe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QkCeXg7jXr76MXru</url>
            <title>Stories by Momin Aman on Medium</title>
            <link>https://medium.com/@mominaman?source=rss-f123689882fe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 07:39:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mominaman/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[Unity as a Library (UAAL) with SwiftUI — A Step-by-Step Guide]]></title>
            <link>https://medium.com/@mominaman/unity-as-a-library-swiftui-ios-786c4f58f1d7?source=rss-f123689882fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/786c4f58f1d7</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ar-development]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[augmented-reality]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Momin Aman]]></dc:creator>
            <pubDate>Sun, 10 Aug 2025 05:09:15 GMT</pubDate>
            <atom:updated>2025-08-10T05:09:15.144Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Unity as a Library (UAAL) with SwiftUI — A Step-by-Step Guide</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rl9SACziNgjXriXTetpZrg.png" /></figure><p>Integrating <strong>Unity as a Library (UaaL)</strong> into a native iOS app has always been a powerful way to merge Unity’s real-time 3D magic with the flexibility of Swift or SwiftUI, but with <strong>Unity 6</strong>, <strong>Xcode 16.4</strong>, and Apple’s latest toolchain, the process comes with a few quirks. In this guide, we’ll walk through exactly how to embed the <strong>default AR Mobile Core template</strong> from Unity into a fresh SwiftUI app, wire it up so Unity can be launched from your native UI, and make sure it runs smoothly on a physical iPhone. From building the Unity project, to setting up the workspace, embedding the Unity framework, adding permissions, and even enabling both <strong>native</strong> and <strong>C# script debugging</strong> over USB. This is the complete, step-by-step path to getting Unity and your native code working together without the guesswork.</p><p><strong>Source Code:</strong> You can find the complete Xcode UaaL host and Unity project here → <a href="https://github.com/MominAman/unity-as-a-library-ar-ios">github.com/MominAman/unity-as-a-library-ar-ios</a></p><p><em>Let’s dive right in. Here’s how to set it up from scratch.</em></p><h3>1) Build your Unity project for iOS</h3><ol><li>Open your Unity 6 project</li><li><strong>File → Build Profiles</strong> (or Build Settings) → select <strong>iOS</strong> and make it <strong>Active</strong>.</li><li>Add your scene(s) (e.g., <strong>SampleScene</strong>) to the <strong>Scene List</strong>.</li><li>In <strong>iOS Settings</strong>, <strong>Development/Debugging</strong> (Build Settings window):<br>- Check <strong>Development Build</strong> → enables debug symbols<br>- Check <strong>Script Debugging</strong> → Lets C# breakpoints work<br>- (Optional) <strong>Symlink Unity libraries</strong> → for faster rebuilds on your Mac.<br>- (Optional) <strong>Wait for Managed Debugger</strong> → check if you want the app to pause until the debugger attaches.</li><li>Click <strong>Build</strong></li><li>Choose a <strong>new, empty folder</strong>. After it finishes, that folder <strong>must</strong> contain, side-by-side:</li></ol><pre>Unity-iPhone.xcodeproj<br>Classes/<br>Libraries/<br>Data/<br>(plus a few other files)</pre><h3>2) Create a fresh native iOS app in Xcode (SwiftUI)</h3><p><strong>1.</strong> Open <strong>Xcode 16.4</strong> → <strong>File → New → Project…<br>2.</strong> Template: <strong>App</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5xOf7w5eMm2O8NOO" /></figure><p><strong>3. Interface</strong>: SwiftUI. <strong>Language</strong>: Swift.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Cn4MAhRiXlTF-xyi" /></figure><p><strong>4. </strong>Name it e.g. UaaLHostFinal. Create it somewhere tidy (outside the Unity build folder).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ij_04TgpJMr_W2rZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7pid3ZbhYyepjR2a" /></figure><h3>3) Make it a workspace (needed for embedding Unity)</h3><p><strong>1.</strong> In Finder, go to the folder containing your UaaLHostFinal.xcodeproj<br><strong>2. </strong>In Xcode, <strong>File → Save As Workspace</strong> (name it UaaLHostFinal.xcworkspace).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OdSTDT2l0i2V9ZoB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KWQo5pxNfF6NQsbu" /></figure><p><strong>3.</strong> Close the .xcodeproj tab in Xcode and from now on, always open the .xcworkspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HEQsF8ZlwqDao4AA" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/0*rt8oKEeaC-xc2ju0" /></figure><h3>4) Add the Unity project to your workspace by reference</h3><p><strong>1.</strong> In Xcode, open <strong>UaaLHostFinal.xcworkspace</strong>.<br><strong>2. </strong>File → Add Files<strong> to “UaaLHostFinal”…<br>3.</strong> Select the <strong>Unity‑iPhone.xcodeproj</strong> from your Unity <strong>build output folder</strong> (the folder from step 1 that has Classes/ and Libraries/ next to it).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Ml53ltwIJV_jICg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Wr4WKIomrVcX4kGb" /></figure><p><strong>4.</strong> In the dialog:</p><ul><li>Select <strong>“Reference files in place”</strong> in Action.</li><li>Targets list can be empty</li><li>Click <strong>Add</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rAzppic9-xJODaeo" /></figure><p><strong>5.</strong> In the Project Navigator, you should now see <strong>UaaLHostFinal</strong> and <strong>Unity‑iPhone</strong> <strong>side‑by‑side</strong> (top level), <strong>not</strong> nested inside each other.<br>Expanding <strong>Unity‑iPhone</strong> should show <strong>Classes/</strong> and <strong>Libraries/</strong> (not red).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aPB4htyJ2smLiECk" /></figure><h3>5) Embed UnityFramework in the host app</h3><p><strong>1.</strong> Select the <strong>UaaLHostFinal</strong> <strong>target</strong> → <strong>General</strong> tab.<br><strong>2.</strong> Frameworks, Libraries, and Embedded Content</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*A6vzxyjHP7y7wBAN" /></figure><ul><li>Click + → add UnityFramework.framework (pick it from Unity‑iPhone → Products).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yKDiiwCFp1zqk6Lr" /></figure><ul><li>In the Embed column, set it to Embed &amp; Sign.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BW-BL4cGdKsCg7Jw" /></figure><p><strong>3. </strong>Build Phases → Target Dependencies</p><ul><li>Click <strong>+</strong> → add <strong>UnityFramework</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r7KH_J28ld0Mj6-t" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MuStQcD-2RPF0xT5" /></figure><h3>6) Add Unity’s Data folder to the host app (as a blue folder)</h3><blockquote><em>This fixes the “global‑metadata.dat not found” / IL2CPP init failure.</em></blockquote><p><strong>1.</strong> Select the <strong>UaaLHostFinal</strong> project (left panel), and click <strong>Build Phases<br>2. </strong>Add Items to <strong>Copy Bundle Resources</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OdzMX0M0K4Fk4QIX" /></figure><p><strong>3.</strong> Click Add Other → Select the Data folder from your Unity build output (the same one next to Classes/Libraries).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*68PGKS72foWRn1zV" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O1XCR1WNJvHKoqis" /></figure><p><strong>4.</strong> In the dialog:</p><ul><li><strong>Added folders</strong> → <strong>Create folder references</strong> (so it becomes a <strong>blue</strong> folder)</li><li><strong>Copy items if needed → checked</strong> (safe so Xcode has its own copy)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F6a67KzvfvoaesWt" /></figure><p><strong>5.</strong> Verify: UaaLHostFinal target → Build Phases → Copy Bundle Resources shows one row: Data (Folder).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f3RoMAj1LQ5rUQjv" /></figure><h3>7) Add the Objective‑C launcher (with a Swift bridging header)</h3><p>We’ll create two files and accept Xcode’s bridging header prompt.</p><h4>7.1 Create UnityLauncher.m (Objective‑C file)</h4><ul><li>File → New → File from template → Objective-C File</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*jyptT69PDZJ16lR_" /></figure><ul><li>Name: UnityLauncher.m and File Type: Empty File</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*SNmznMwcXh8H4PLK" /></figure><ul><li>When Xcode asks to create a bridging header, click Yes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2L03y86Rljt1vWMR" /></figure><ul><li>Paste this entire implementation in UnityLauncher.m:</li></ul><pre>//<br>//  UnityLauncher.m<br>//  UaaLHost<br>//<br>//  Bootstraps UnityFramework inside the host app and exposes a simple<br>//  Objective-C API that we can call from Swift/SwiftUI.<br>//<br><br>#import &lt;Foundation/Foundation.h&gt;<br>#import &lt;UIKit/UIKit.h&gt;<br>#import &lt;mach-o/dyld.h&gt; // &lt;&lt; fix: use _NSGetMachExecuteHeader()<br><br>// Minimal forward declarations so we don&#39;t need UnityFramework headers at compile time<br>@protocol UnityFrameworkListener @end<br><br>@interface UnityFramework : NSObject<br>+ (UnityFramework *)getInstance;<br>- (id)appController;<br>- (void)runEmbeddedWithArgc:(int)argc argv:(char * _Nullable * _Nullable)argv appLaunchOpts:(NSDictionary *)launchOpts;<br>- (void)showUnityWindow;<br>- (void)setDataBundleId:(const char *)bundleId;<br>- (void)setExecuteHeader:(void *)header;<br>- (void)registerFrameworkListener:(id&lt;UnityFrameworkListener&gt;)listener;<br>@end<br><br>// Forward declaration of Unity&#39;s app controller type to access rootViewController<br>@interface UnityAppController : UIResponder<br>@property (nonatomic, readonly) UIViewController *rootViewController;<br>@end<br><br>@interface UnityLauncher : NSObject &lt;UnityFrameworkListener&gt;<br>+ (instancetype)shared;<br>- (void)launchUnityIfNeeded;<br>- (void)showUnity;<br>- (UIViewController *)unityRootViewController;<br>@end<br><br>static UnityFramework *_ufw = nil;<br><br>@implementation UnityLauncher<br><br>+ (instancetype)shared {<br>    static UnityLauncher *instance = nil;<br>    static dispatch_once_t onceToken;<br>    dispatch_once(&amp;onceToken, ^{<br>        instance = [UnityLauncher new];<br>    });<br>    return instance;<br>}<br><br>- (UnityFramework *)loadUnityFramework {<br>    if (_ufw) return _ufw;<br><br>    // Load UnityFramework bundle from main app Frameworks/<br>    NSString *bundlePath = [[NSBundle mainBundle] bundlePath];<br>    NSString *ufwPath = [bundlePath stringByAppendingPathComponent:@&quot;Frameworks/UnityFramework.framework&quot;];<br>    NSBundle *ufwBundle = [NSBundle bundleWithPath:ufwPath];<br>    if (![ufwBundle isLoaded]) {<br>        [ufwBundle load];<br>    }<br><br>    Class ufwClass = [ufwBundle principalClass];<br>    if (!ufwClass) {<br>        NSLog(@&quot;[UaaL] Failed to get UnityFramework principal class&quot;);<br>        return nil;<br>    }<br><br>    UnityFramework *ufw = [ufwClass performSelector:@selector(getInstance)];<br>    if ([ufw appController] &amp;&amp; _ufw) {<br>        return _ufw;<br>    }<br><br>    // Use dyld API to fetch the main image header (index 0)<br>    const struct mach_header *execHdr = _dyld_get_image_header(0);<br>    [ufw setExecuteHeader:(void *)execHdr];<br><br>    const char *mainBundleId = [[[NSBundle mainBundle] bundleIdentifier] UTF8String];<br>    [ufw setDataBundleId:mainBundleId];<br>    [ufw registerFrameworkListener:self];<br><br>    _ufw = ufw;<br>    return ufw;<br>}<br><br>- (void)launchUnityIfNeeded {<br>    UnityFramework *ufw = [self loadUnityFramework];<br>    if (!ufw) return;<br><br>    if (![ufw appController]) {<br>        // Build argc/argv from current process arguments so Unity gets valid pointers<br>        NSArray&lt;NSString *&gt; *arguments = [NSProcessInfo processInfo].arguments;<br>        int argc = (int)arguments.count;<br>        char **argv = (char **)calloc((size_t)argc, sizeof(char *));<br>        for (int i = 0; i &lt; argc; ++i) {<br>            const char *utf8 = [arguments[i] UTF8String];<br>            argv[i] = strdup(utf8 ? utf8 : &quot;&quot;);<br>        }<br><br>        NSDictionary *launchOpts = @{};<br><br>        [ufw runEmbeddedWithArgc:argc argv:argv appLaunchOpts:launchOpts];<br><br>        // Clean up our temporary argv copy<br>        for (int i = 0; i &lt; argc; ++i) {<br>            free(argv[i]);<br>        }<br>        free(argv);<br>    }<br><br>    [ufw showUnityWindow];<br>}<br><br>- (void)showUnity {<br>    if (_ufw) {<br>        [_ufw showUnityWindow];<br>    } else {<br>        [self launchUnityIfNeeded];<br>    }<br>}<br><br>- (UIViewController *)unityRootViewController {<br>    UnityAppController *controller = (UnityAppController *)[_ufw appController];<br>    return controller.rootViewController;<br>}<br><br>#pragma mark - UnityFrameworkListener<br><br>- (void)unityDidUnload:(NSNotification *)notification {<br>    // Unity was unloaded; clear handle<br>    _ufw = nil;<br>}<br><br>@end</pre><h4>7.2 Create UnityLauncher.h (header)</h4><ul><li>File → New → File from Template → Header File → name UnityLauncher.h → target UaaLHostFinal.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/0*1y3YXYwWEUQ0d_DB" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/0*D61DZYf9NHZ-dpf_" /></figure><ul><li>Paste the following code in UnityLauncher.h:</li></ul><pre>//<br>//  UnityLauncher.h<br>//  UaaLHostFinal<br>//<br>//  Created by Momin Aman on 8/9/25.<br>//<br><br>#import &lt;Foundation/Foundation.h&gt;<br>#import &lt;UIKit/UIKit.h&gt;<br><br>NS_ASSUME_NONNULL_BEGIN<br><br>@interface UnityLauncher : NSObject<br>+ (instancetype)shared;<br>- (void)launchUnityIfNeeded;<br>- (void)showUnity;<br>- (UIViewController *)unityRootViewController;<br>@end<br><br>NS_ASSUME_NONNULL_END</pre><h4>7.3 Import the header in the Swift bridging header</h4><ul><li>Open <strong>UaaLHostFinal‑Bridging‑Header.h</strong> (Xcode created it when you added the .m file).</li><li>Add:</li></ul><pre>//<br>//  UaaLHostFinal-Bridging-Header.h<br>//<br><br>#import &quot;UnityLauncher.h&quot;</pre><h3>9) Call Unity from SwiftUI</h3><p>Open <strong>ContentView.swift</strong> and replace the view body with this simple button:</p><pre>//<br>//  ContentView.swift<br>//  UaaLHostFinal<br>//<br>//  Created by Momin Aman on 8/9/25.<br>//<br><br>import SwiftUI<br><br>struct ContentView: View {<br>    @State private var launched = false<br><br>    var body: some View {<br>        VStack(spacing: 16) {<br>            Text(&quot;UaaL Host&quot;)<br>                .font(.title)<br><br>            Button(launched ? &quot;Show Unity&quot; : &quot;Launch Unity&quot;) {<br>                if launched {<br>                    UnityLauncher.shared().showUnity()<br>                } else {<br>                    print(&quot;Launching Unity from SwiftUI...&quot;)<br>                    UnityLauncher.shared().launchUnityIfNeeded()<br>                    print(&quot;Unity launch call finished&quot;)<br>                    launched = true<br>                }<br>            }<br>            .buttonStyle(.borderedProminent)<br>        }<br>        .padding()<br>    }<br>}</pre><h3>10) Add the camera permission to the host app (not Unity‑iPhone)</h3><blockquote><em>This fixes the “This app has crashed because it attempted to access privacy‑sensitive data…” error.</em></blockquote><p><strong>1-</strong> Select the UaaLHostFinal target → Info tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qkwY0vvwOxMLdEBo" /></figure><p><strong>2-</strong> Add row</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MNqw48cVbkR5rL05" /></figure><p><strong>3-</strong> Privacy Camera Usage Description (NSCameraUsageDescription) Value: Camera needed for AR camera tracking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FUWV-MFwbZxL_mns" /></figure><blockquote>Feel free to add any more permissions here that you are using in Unity</blockquote><h3>11) Clean, install fresh, and run</h3><ol><li><strong>Product → Clean Build Folder</strong>.</li><li><strong>Delete the app from the device</strong> (important after Data changes).</li><li>Select a <strong>physical iPhone</strong>.</li><li><strong>Build &amp; Run</strong>.</li></ol><h3>12) App stuck due to the “Thread Performance Checker”</h3><p>If your app launches but gets stuck or freezes during Unity loading when running from Xcode:</p><ol><li>In Xcode, go to the top menu → Product → Scheme → Edit Scheme…</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b1xW0AXYM53iL7lV" /></figure><p>2. In the left panel, select Run → Diagnostics tab.<br>3. Uncheck: <br> • Thread Performance Checker (under Runtime API Checking) <br> • API Validation (under Metal)<br>4. Click <strong>Close</strong> and re-run the project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/0*YLbN98I-xJZKrwTv" /></figure><h3>13) Test native debugging (Xcode)</h3><p><strong>1.</strong> In Xcode, select your <strong>Run scheme</strong> for the host app (top toolbar).<br><strong>2.</strong> Go to <strong>Product → Scheme → Edit Scheme… → Run → Info</strong> and make sure:</p><ul><li><strong>Build Configuration</strong> = <strong>Debug</strong></li><li><strong>Debug executable</strong> is <strong>checked</strong></li></ul><p><strong>3.</strong> (If you followed our previous fix) In <strong>Run → Diagnostics</strong>, keep <strong>Thread Performance Checker</strong> (and Metal validation) <strong>off</strong>.<br><strong>4.</strong> <strong>Set a breakpoint</strong> in your glue code, e.g. UnityLauncher.m inside -launchUnityIfNeeded or -showUnity.<br><strong>5.</strong> <strong>Run on device</strong> from Xcode and tap your <strong>Launch Unity</strong> button.<br>You should <strong>hit the breakpoint</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*elg95GmrtzdBeK8Z" /></figure><h3>14) Unity C# Debugging over USB</h3><p><strong>1. One-time setup (only first time on your Mac)</strong></p><pre>brew install libimobiledevice  # only once</pre><blockquote>This installs iproxy, which we’ll use for USB port forwarding.</blockquote><p><strong>2. In Unity (before exporting/building iOS)</strong></p><ul><li><strong>Build Settings</strong> → iOS → enable:</li><li><strong>Development Build</strong></li><li><strong>Script Debugging</strong></li><li>(Optional but useful) → <strong>Wait For Managed Debugger</strong> (breakpoints in very early code (Awake/OnEnable) might be missed unless “<strong>Wait For Managed Debugger</strong>” is enabled for the first attach — then you can turn it off later.)</li></ul><p><strong>3. Build &amp; run to device from Xcode</strong></p><ul><li>Launch the app on the iPhone.</li><li>In Xcode’s console, confirm you see something like when you initiate the Unity library inside the native app:</li></ul><pre>Starting managed debugger on port 56000</pre><blockquote>(If it prints a different port, remember it — we’ll use it later.)</blockquote><p><strong>4. Start USB port-forward (on your Mac)</strong></p><p>In Terminal:</p><pre>pkill -f &quot;iproxy 56000&quot; || true   # clean any old forwards<br>iproxy 56000 56000</pre><ul><li>Keep this Terminal window open while debugging.</li><li>If 56000 is busy locally, use:</li></ul><pre>iproxy 56001 56000</pre><p><strong>6. Attach the debugger</strong></p><ul><li>Keep the app <strong>open in foreground</strong> on the iPhone.</li><li>In VS Code, press <strong>F5</strong> or <strong>Run → Start Debugging</strong>.</li><li>Breakpoints in your Unity C# scripts should now hit.</li></ul><p><strong>7. Troubleshooting</strong></p><ul><li>If it doesn’t connect, ensure:</li><li>The Unity log in Xcode shows the <strong>“Starting managed debugger…”</strong> line.</li><li>You start/restart iproxy <strong>after</strong> that line appears.</li><li>Kill any stale forwards with:</li></ul><pre>pkill -f iproxy</pre><blockquote>If needed, enable Wait For Managed Debugger in Unity so the app pauses and keeps the port open.</blockquote><p>With that, you now have Unity 6 running as a library inside a fully native SwiftUI app, built with Xcode 16.4 and powered by the AR Mobile Core template. You can launch Unity from native UI, pass data between Swift and C#, and debug both your native and managed code over USB, all without breaking your workflow.</p><p>From here, you can start customizing your AR experience, integrating platform-specific APIs, or refining performance for production. The UaaL pattern opens the door to blending the best of Unity’s rendering power with the polish of native iOS features, and now you’ve got the foundation to make it happen.</p><p><strong>Full project source:</strong> <a href="https://github.com/MominAman/unity-as-a-library-ar-ios">github.com/MominAman/unity-as-a-library-ar-ios</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=786c4f58f1d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Data to Doing: Welcome to the Era of Experience]]></title>
            <link>https://medium.com/@mominaman/welcome-to-the-era-of-experience-1542d255258b?source=rss-f123689882fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/1542d255258b</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[ai-research]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Momin Aman]]></dc:creator>
            <pubDate>Tue, 03 Jun 2025 22:07:07 GMT</pubDate>
            <atom:updated>2025-06-03T22:10:53.377Z</atom:updated>
            <content:encoded><![CDATA[<p>Why the next leap in AI won’t come from better data, but from better experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FRIk2lQwYl55-QcKIvhIvg.png" /></figure><p>We’ve trained models on nearly everything humans have ever written, said, or drawn. And it’s been astonishing that AI can now write essays, summarize books, debug code, and maybe even ace your college exam. But there’s a ceiling. A hard one. The kind you hit when the data well runs dry or when human knowledge itself becomes the limit.</p><p>Enter the <em>Era of Experience</em>.</p><p>In their <a href="https://storage.googleapis.com/deepmind-media/Era-of-Experience%20/The%20Era%20of%20Experience%20Paper.pdf">recent paper</a>, David Silver and Richard Sutton (yes, <em>that</em> Sutton of “<a href="http://www.incompleteideas.net/IncIdeas/BitterLesson.html">Bitter Lesson</a>” fame) argue that the next generation of AI won’t just learn from us, it will learn <em>like</em> us. Not by memorizing textbooks, but by exploring the world, making mistakes, adapting, and growing through trial and error. In short: experience.</p><p>This idea feels intuitive. After all, that’s how we learned to ride bikes, write code, or understand love. We didn’t read a million examples, we lived it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*t4wvi9iOiN20pqXsPZXerQ.png" /><figcaption><strong>A sketch chronology of dominant AI paradigms. The y-axis suggests the proportion of the field’s total effort and computation that is focused on RL</strong> (David Silver and Richard S. Sutton, 2025).</figcaption></figure><h4>Why Experience &gt; Imitation</h4><p>Much of today’s AI is trained on human data: Reddit threads, Wikipedia, news articles and StackOverflow posts. That’s been a powerful engine for generalization, but it also locks AI into the bounds of human knowledge. If no human has written it, AI can’t learn it.</p><p>But what if AI could learn from <em>its own</em> experience? Try things. Fail. Reflect. Try again.</p><p>We’ve already seen glimpses of this. AlphaZero mastered chess and Go not by studying grandmasters, but by playing itself millions of times. AlphaProof learned to solve Olympiad-level math problems by generating tens of millions of its own theorems and proofs. These agents didn’t just imitate, they discovered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sn9RzohHTIu8tguW_qgZKw.jpeg" /><figcaption><strong>In 2016, AlphaGo defeated world champion Lee Sedol in a five-game match watched by over 100 million people. It wasn’t just a victory in Go; it was a watershed moment for experiential learning in AI. </strong>Photograph by Ahn Young-joon / AP</figcaption></figure><h4>Four Ideas That Define the Era of Experience</h4><p>Silver and Sutton outline a bold shift. In this new era, agents will:</p><ul><li><strong>Learn from long, continuous streams of experience</strong>, not one-off interactions.</li><li><strong>Act and observe in grounded environments</strong>, not just text boxes.</li><li><strong>Learn from real-world feedback</strong>, not human ratings.</li><li><strong>Think beyond human language</strong>, using internal representations that make sense to them, not necessarily to us.</li></ul><p>It’s not just a technical shift. It’s a philosophical one. We’re moving from teaching machines <em>what</em> to know to helping them <em>learn how</em> to learn.</p><h4>Why This Matters (and What It Means for Us)</h4><p>This isn’t just a research direction, it’s a bet on autonomy. An AI that learns from experience won’t need a curated dataset. It won’t be limited by what humans know. It could discover strategies, theories, even truths we haven’t thought of yet.</p><p>Of course, that comes with real challenges: safety, alignment, and interpretability. But it also opens the door to something profoundly new.</p><p>We might be leaving the era of imitation and stepping into the age of discovery.</p><p><strong>What’s next?</strong> Maybe not bigger models, but braver ones. Not more data, but deeper doing. And maybe, just maybe, the most important breakthroughs in AI won’t come from studying us, but from living alongside us.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1542d255258b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Déjà Vu: Why Every Tech Revolution Feels Like This One]]></title>
            <link>https://medium.com/@mominaman/is-ai-a-bubble-efa3fc775fbe?source=rss-f123689882fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/efa3fc775fbe</guid>
            <category><![CDATA[creative-tools]]></category>
            <category><![CDATA[tech-history]]></category>
            <category><![CDATA[future-of-work]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology-and-society]]></category>
            <dc:creator><![CDATA[Momin Aman]]></dc:creator>
            <pubDate>Mon, 02 Jun 2025 18:41:35 GMT</pubDate>
            <atom:updated>2025-06-02T18:41:35.201Z</atom:updated>
            <content:encoded><![CDATA[<p>Everyone seems to be sprinting into the AI race. Startups are pivoting overnight, tech giants are burning billions on GPUs, and artists, engineers, and CEOs are asking the same anxious question: Is this real, or are we just caught in another hype cycle? The fear of missing out is loud. But so is the fear of being replaced. And beneath the buzzwords and breathless headlines, I can’t help but feel a strange sense of déjà vu.</p><p>We’ve seen this before. When the internet came, when film met CG, when music embraced Auto-Tune, and even when Kodak invented the digital camera, then buried it. In each case, the story was the same: bold innovation, public backlash, and a fork in the road between disruption and denial. So what if the AI moment isn’t just new? What if it’s a remix of every tech panic we’ve lived through?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*kaNeTiQKCTMaYmA_cWF7OA.jpeg" /></figure><h3>When AI Makes the Media: Magic or Misuse?</h3><p>When we talk about AI in media, it’s easy to get swept up in headlines about job-stealing robots or uncanny deepfakes. But beyond the panic, there have been moments genuinely emotional, human moments, where AI didn’t feel like a threat at all. It felt like magic.</p><p>Take <em>“</em><a href="https://www.youtube.com/watch?v=Opxhh9Oh3rg"><em>Now and Then</em></a><em>”</em>, the final Beatles song. The track began with a rough cassette demo recorded by John Lennon in the late ’70s. The quality was poor. For decades, it was impossible to separate his vocals cleanly enough to build around them. But thanks to AI audio separation tools developed by Peter Jackson’s team during the making of <a href="https://en.wikipedia.org/wiki/The_Beatles:_Get_Back"><em>The Beatles: Get Back</em></a> documentary, Lennon’s voice was isolated, crystal clear. It was as if he had stepped back into the studio one last time. Paul and Ringo were finally able to complete the song with him.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FAPJAQoSCwuA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DAPJAQoSCwuA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FAPJAQoSCwuA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/68e074f255a486fe836d2b4585050e04/href">https://medium.com/media/68e074f255a486fe836d2b4585050e04/href</a></iframe><p>That same AI-powered audio tech had already worked wonders on <em>Get Back</em>, where entire conversations were salvaged from noisy studio footage. Tools using machine learning were trained to distinguish vocals from instruments, separating layers in mono recordings that had been fused for over 50 years. It wasn’t just restoration, it was resurrection.</p><p>And it doesn’t stop at sound. Recently, AI has transformed how we see actors, too literally. De-aging, once an expensive, labor-intensive VFX process, can now be done faster, more convincingly, and at a fraction of the cost. AI startups like <a href="https://metaphysic.ai/"><strong>Metaphysic</strong></a> are building real-time facial re-aging and digital performance tools. What once took weeks of painstaking VFX work now happens in seconds and often looks better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cg5MCo3lQkHwjbPYYAG4YA.png" /><figcaption>A de-aged version of Tom Hanks from the 2024 film “Here.”</figcaption></figure><p>But for every headline that feels like progress, there’s another that raises eyebrows.</p><p><a href="https://www.vulture.com/article/the-brutalist-ai-controversy.html"><em>The Brutalist</em></a> faced backlash for using AI, especially during a time when animators and VFX workers were already striking for labor protections. What was meant as creative experimentation quickly became a lightning rod in the conversation around AI and authorship.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ifza5KLTlQiuP9eXCQkVw.png" /><figcaption>The Brutalist</figcaption></figure><p>Then there was <em>Fake Drake</em>. An AI-generated song that perfectly mimicked the vocals of Drake and The Weeknd went viral before being pulled down. Millions of listeners couldn’t tell the difference, and neither artist had consented. Similarly, <a href="https://www.youtube.com/watch?v=iqnBJHU7si4">Marvel’s <em>Secret Invasion</em></a> intro, created with AI-generated visuals, was criticized not for how it looked, but for what it represented: the symbolic outsourcing of artistic labor during a highly sensitive moment for creative professionals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3_1uoieuPg2QdE7uER7Rng.gif" /><figcaption>Secret Invasion Opening Credits Generated By AI</figcaption></figure><h4>How This Works</h4><p>Most of this media magic is powered by deep learning models trained on massive datasets:</p><ul><li>Audio separation (like in <em>Now and Then</em>) uses tools similar to Demucs or Spleeter, which learn to “unmix” audio signals.</li><li>Voice cloning (like <em>Fake Drake</em>) is built on models like Tacotron 2, So-VITS-SVC, or Respeecher, which can generate speech in someone else’s voice using spectrograms and neural vocoders.</li><li>Visual generation and de-aging often use GANs (Generative Adversarial Networks) or diffusion models (like Midjourney or Stable Diffusion) to synthesize hyper-realistic faces or entire scenes.</li></ul><h4>Magic, Misuse, or… Both?</h4><p>What we’re seeing is not just new. Every creative tool, from the camera to the synthesizer to Photoshop, has been accused of “cheating” at first. The real debate is rarely about the tool itself. It’s about who gets to use it, how it’s credited, and whether the system around it respects the people it affects.</p><p>AI has given us the chance to hear Lennon sing again. But it’s also made it possible to clone Drake’s voice without permission. That tension between magic and misuse is what defines this moment.</p><h3>Déjà Vu in the Panic</h3><p>If the current fear around AI feels overwhelming, the headlines, the protests, the uncertainty, just know: we’ve been here before.</p><p>Every time a new tool comes along that shifts the balance between human skill and machine assistance, there’s a moment of cultural recoil. Artists, engineers, workers, and entire industries look at the future and ask, <em>“Wait… does this mean we’re no longer needed?”</em> And every time, that fear has a different name, but the pattern is eerily familiar.</p><h4>The Luddites: Not Anti-Tech, Just Pro-Work</h4><p>The term Luddite is often used to mock people who fear technology, but the original Luddites weren’t against innovation — they were against exploitation. In the early 1800s, English textile workers destroyed mechanized looms not because they hated machines, but because they were being replaced without fair wages, protections, or a voice. Sound familiar?</p><p>AI isn’t destroying factories, it’s creeping into keyboards, canvases, and sound booths. But the fear? It’s the same: “What happens to us if we’re no longer needed to do what we once mastered?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*r0eExDUZlpmwJim2h_k53w.jpeg" /><figcaption>Ludd, drawn here in 1812, was the fictitious leader of numerous real protests. Granger Collection, New York</figcaption></figure><h4>When Excel Was the End of Accounting (It Wasn’t)</h4><p>When spreadsheets like VisiCalc and later Microsoft Excel arrived, many believed entire categories of white-collar jobs, especially accountants and bookkeepers, would vanish. And some did. But the field didn’t disappear. It evolved.</p><p>Tasks that once took hours became automated. In their place emerged roles in data analysis, financial strategy, and business intelligence jobs that didn’t exist before the spreadsheet. In hindsight, the spreadsheet wasn’t a destroyer. It was an amplifier.</p><h4>Photoshop, Auto-Tune, and the Death of “Real Art”</h4><p>When <strong>Photoshop</strong> became mainstream in the ’90s, it was dismissed by some as a gimmick that would “ruin photography.” When <strong>Auto-Tune</strong> hit the charts in the 2000s, it was accused of killing “real” music. The fear was simple: <em>If anyone can make something look or sound good with software, what happens to the people who trained for years to do it by hand?</em></p><p>But here’s what happened instead:</p><ul><li>Photoshop became a creative standard.</li><li>Auto-Tune became both a corrective tool <em>and</em> an artistic aesthetic (e.g., T-Pain, Kanye West).</li><li>And the people who embraced those tools shaped entire industries.</li></ul><h4>TRON and the VFX That Was “Too Digital to Count”</h4><p>In 1982, the film TRON introduced one of the earliest uses of computer-generated imagery (CGI). It was a groundbreaking digital leap. And yet, the Academy of Motion Picture Arts and Sciences refused to nominate it for Best Visual Effects, calling the use of computers “cheating.”</p><p>That was just four decades ago. Today, films are generated entirely by machines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*bF3OLenBUoj8XS_rJRLOkg.gif" /><figcaption>TRON (1982)</figcaption></figure><h4>Kodak: The Company That Invented Disruption.. Then Hid It</h4><p>In 1975, a Kodak engineer named Steve Sasson built the world’s first digital camera. The company filed a patent, ran internal demos… and shelved it. Why? Because they feared it would cannibalize their lucrative film business.</p><p>Decades later, digital photography overtook film. Kodak, the company that invented the future, filed for bankruptcy in 2012.</p><p>This wasn’t a failure of innovation. It was a failure of nerve.</p><blockquote>“It was filmless photography, so management’s reaction was, ‘That’s cute but don’t tell anyone about it.’”<br> — Steve Sasson, inventor of the digital camera at Kodak</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ml7XZpOp3u5-Tl9BlKe87w.jpeg" /><figcaption>Steven J. Sasson, inventor of the first digital camera</figcaption></figure><h4>The Pattern</h4><ul><li>New tool emerges</li><li>Experts panic</li><li>Institutions reject it</li><li>A generation adapts</li><li>The tool becomes invisible</li></ul><p>Sound familiar?</p><p>The AI panic isn’t unprecedented. It’s part of a long tradition where we mistake tool evolution for talent extinction. But tools don’t erase humans. They expand what we can do if we’re willing to grow with them.</p><h3>Fear of Replacement: Same Song, New Instruments</h3><p>For all the talk about AI’s capabilities, what really keeps people up at night isn’t how smart the models are; it’s what they might take away.</p><p>It’s personal. For designers, it’s seeing Midjourney generate art in seconds that once took hours. For voice actors, it’s watching synthetic voices mimic tone and emotion with uncanny precision. For developers, it’s seeing tools like Copilot complete entire functions before they’ve even finished typing.</p><p>And beneath it all is the same old question:<br>“If a machine can do what I do, what happens to me?”</p><h4>Automation Anxiety Isn’t New</h4><p>This fear didn’t start with ChatGPT. Every major wave of automation has sparked this same existential tension.</p><ul><li>In the 1980s, word processors made secretarial roles obsolete and created an explosion of self-service documentation and publishing.</li><li>Accountants feared spreadsheets would end their jobs, but they became financial strategists and data analysts instead.</li><li>Musicians worried synthesizers and drum machines would kill “real music,” yet genres like hip hop, EDM, and pop thrived.</li><li>Photographers feared digital cameras would flood the world with amateurs, and they did. But they also democratized photography forever.</li></ul><p>The common thread? When we confuse the tool with the talent, we miss the opportunity.</p><h4>AI Isn’t Replacing Jobs: It’s Rewriting Roles</h4><p>Yes, AI will replace some tasks. But history suggests it’s roles, not entire professions, that change.</p><ul><li>Designers won’t disappear, but the tools they use and the problems they solve will shift.</li><li>Writers won’t vanish, but perhaps they’ll become more like editors, curators, narrative architects.</li><li>Developers won’t be obsolete, but they may spend less time writing boilerplate and more time architecting logic and testing systems.</li></ul><p>This isn’t about being faster than the machine. It’s about being more human than the machine ever can be in your judgment, intuition, and creative leaps.</p><h4>Choose Your Reaction</h4><p>Right now, the response to AI is splitting into two camps:</p><ul><li>Freeze: Deny the shift. Cling to the old ways. Hope it blows over.</li><li>Adapt: Embrace the tools. Re-skill. Reimagine your craft with new capabilities.</li></ul><p>It’s not easy. And it’s not fair. But it is happening.</p><p>The question isn’t whether AI will change your field. It’s whether you’ll help shape what that change looks like.</p><h3>Invented the Future… Then Ignored It</h3><p>Sometimes, the companies best positioned to lead the future are the ones most afraid of it. They don’t fail because they lack innovation - they fail because they can’t let go of what once made them great.</p><p>In the age of AI, this lesson feels especially urgent.</p><h4>Kodak: Saw It, Built It, Buried It</h4><p>In 1975, Kodak engineer Steve Sasson built the world’s first digital camera. It could capture images, display them on a screen, and even store them digitally. Kodak filed patents, ran internal demos… and then shelved it. The fear? That it would cannibalize their film business.</p><p>They weren’t wrong. It would have. But by resisting the change they helped invent, Kodak lost control of the shift, and filed for bankruptcy in 2012.</p><h4>BlackBerry: The Keyboard That Couldn’t Let Go</h4><p>In the early 2000s, BlackBerry defined the smartphone. Secure email. Physical keyboards. Market dominance. And yet, when Apple introduced the iPhone, a touchscreen with no buttons, BlackBerry dismissed it as a toy.</p><p>They doubled down on what they knew instead of adapting to what was coming. By the time they pivoted, it was too late. Touchscreens weren’t a gimmick — they were the new normal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ZBDWMOo-tn8cQYDCKiREIA.jpeg" /></figure><h4>Nintendo: Motion Controls Before They Were Cool</h4><p>Few know this, but Nintendo created a prototype for motion-controlled gaming in the ’90s, long before the Wii. But they shelved it. Too risky. Too niche.</p><p>Years later, they revisited the concept and launched the Wii… which became one of the most successful consoles of all time. In this case, they almost ignored the future, but managed to circle back just in time.</p><h4>Blockbuster: Laughed at Netflix</h4><p>Blockbuster had the chance to buy Netflix in 2000 for $50 million. They passed.</p><p>The reason? They thought physical stores were too central to their identity, and streaming was too fringe. Netflix went on to redefine entertainment. Blockbuster filed for bankruptcy in 2010.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FcX-Dm47d9etN4LQ85Rwaw.png" /><figcaption>Source: strategyjourney.com</figcaption></figure><h4>The Takeaway</h4><p>Every one of these companies had:</p><ul><li>A head start</li><li>Smart people</li><li>Market share</li><li>And still lost to fear, complacency, or pride</li></ul><p>As we stare down this new AI frontier, it’s worth asking:</p><blockquote>Are we building the future or quietly ignoring it because it’s uncomfortable?</blockquote><p>AI might disrupt your workflow. But ignoring it might disrupt your future.</p><h3>Is AI a Bubble? Or the Start of Something Real?</h3><p>Whenever a new technology takes the spotlight, it attracts two kinds of energy: excitement and excess. The AI boom has both in spades.</p><p>We’ve got billion-dollar valuations for companies without a clear business model. Models chasing benchmarks instead of real problems. And startups stapling “AI” onto their name just to raise funding.</p><p>It’s easy to wonder: Is this just the dot-com bubble all over again, but with neural nets?</p><h4>We’ve Seen This Movie Before</h4><p>Let’s take a quick look at three tech waves that started with hype, hit a wall, and then matured into something meaningful:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*siX2nLh9CjxzZa3FfwmtQQ.png" /></figure><p>AI today has its share of vaporware, but it also has genuine breakthroughs.</p><h4>Not All Bubbles Pop</h4><p>Here’s a pattern worth remembering:</p><ul><li>Hype attracts capital.</li><li>Capital funds innovation.</li><li>Most of it crashes.</li><li>Some of it survives and reshapes the world.</li></ul><p>Google was a dot-com startup. So was Amazon. Most of their peers vanished, but that didn’t make the internet a bubble. It made it a crucible.</p><p>The same may be true for AI.</p><h4>Insight: It’s Not Whether It’s a Bubble, It’s What Survives the Burst</h4><p>AI may be overhyped in places. But underestimating it is just as dangerous. Because even if 90% of today’s AI startups collapse, the 10% that remain will define the tools, culture, and platforms of the next decade.</p><p>So maybe the better question isn’t “Is this a bubble?”<br>But rather: <em>“What part of it will still matter after the hype fades?”</em></p><h3>Remix or Revolution?</h3><p>So… is AI the end of an era or the start of a new one? Maybe the better metaphor is this: AI is a remix.</p><p>It borrows from what came before. It accelerates what’s already in motion. And it forces us, sometimes painfully, to confront what we value most about being human.</p><p>The fear we feel? It’s valid. These tools are fast, unfamiliar, and imperfect. Biases persist. Environmental costs are real. Progress sometimes races ahead of our ethics. And yes, some jobs will change, shrink, or vanish entirely.</p><p>But fear alone shouldn’t define our response.</p><p>We’ve seen this pattern before: electricity, the assembly line, the internet, the smartphone. Each brought disruption. Each triggered panic. And each, eventually, expanded what humans could do.</p><p>AI feels different not because it’s smarter than us, but because it mimics us. It imitates language, reasoning, and even creativity. But imitation is not embodiment.</p><blockquote>Our intelligence isn’t defined by how fast we code or how much we produce.<br>It’s defined by how deeply we connect.<br>How we empathize. Reflect. Imagine. Hope.</blockquote><p>That’s the part AI can’t replicate and the part we must protect.</p><p>Instead of freezing in place or pretending nothing is happening, we can choose to:</p><ul><li><strong>Explore</strong> the tools - not blindly adopt them, but understand them.</li><li><strong>Adapt</strong> our workflows, not our worth.</li><li><strong>Question</strong> what “intelligence” and “creativity” really mean in an augmented world.</li><li><strong>Create </strong>work that is uniquely ours, guided by ethics, emotion, and imagination.</li></ul><p><a href="https://mitsloan.mit.edu/press/new-mit-sloan-research-suggests-ai-more-likely-to-complement-not-replace-human-workers">New research, like MIT Sloan</a>’s EPOCH framework, shows how our most irreplaceable strengths lie in <strong>Empathy, Presence, Opinion, Creativity, and Hope</strong>. These are not bugs of being human; they’re our competitive advantage.</p><p><strong>So no, AI won’t end us.</strong></p><p>But it will test what we’re willing to become.</p><p>Not just faster or more efficient, but more human. More intentional. More awake to the choices we make in this remix moment.</p><p>The tools are here. The question is: what will we make with them?</p><blockquote>So as we step into this strange new era, the question isn’t whether we keep up, <strong>it’s whether we show up.</strong></blockquote><blockquote>With curiosity. <br>With caution. <br>And with conviction.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efa3fc775fbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bridging Windows and WSL: Streaming Your Webcam with OpenCV]]></title>
            <link>https://medium.com/@mominaman/stream-webcam-to-wsl-opencv-983e90ed7301?source=rss-f123689882fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/983e90ed7301</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[opencv]]></category>
            <dc:creator><![CDATA[Momin Aman]]></dc:creator>
            <pubDate>Mon, 02 Jun 2025 01:58:16 GMT</pubDate>
            <atom:updated>2025-06-03T05:46:18.589Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the last few weeks, I’ve published a series of setup guides for developers working with WSL, CUDA, AI tools, and other Linux-based environments on Windows. This article marks the final entry in that series and it’s a fun, practical one.</p><p>If you’ve ever tried accessing your Windows webcam directly from WSL (Windows Subsystem for Linux), you’ve likely run into frustrating limitations. I certainly did while experimenting with computer vision models inside WSL. I realized that WSL doesn’t natively support camera access, but instead of giving up, I built a workaround using Flask and OpenCV that streams your webcam from Windows into WSL. This article explains how you can do the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zs3pU7cAw_nhNMzmfwVHPA.jpeg" /></figure><p><strong>Why This Matters<br></strong>Many modern ML and computer vision workflows benefit from WSL’s Linux compatibility. But lacking camera access becomes a major blocker for anyone prototyping locally, such as streaming webcam footage into a YOLOv8 detection pipeline.</p><p>Rather than switching entirely to a Windows-based Python environment, this solution lets you retain the Linux-based development stack while using your Windows hardware resources.</p><p>Let’s break down how it works.</p><p><strong>Overview of the Setup<br></strong>This approach uses two Python scripts:</p><ul><li>A Flask-based server on Windows that streams your webcam feed using MJPEG.</li><li>An OpenCV-based client on WSL that connects to this stream and displays it in real time.</li></ul><p>Once configured, your webcam becomes accessible to WSL just like a video stream over the local network.</p><h3>Server Setup (Windows)</h3><p><strong>1-</strong> First, install the required packages on your Windows machine:</p><pre>pip install flask opencv-python</pre><p><strong>2.</strong> Create a file named webcam_server.py and paste the following code:</p><pre>from flask import Flask, Response<br>import cv2<br>import atexit<br><br>app = Flask(__name__)<br>camera = cv2.VideoCapture(0)<br><br>if not camera.isOpened():<br>    raise RuntimeError(&quot;Failed to open webcam&quot;)<br><br>@atexit.register<br>def cleanup():<br>    print(&quot;Releasing camera&quot;)<br>    camera.release()<br><br>def generate_frames():<br>    while True:<br>        success, frame = camera.read()<br>        if not success:<br>            break<br>        _, buffer = cv2.imencode(&#39;.jpg&#39;, frame)<br>        frame = buffer.tobytes()<br>        yield (b&#39;--frame\r\n&#39;<br>               b&#39;Content-Type: image/jpeg\r\n\r\n&#39; + frame + b&#39;\r\n&#39;)<br><br>@app.route(&#39;/video&#39;)<br>def video():<br>    return Response(generate_frames(), mimetype=&#39;multipart/x-mixed-replace; boundary=frame&#39;)<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(host=&#39;0.0.0.0&#39;, port=8080, threaded=True)</pre><p><strong>3.</strong> Start the server:</p><pre>python webcam_server.py</pre><p>You’ll see output like:</p><pre> * Running on http://127.0.0.1:8080<br> * Running on http://192.168.X.X:8080</pre><blockquote>Note the local IP (192.168.X.X). You’ll use this in WSL.</blockquote><h3>Client Setup (WSL)</h3><p><strong>1-</strong> On your WSL instance (Ubuntu or Debian-based), install OpenCV:</p><pre>sudo apt update<br>sudo apt install python3-opencv</pre><p>Or, if you prefer pip:</p><pre>pip install opencv-python</pre><p><strong>2.</strong> Create a file named webcam_client.py and paste the following:</p><pre>import cv2<br>import argparse<br><br>def main(server_url):<br>    cap = cv2.VideoCapture(server_url)<br><br>    if not cap.isOpened():<br>        print(f&quot;Failed to connect to stream at {server_url}&quot;)<br>        return<br><br>    while True:<br>        ret, frame = cap.read()<br>        if not ret:<br>            break<br>        cv2.imshow(&quot;Webcam Stream&quot;, frame)<br>        if cv2.waitKey(1) &amp; 0xFF == 27:<br>            break<br><br>    cap.release()<br>    cv2.destroyAllWindows()<br><br>if __name__ == &#39;__main__&#39;:<br>    parser = argparse.ArgumentParser()<br>    parser.add_argument(&#39;--url&#39;, default=&#39;http://192.168.0.199:8080/video&#39;,<br>                        help=&#39;URL of the webcam stream server&#39;)<br>    args = parser.parse_args()<br><br>    main(args.url)</pre><p><strong>3.</strong> Run it with the same IP used above:</p><pre>python3 webcam_client.py --url http://192.168.0.199:8080/video</pre><h4><strong>Behind the Scenes</strong></h4><p>webcam_server.py (Windows):</p><ul><li>Starts a Flask app</li><li>Opens webcam via OpenCV</li><li>Streams JPEG frames via HTTP (/video)</li><li>Uses MJPEG format to support real-time streaming</li><li>Handles shutdown cleanly using atexit</li></ul><p>webcam_client.py (WSL):</p><ul><li>Connects to MJPEG stream using OpenCV</li><li>Displays a stream in a local OpenCV window</li><li>Stops on ESC key press</li></ul><h4><strong>Troubleshooting Tips</strong></h4><ul><li>Ensure your Windows and WSL are on the same local network.</li><li>If WSL fails to connect:<br> — Check your Windows Firewall (allow Python/Flask).<br> — Confirm the IP is correct with ping.</li><li>Use the — url flag to try different addresses if needed.</li><li>If nothing displays, verify that the camera is working on Windows first.</li></ul><h4>A Word on Security</h4><p>This solution is great for <strong>local development only</strong>. Do <strong>not expose</strong> this Flask server to public networks unless you secure it properly with authentication and HTTPS.</p><h4>Final Thoughts</h4><p>And with that, we wrap up this mini-series on setting up your local AI/ML and computer vision tools using WSL. Whether you were setting up CUDA, running Meta’s Audiocraft locally, or streaming a webcam into Linux, these workflows aim to help you bridge the best of both worlds: Linux’s flexibility and Windows’ hardware support.</p><p>If you found this helpful, check out the rest of the articles in this setup series:</p><ul><li><a href="https://medium.com/@mominaman/setup-wsl-conda-windows-for-ai-e9f9ddc2c0c7">Run Facebook Audiocraft Locally on Windows with WSL — Part 1: Setting Up WSL and Conda</a></li><li><a href="https://medium.com/@mominaman/run-audiocraft-wsl-windows-b203c07ff231">Run Facebook Audiocraft Locally on Windows with WSL — Part 2: Cloning and Running Audiocraft</a></li><li><a href="https://medium.com/@mominaman/pytorch-tensorflow-cuda-wsl2-b4931a309eb0">From Errors to Execution: A Hands-On Guide to CUDA ML Setup on WSL2 or Linux</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=983e90ed7301" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Errors to Execution: A Hands-On Guide to CUDA ML Setup on WSL2]]></title>
            <link>https://medium.com/@mominaman/pytorch-tensorflow-cuda-wsl2-b4931a309eb0?source=rss-f123689882fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4931a309eb0</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[cuda]]></category>
            <dc:creator><![CDATA[Momin Aman]]></dc:creator>
            <pubDate>Sun, 01 Jun 2025 08:02:37 GMT</pubDate>
            <atom:updated>2025-06-03T05:55:01.222Z</atom:updated>
            <content:encoded><![CDATA[<h3>From Errors to Execution: A Hands-On Guide to CUDA ML Setup on WSL2 or Linux</h3><p><em>Documented, tested, and co-written by </em><a href="https://medium.com/u/6dce934fc1ad"><em>Ahmed Affraz</em></a><em> &amp; </em><a href="https://medium.com/u/f123689882fe"><em>Momin Aman</em></a></p><blockquote>Getting your machine ready for GPU-accelerated machine learning on Linux sounds straightforward, until you’re knee-deep in mismatched library versions, obscure error messages, and conflicting installation guides.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1tXb32gK-kyGtPlhmpo4GA.png" /></figure><p>This article is part guide and part dev log. On April 24, 2025, we configured and tested a complete ML environment using CUDA 12.6, cuDNN 9.6, PyTorch 2.7, and TensorFlow 2.18 on Ubuntu 24.04 via WSL2. Every step was documented and validated that day, so what you’re reading isn’t just theory, it’s a working setup. This guide is the result of that experience: a clear, tested, and fully functional setup that goes beyond surface-level instructions.</p><p>Although a of this is documented for Ubuntu 24.04 on WSL2, you can use all of the steps on native, bare-metal installation of Ubuntu as well.</p><h3><strong>Step 1: Confirming the Driver and Choosing the Right CUDA SDK</strong></h3><p>Before installing anything, we started with a basic but crucial question: <strong>which versions are even compatible with our system?</strong></p><p>Everything in the CUDA ecosystem begins with your <strong>NVIDIA driver version</strong>. The driver determines which versions of the CUDA SDK you can install. So our first step was to confirm exactly what driver was installed.</p><pre>nvidia-smi</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TJWiQAV-Vd8x3m-N2hE9Kw.png" /></figure><p><strong>WSL2 Driver Behavior<br></strong>What’s worth noting, especially if you’re new to WSL, is that WSL2 shares the NVIDIA driver installed on your Windows host system. You don’t need to install a separate GPU driver inside Ubuntu (unlike native Linux). This simplifies the setup a bit, but it also means that your CUDA SDK must be compatible with your host system’s driver version.</p><p>Based on this driver version and NVIDIA’s support matrix, we determined that <strong>CUDA 12.6</strong> was the best choice, as newer versions would risk compatibility issues with cuDNN and the frameworks we planned to use.</p><blockquote>We chose <strong>CUDA 12.6</strong> because it was the highest confirmed compatible version for our driver and it had stable support in both PyTorch 2.7 and TensorFlow 2.18.</blockquote><h3>Step 2: Downloading and Installing CUDA 12.6.3 (WSL2)</h3><p>Once we confirmed that <strong>CUDA 12.6</strong> was the best compatible version for our driver, the next step was to install the SDK.</p><p>We navigated to the <a href="https://developer.nvidia.com/cuda-12-6-3-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;Distribution=WSL-Ubuntu&amp;target_version=2.0&amp;target_type=runfile_local">CUDA 12.6.3 archive page</a> and selected the appropriate settings for our environment<br><em>Note: It’s important to use the WSL-specific SDK to avoid missing dependencies or driver mismatches. The installation instructions are slightly different from native Ubuntu setups. But same instructions could be used for native Ubuntu.</em></p><p>We opted for the <strong>runfile-based installation</strong> instead of a package manager (like apt) for greater control. While package managers are convenient, they often include additional dependencies or automatic driver installations, which we didn’t need because <strong>WSL uses the Windows GPU driver directly</strong>.</p><p>Go to the following link to download the CUDA SDK Toolkit:</p><pre># Website Link<br>https://developer.nvidia.com/cuda-12-6-3-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;Distribution=WSL-Ubuntu&amp;target_version=2.0&amp;target_type=runfile_local</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cMc6ns0w4kSEX9-Uwj-wDg.png" /><figcaption>Select these options to get the proper link for downloading CUDA Toolkit</figcaption></figure><pre># Download CUDA 12.6.3 SDK for WSL2<br>wget https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda_12.6.3_560.35.05_linux.run<br><br># Run the installer (skip driver installation if prompted)<br>sudo sh cuda_12.6.3_560.35.05_linux.run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EEiSLTNQU85H3xPX7PGTgg.png" /></figure><p>Once the installation was completed, we added the following lines to our ~/.bashrc file to ensure the system recognizes the CUDA binaries and libraries:</p><p>Open .bashrc in a text editor:</p><pre>nano ~/.bashrc</pre><p>Then add these two lines to the end of the file:</p><pre>export PATH=/usr/local/cuda-12.6/bin:$PATH<br>export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64:$LD_LIBRARY_PATH</pre><p>Save and exit the file (Ctrl + O, Enter, then Ctrl + X), and apply the changes:</p><pre>source ~/.bashrc</pre><p>Once we had updated .bashrc and reloaded our shell, we verified that the CUDA toolkit was properly installed by checking the version of nvcc, the CUDA compiler:</p><pre>nvcc --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*RlT4IC2DFOqYKJTlqRSigg.png" /></figure><h3>Step 3: Installing cuDNN 9.6 for Deep Learning</h3><p>After setting up the CUDA toolkit, the next critical component was <strong>cuDNN</strong> (CUDA Deep Neural Network library). cuDNN provides optimized primitives for deep learning workloads and is essential for frameworks like PyTorch and TensorFlow to use the GPU efficiently.</p><p>We chose <strong>cuDNN 9.6</strong> as it is fully compatible with CUDA 12.6 (per <a href="https://docs.nvidia.com/deeplearning/cudnn/backend/v9.6.0/reference/support-matrix.html">NVIDIA’s support matrix</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*An7D2T2mZ7N3jKjQ2EPO_A.png" /><figcaption>CUDA Toolkit v12.6 is compatible with cuDNN v9.6.0</figcaption></figure><p><strong>Download and Setup<br></strong>We followed instructions from the <a href="https://developer.nvidia.com/cudnn-9-6-0-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;Distribution=Ubuntu&amp;target_version=24.04&amp;target_type=deb_local">cuDNN 9.6.0 archive for Ubuntu 24.04 (local deb installer)</a>.</p><p>Before installation, we added the required dependencies to compile cuDNN samples:</p><pre>sudo apt-get install libfreeimage3 libfreeimage-dev</pre><p>Then, we downloaded and installed cuDNN from following link:</p><pre>https://developer.nvidia.com/cudnn-9-6-0-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;Distribution=Ubuntu&amp;target_version=24.04&amp;target_type=deb_local</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QuqArvRi7WQtBnSB0sOqXQ.png" /></figure><pre># Installation commands for cuDNN installation<br>wget https://developer.download.nvidia.com/compute/cudnn/9.6.0/local_installers/cudnn-local-repo-ubuntu2404-9.6.0_1.0-1_amd64.deb<br>sudo dpkg -i cudnn-local-repo-ubuntu2404-9.6.0_1.0-1_amd64.deb<br>sudo cp /var/cudnn-local-repo-ubuntu2404-9.6.0/cudnn-*-keyring.gpg /usr/share/keyrings/<br>sudo apt-get update<br>sudo apt-get -y install cudnn-cuda-12</pre><p>This installed cuDNN libraries linked specifically against CUDA 12, ensuring compatibility with our toolkit and ML frameworks.</p><p><strong>Optional: Install and Test cuDNN Samples<br></strong>To test the installation and explore sample projects, we also installed cuDNN’s sample code:</p><pre>sudo apt-get -y install libcudnn9-samples<br>cp -r cudnn_samples_v9/ ~/source/cudnn_samples_v9<br>cd ~/source/cudnn_samples_v9</pre><blockquote>Note: These commands were run and tested on April 24, 2025, inside Ubuntu 24.04 on WSL2. All sample code compiled successfully without errors.</blockquote><h3>Step 4: Installing PyTorch 2.7 with CUDA 12.6</h3><p>With CUDA and cuDNN installed and working, we moved on to installing <strong>PyTorch 2.7</strong> — the most recent stable release that supports CUDA 12.6, as of April 2025.</p><p>We started by heading over to the official <a href="https://pytorch.org/get-started/locally/">PyTorch installation page</a> and selecting the right configuration for our system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*b61f3QcDhtSdCpGvW5iLBQ.png" /></figure><p>Before running any installation commands, we double-checked version support using the PyTorch RELEASE.md compatibility matrix from <a href="https://github.com/pytorch/pytorch/blob/main/RELEASE.md">here</a>. This helped ensure that PyTorch 2.7 and CUDA 12.6 would work smoothly together, and which cuDNN version PyTorch expected internally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*80dpM4bfffjR9U_QPE8NGw.png" /><figcaption>Minimum CUDA Toolkit and cuDNN versions needed for a specific PyTorch version</figcaption></figure><p><strong>Setting Up the Conda Environment<br></strong>We used Miniconda to manage isolated environments. Here’s how we created the environment and installed PyTorch:</p><pre># Optional: Install ipykernel in your base conda env first<br>pip install ipykernel<br><br># Create a new environment with Python 3.11<br>conda create -n torch27 python=3.11<br>conda activate torch27<br><br># Install PyTorch 2.7 with CUDA 12.6<br>pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126</pre><p><strong>Verifying PyTorch Installation<br></strong>Once installed, we opened Python inside the environment and ran:</p><pre>import torch<br>print(torch.cuda.is_available())</pre><p>If the output is True, it means your PyTorch setup is successfully using the GPU via CUDA.</p><p><strong>Why We Created Separate Environments for PyTorch<br></strong>Before diving into the TensorFlow installation, it’s important to explain why we use different Conda environments for each ML framework:<strong> </strong>PyTorch and TensorFlow.</p><p>During our setup, we initially tried installing both frameworks in the same environment (ml) to save time and manageability. But very quickly, version conflicts began to surface:</p><ul><li>PyTorch 2.7 requires cuDNN 9.5 internally.</li><li>TensorFlow 2.13 (planned) depended on cuDNN 9.3 and expected slightly different CUDA bindings.</li><li>Even the Python and dependency versions overlapped or clashed (e.g., one needed ninja, the other didn’t).</li></ul><p>These incompatibilities made it clear that trying to maintain both frameworks in a single environment could lead to frustrating, hard-to-debug issues, especially when testing GPU availability and runtime behavior.</p><p><strong>Lesson Learned: Isolate Environments<br></strong>So instead, we followed a well-known best practice:</p><blockquote>Use isolated environments per framework:<br>This ensures stable setups and easier upgrades/downgrades per framework without cross-contamination of dependencies.</blockquote><p>We created a clean Conda environment for PyTorch:</p><pre>conda create -n torch27 python=3.11<br>conda activate torch27</pre><p>We’ll soon repeat the same for TensorFlow (in a separate env like tf218), keeping installations clean, versioned, and easy to manage.</p><p>This also gives flexibility to try out experimental builds or downgrade specific packages without worrying about one framework breaking the other.</p><h3><strong>Step 5: Installing TensorFlow 2.18 with GPU Support</strong></h3><p>With PyTorch working perfectly in its own environment, we moved on to setting up <strong>TensorFlow 2.18</strong> in its own dedicated Conda environment to avoid version clashes and package conflicts.</p><blockquote>Note: We’re keeping TensorFlow separate because PyTorch and TensorFlow often require different cuDNN versions, build flags, and dependencies. Installing both in the same environment is risky and can break one or both frameworks.</blockquote><p><strong>Creating the TensorFlow Environment<br></strong>We created a clean Conda environment using Python 3.11:</p><pre>conda create -n tf218 python=3.11<br>conda activate tf218</pre><p>Then installed TensorFlow 2.18 with GPU support:</p><pre>python3 -m pip install tensorflow[and-cuda]==2.18</pre><blockquote>The [and-cuda] tag ensures that TensorFlow pulls in the necessary CUDA and cuDNN libraries directly, rather than relying on global system installations.</blockquote><p><strong>Verifying TensorFlow GPU Access<br></strong>Once installed, we tested the setup using this command:</p><pre>python3 -c &quot;import tensorflow as tf; print(tf.config.list_physical_devices(&#39;GPU&#39;))&quot;</pre><p><strong>Expected Output:</strong></p><pre>[PhysicalDevice(name=&#39;/physical_device:GPU:0&#39;, device_type=&#39;GPU&#39;)]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*jDbf2XVteNUTmOiw7Yla2Q.png" /></figure><p>This confirmed that TensorFlow was properly linked with CUDA 12.6 and able to use the GPU. Although some warnings about plugin registration and performance optimizations appeared, they’re common and non-blocking unless you’re compiling TensorFlow from source. These warnings go away when code is run the next time. So you can safely ignore these.</p><p>We now had both <strong>PyTorch 2.7</strong> and <strong>TensorFlow 2.18</strong> installed, tested, and GPU-accelerated — each in its own stable sandbox.</p><h3>Step 6: Running Jupyter Lab</h3><p>To test the environments visually and run ML code interactively, we set up Jupyter Notebooks with each Conda environment:</p><pre>pip install ipykernel<br>python -m ipykernel install --user --name=tf218 --display-name &quot;TensorFlow 2.18&quot;</pre><p>We used VS Code’s Jupyter plugin to open .ipynb files and select either Torch or TensorFlow kernels depending on what we were working on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*3_zoAf3dlRgDfSeepiFeLQ.png" /></figure><h3>Final Thoughts</h3><p>Here’s what we installed and tested so far:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*-mNoVsU1bDwTu7p6qE2l6Q.jpeg" /></figure><p>Setting up ML environments with GPU support isn’t always straightforward, especially when managing multiple frameworks, SDK versions, and deep learning libraries.</p><p>But documenting as we went, co-debugging, cross-referencing NVIDIA support matrices, and verifying everything <em>step by step</em> helped us build confidence and clarity. And now, everything is running smoothly, with clean environments, GPU acceleration, and no hidden conflicts.</p><p>Whether you’re working solo or with a friend (like we did), <strong>having a repeatable, validated dev log is your best defense against future setup pain</strong>.</p><p><em>Happy experimenting, training, and deploying!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4931a309eb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Run Facebook Audiocraft Locally on Windows with WSL — Part 2: Cloning and Running Audiocraft]]></title>
            <link>https://medium.com/@mominaman/run-audiocraft-wsl-windows-b203c07ff231?source=rss-f123689882fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/b203c07ff231</guid>
            <category><![CDATA[audiocraft]]></category>
            <category><![CDATA[ai-music-generation]]></category>
            <category><![CDATA[gradio]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[wsl]]></category>
            <dc:creator><![CDATA[Momin Aman]]></dc:creator>
            <pubDate>Thu, 29 May 2025 07:02:31 GMT</pubDate>
            <atom:updated>2025-06-03T06:01:29.751Z</atom:updated>
            <content:encoded><![CDATA[<h3>Run Facebook Audiocraft Locally on Windows with WSL — Part 2: Cloning and Running Audiocraft</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b261dOgxmLGTe13UClhAew.jpeg" /></figure><p>In <a href="https://medium.com/@mominaman/setup-wsl-conda-windows-for-ai-e9f9ddc2c0c7">Part 1</a>, we set up a complete WSL environment on Windows with Python, pip, and Miniconda, the foundation for running powerful AI tools locally. Now it’s time to put that setup to use.</p><p>In this second part of the series, we’ll clone Facebook’s Audiocraft repository, install its dependencies, fix known compatibility issues, and run the MusicGen demo app within your local WSL environment. You’ll go from a blank Ubuntu terminal to generating music using AI, with no need for cloud compute or remote servers.</p><h3><strong>Step 8: Install FFmpeg &amp; Set Up Audiocraft</strong></h3><p>Before we install Audiocraft, we need one essential dependency: FFmpeg — a powerful library for processing audio and video files.</p><p>Audiocraft uses FFmpeg to:</p><ul><li>Convert and process audio formats</li><li>Handle encoding/decoding for music generation</li><li>Enable playback and export options in the demo app</li></ul><p>Without it, the model may crash or fail when dealing with audio input/output.</p><p><strong>Install FFmpeg:</strong></p><pre>sudo apt install ffmpeg</pre><p><strong>Clone and Install Audiocraft<br></strong>Now we’ll clone Facebook’s official Audiocraft repository and install its dependencies.</p><pre>git clone https://github.com/facebookresearch/audiocraft.git<br>cd audiocraft<br>python -m pip install -r requirements.txt</pre><p>This pulls the source code and installs all required Python packages listed in the requirements.txt file. Sit back and relax, as it might take a bit to download everything, depending on your internet speed.</p><p><strong>Bonus: Open the Project in VS Code (Recommended)<br></strong>If you’re using Windows with WSL, the best way to work with the Audiocraft project is through Visual Studio Code. Here’s how:</p><ul><li>Make sure you’ve installed VS Code on Windows.</li><li>Install the “<a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl">WSL</a>” extension from the VS Code Marketplace.</li><li>In your Ubuntu terminal (inside the audiocraft folder), type:</li></ul><pre>code .</pre><p>This will open the current folder in VS Code, connected to your WSL Ubuntu environment. You can now:</p><ul><li>Browse and edit code with full syntax highlighting</li><li>Use the integrated terminal to run commands directly</li><li>Install Python, Git, or Jupyter extensions as needed</li></ul><p>This setup gives you the best of both worlds: Windows power with Linux compatibility.</p><h3><strong>Step 9: Fix Gradio Compatibility by Downgrading</strong></h3><p>Once you install the Audiocraft dependencies, don’t run the app just yet; it may fail due to a known compatibility issue with newer versions of Gradio, the UI framework Audiocraft uses for its demo.</p><p><strong>The Problem:<br></strong>The requirements.txt file might install the latest version of Gradio, which is not compatible with the current version of Audiocraft. Attempting to run the demo will likely result in an error.</p><p><strong>Fix: Downgrade Gradio<br></strong>To resolve this, downgrade Gradio to a compatible version:</p><pre># pip show gradio shows you the current version installed — helpful for debugging<br>pip show gradio<br><br># Version 3.44.4 is known to work smoothly with Audiocraft<br>pip install gradio==3.44.4</pre><p>After this, your environment is ready to run the app without Gradio-related issues.</p><h3><strong>Step 10: Verify PyTorch Installation &amp; CUDA Support (Optional but Recommended)</strong></h3><p>Before running Audiocraft, it’s a good idea to verify that PyTorch is installed correctly and that your GPU (CUDA) is available for use. This step helps prevent silent issues during model execution, especially important if you’re working with large models or music generation.</p><pre># Check if torch is installed in your Conda environment<br>conda list | grep torch<br><br># Run a quick Python test<br>python3 -c &quot;import torch; print(f&#39;PyTorch is installed: {torch.__version__}&#39;); print(f&#39;CUDA available: {torch.cuda.is_available()}&#39;)&quot;</pre><ul><li>The first command will list installed PyTorch packages like torch, torchaudio, etc.</li><li>The second will print something like:</li></ul><pre>PyTorch is installed: 2.1.0<br>CUDA available: True</pre><p>If CUDA available: False, it means PyTorch is running on CPU. That’s okay, but slower. Make sure:</p><ul><li>You have an NVIDIA GPU</li><li>You’re using WSL 2</li><li>NVIDIA drivers and CUDA toolkit for WSL are properly installed</li></ul><p>You can still proceed with CPU-only if the GPU isn’t available.</p><h3>Step 11: Run the Audiocraft Demo Locally</h3><p>With everything set up: Python, Conda, Audiocraft, and dependencies, you’re ready to run the MusicGen demo app provided by Facebook’s Audiocraft.</p><pre>python -m demos.musicgen_app --share</pre><p><strong>What This Does:</strong></p><ul><li>Launches the Gradio-based web app for MusicGen.</li><li>Opens a local web interface (usually on <a href="http://localhost:7860">http://localhost:7860</a>) where you can: Enter prompts, generate music, and play or download outputs.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pgm-4ymAhUJ4ZAwOMBuqFQ.png" /></figure><p><strong>If you see a TypeError, crash, or blank UI:</strong></p><ul><li>Double-check that Gradio is downgraded to 3.44.4.</li><li>Make sure you’re inside the audiocraft Conda environment.</li><li>Check the terminal for traceback messages for clues.</li></ul><p><strong>Troubleshooting: How to Stop the App If It Gets Stuck:</strong></p><p>Sometimes, Audiocraft’s MusicGen app may freeze, hang, or not respond in the terminal, especially if the Gradio server doesn’t shut down cleanly. If that happens, you’ll need to manually quit the Python process from your WSL terminal.</p><ol><li>Check for running Python processes:</li></ol><pre>ps aux | grep python</pre><p>You’ll see output like:</p><pre>user     2520 55.4 32.4 55092284 5264504 pts/6 Sl+ 23:11  11:21 python -m demos.musicgen_app --share<br>user     8231  0.0  0.0   4092  1988 pts/7    S+   23:31   0:00 grep --color=auto python</pre><p>2. Identify the PID of the running demo process (in this example: 2520)</p><p>3. Kill it with:</p><pre>sudo kill -9 2520</pre><p>This will forcefully stop the stuck app so you can restart or shut down cleanly. Tip: <em>You can also use htop (installed earlier) for an interactive way to find and kill processes.</em></p><p>You now have Audiocraft running locally through WSL, no cloud GPUs needed. What you’ve built is more than just a demo; it’s a flexible, local AI playground. Whether you’re experimenting with prompts, diving deeper into model performance, or extending it with your own audio datasets, you’ve got full control to explore, tinker, and learn at your own pace.</p><p><strong>Happy learning!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b203c07ff231" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Run Facebook Audiocraft Locally on Windows with WSL — Part 1: Setting Up WSL and Conda]]></title>
            <link>https://medium.com/@mominaman/setup-wsl-conda-windows-for-ai-e9f9ddc2c0c7?source=rss-f123689882fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9f9ddc2c0c7</guid>
            <category><![CDATA[conda-environment]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[windows-subsystem-linux]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[audiocraft]]></category>
            <dc:creator><![CDATA[Momin Aman]]></dc:creator>
            <pubDate>Thu, 29 May 2025 07:00:53 GMT</pubDate>
            <atom:updated>2025-05-29T07:00:53.302Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Run Facebook Audiocraft Locally on Windows with WSL — Part 1: Setting Up WSL and Conda</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Po4Ptjltu5X7ZGSpJU0Ugw.jpeg" /></figure><p>Have you ever wanted to run powerful AI tools like Facebook’s Audiocraft <em>locally</em> on your own machine, without paying for cloud GPUs or switching to Linux full-time? In this guide, I’ll walk you through how I set up my Windows machine using <strong>WSL (Windows Subsystem for Linux)</strong> to create a fully functional Linux environment, install <strong>Python</strong>, <strong>Miniconda</strong>, and prepare everything needed to run <a href="https://github.com/facebookresearch/audiocraft"><strong>Audiocraft</strong></a>, Facebook’s music-generating AI model.</p><p>This two-part series is for:</p><ul><li>Developers and tinkerers who want to explore AI/ML tools hands-on</li><li>Beginners setting up their first local AI development environment</li><li>Anyone who prefers running models locally instead of in the cloud</li><li>Windows users looking to harness the full power of Linux tools like Conda, pip, and PyTorch</li></ul><p>Whether you’re curious about generative AI, working on side projects, or building a foundation for more advanced work, this setup will help you turn your Windows machine into a serious local development rig.</p><h3><strong>Step 1: Install WSL and Ubuntu on Windows</strong></h3><p>Let’s begin by installing <strong>WSL (Windows Subsystem for Linux)</strong> — a feature that allows you to run a full Linux distribution on your Windows machine with minimal setup.</p><ul><li><strong>Install Ubuntu via WSL<br></strong>In PowerShell (run as Administrator), enter the following command:</li></ul><pre># This command will install WSL (if not already installed) and download and set up Ubuntu as the default Linux distro<br>wsl - install -d Ubuntu</pre><ul><li><strong>Set Up Your Linux User<br></strong>Right after installation, type:</li></ul><pre># This launches Ubuntu for the first time. You’ll be prompted to create your UNIX user and set a password. This becomes your default Linux user inside WSL.<br>wsl</pre><ul><li><strong>Restart and Access Ubuntu Easily<br></strong>After setting the password, you can restart your system (optional) and access Ubuntu more easily:<br> • Open Windows Terminal<br> • Click the down arrow next to the tabs<br> • Select Ubuntu from the drop-down list to launch the terminal</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*hvhd70mw62G1la7ygvD7rw.png" /></figure><ul><li><strong>Check Installed Distros and WSL Version<br></strong>To verify everything is set up correctly:</li></ul><pre>wsl -l -v</pre><p>This shows all installed WSL distributions, their status (Running/Stopped), and which WSL version they use.</p><h3><strong>Step 2: Update &amp; Upgrade Your Ubuntu System</strong></h3><p>Now that your WSL-based Ubuntu is installed and running, it’s time to update the system. This ensures that all packages are up to date and compatible with what we’ll install later.</p><ul><li>Run the following commands in your Ubuntu terminal:</li></ul><pre>sudo apt -y update<br>sudo apt -y upgrade</pre><ul><li>These two commands do the following:<br> • apt update: Fetches the list of available package updates.<br> • apt upgrade: Installs the latest versions of the available packages.<br> • The -y flag auto-confirms prompts, eliminating the need to type y manually.</li></ul><p><strong>Optional Utility: Install neofetch to Show System Info<br></strong>After updating and upgrading your Ubuntu system, you might want a quick visual overview of your setup, especially helpful to confirm your WSL version, kernel, CPU, memory, and more. That’s where neofetch comes in.</p><ul><li>Command:</li></ul><pre>sudo apt install neofetch</pre><ul><li>Once installed, run:</li></ul><pre>neofetch</pre><p>This will display a sleek ASCII-based summary of your system on the terminal. This step is optional, but highly recommended for Linux beginners or anyone who wants to quickly double-check their system info before installing heavier tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*M7ameHGer-5WKgkVo4FwIw.png" /></figure><h3><strong>Step 3: Monitor GPU Usage with watch nvidia-smi</strong></h3><p>If you have an NVIDIA GPU, it’s a good idea to check whether WSL is recognizing and using it, especially since tools like <strong>Audiocraft</strong> can take advantage of CUDA for faster processing.</p><pre>watch nvidia-smi</pre><p>This command does the following:</p><ul><li>Runs nvidia-smi repeatedly every 2 seconds (default).</li><li>Displays GPU usage stats in real-time, including memory, processes, power draw, and more.</li></ul><p>It’s especially helpful when:</p><ul><li>You want to confirm that PyTorch or other AI libraries are actually using your GPU.</li><li>You’re debugging performance issues or model crashes.</li><li>You’re just curious how much load your GPU is handling during a task.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*nnBjcIupELQztdszLAGk7w.png" /></figure><h3><strong>Step 4: Install Essential Dev Tools and Utilities</strong></h3><p>Before we install Python, Conda, or Audiocraft, we need to set up some foundational build tools and utilities. These packages are commonly used in compiling software, downloading resources, and monitoring system performance.</p><pre>sudo apt install build-essential cmake unzip git nano wget libssl-dev htop btop nvtop</pre><p><strong>What these packages do:</strong></p><ul><li>build-essential: Installs gcc, g++, and make — necessary for compiling C/C++ code and building Python packages from source.</li><li>cmake: A tool used by many software projects to manage the build process.</li><li>unzip: To extract .zip files — useful when working with pre-packaged code or assets.</li><li>git: Essential for cloning repositories like Audiocraft from GitHub.</li><li>nano: A simple terminal-based text editor — handy for editing config files.</li><li>wget: A command-line tool to download files from the internet.</li><li>libssl-dev: Provides OpenSSL libraries — often required for building secure Python packages.</li><li>htop: A colorful terminal-based process viewer (like Task Manager for Linux).</li><li>btop: A more modern, visually enhanced version of htop.</li><li>nvtop: Shows live GPU usage for NVIDIA GPUs — useful when running AI models.</li></ul><p>These tools are like the Swiss Army Knife for setting up and monitoring your Linux environment. You won’t always need all of them, but when you do, you’ll be glad they’re there.</p><h3><strong>Step 5: Install Python and pip</strong></h3><p>Now that your system is ready, it’s time to install Python 3 and its package manager pip — the core tools for running and installing most modern machine learning libraries, including Facebook’s Audiocraft.</p><pre>sudo apt install python3<br>sudo apt install python3-pip</pre><p>These install:</p><ul><li>python3: The Python interpreter used to run .py files</li><li>pip3: The package installer used to add libraries like torch, numpy, gradio, and more</li></ul><p>To check that Python and pip installed correctly:</p><pre>python3 - version<br>pip3 - version</pre><p>This should print out the versions of Python and pip you just installed, confirming everything is working.<br>Note: <em>We’ll later use conda to manage Python environments, but installing system-level Python ensures all fallback dependencies and tools work correctly.</em></p><h3><strong>Step 6: Install Miniconda for Managing Python Environments</strong></h3><p>Instead of juggling Python versions and packages manually, we’ll use Miniconda, a lightweight version of Anaconda that helps manage multiple isolated Python environments. It’s especially helpful when working with AI/ML libraries that have strict version requirements.</p><p>Run the commands and follow the on-screen prompts to confirm the install location and to initialize Miniconda:</p><pre>wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh<br>bash ~/Miniconda3-latest-Linux-x86_64.sh</pre><p><strong>Activate Conda:</strong></p><pre>source ~/.bashrc</pre><p><strong>Verify Conda Installation</strong></p><pre>conda list<br>conda - version</pre><p>If everything is set up correctly, you’ll see a list of default packages and the Conda version printed in the terminal.</p><p>You’re now ready to create clean, isolated Python environments — ideal for experimenting with tools like Facebook’s Audiocraft without messing up your base system.</p><h3>Step 7: <strong>Create a Conda Environment for Audiocraft</strong></h3><p>Now that Miniconda is installed, let’s create a dedicated environment for Audiocraft. This helps us isolate dependencies and avoid conflicts with system-wide packages.</p><p>We’ll use Python 3.9, since that’s the version Audiocraft is compatible with.</p><pre># Create a new environment named &quot;audiocraft&quot; with Python 3.9<br>conda create -n audiocraft python=3.9</pre><pre># Activate the environment<br>conda activate audiocraft</pre><p>Once activated, you’ll see (audiocraft) appear at the beginning of your terminal prompt, indicating you’re now working inside that environment.</p><p><strong>To deactivate and return to base:</strong></p><pre>conda deactivate</pre><p>This switches you back to the base environment.<br>Note: <em>Think of Conda environments like virtual sandboxes, which are perfect for trying out new packages or tools (like Audiocraft) without affecting anything else on your system.</em></p><p>By now, you’ve set up a full development environment on Windows using WSL. You’ve installed Ubuntu, configured Python and pip, installed Miniconda, and created an isolated environment specifically for Facebook’s Audiocraft.</p><p>This foundation isn’t just useful for Audiocraft; it sets you up to run any AI/ML project locally with better performance and full control over dependencies.</p><p>Continue to Part 2 here: <br><a href="https://medium.com/@mominaman/run-audiocraft-wsl-windows-b203c07ff231">Run Facebook’s Audiocraft Locally on Windows with WSL — Part 2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9f9ddc2c0c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pixels, Prototypes, and Perceptrons: A New Beginning]]></title>
            <link>https://medium.com/@mominaman/from-games-to-ai-and-xr-518eda8118ac?source=rss-f123689882fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/518eda8118ac</guid>
            <category><![CDATA[ai-and-machine-learning]]></category>
            <category><![CDATA[extended-reality]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[game-design]]></category>
            <dc:creator><![CDATA[Momin Aman]]></dc:creator>
            <pubDate>Wed, 28 May 2025 22:52:43 GMT</pubDate>
            <atom:updated>2025-05-28T22:52:43.489Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A cracked-open video game cartridge with glowing neural networks inside" src="https://cdn-images-1.medium.com/max/1024/1*T_nntrKUYH9QaeqE73DUtg.png" /></figure><p>Every millennial in tech has that moment when they decide: <em>this is it, this is what I want to do</em>. Some grew up tinkering with the family computer. Some just loved solving puzzles. For me, it was games. Not just playing them, but feeling them — wondering how a story could bloom inside a console, how a world could be built out of code and imagination.</p><p>After every game I finished, I’d watch the credits roll like a constellation of names and think, <em>Who are these people? How did they get here? Could I?</em></p><p>That wonder never left. It led me to software engineering, and now it keeps leading me into AI and machine learning, into XR, into the messy and magical places where technology and creativity collide. I guess you could call me a generalist: the kind who chases ideas across disciplines just to understand how the magic works. A tinkerer who learns by building, failing, breaking, and dreaming.</p><h3><strong>Why</strong></h3><p>The reason I’m starting this blog is to document my learnings as I wander through the ever-evolving landscape of technology, design, and creativity. It’s a place to reflect, explore, and connect the dots between disciplines, sometimes in unexpected ways.</p><p>This blog isn’t about having all the answers. It’s about asking better questions and sometimes building weird little things to explore them. Whether I’m breaking down a game’s progression system or experimenting with AI models, I’m here to share what I learn along the way, the wins and the messes.</p><h3><strong>Who</strong></h3><p>I did my Bachelor’s in Computer Science, and luckily, I had a humble but exciting start: my first job was running my own startup. We built casual games, and one of them took off in a big way. I loved every part of it. It was hard work, but it never felt that way. I spent my days (and many nights) working with a diverse team of exceptionally talented people, all driven by a shared love for games.</p><p>Like all good things, that chapter eventually ended. We made mistakes, but those missteps taught me some of the most valuable lessons of my career.</p><p>After that, I moved into the world of XR, where I developed AR, VR, and MR experiences, some of which were firsts in their category. From the world’s first AR shopping app for Eastern wear to a VR cricket game with a custom-built physical bat and haptic feedback, it was a time of relentless experimentation and innovation.</p><p>It was during this phase that I became fascinated with game design, not just how games look or feel, but the math and systems behind them. I realized you can have great mechanics, amazing AI, and polished gameplay, but if the design isn’t balanced, the game still falls flat. That insight led me deeper into understanding what makes games truly good.</p><p>Though I had worked with cutting-edge technologies and achieved more than I ever imagined, I found myself hungry for more. I realized I had pushed myself in programming, but there were still glaring gaps in my knowledge of game design, production, and storytelling. I didn’t want to just complain about those gaps in the industry; I wanted to be part of the solution. I wanted to create an environment where the next generation of game developers could thrive.</p><p>That’s when I decided to reset and relearn. I got accepted into the Master’s program in Game Design at NYU, where I immersed myself not only in design theory but also began my journey into AI and machine learning.</p><h3><strong>What</strong></h3><p>This blog is my sketchbook. It’s a space for practical insights, creative experimentation, and honest reflection. You can expect:</p><ul><li><strong>Hands-on AI/ML lessons</strong> — not just theory, but what it’s like to actually work with these tools: successes, dead ends, and surprises.</li><li><strong>Game design analysis</strong> — how systems are tuned, how progression works, and the math behind why some games just feel right.</li><li><strong>The intersection of AI/ML and game design</strong> — exploring how these fields inform, challenge, and elevate each other.</li><li><strong>Prototypes in XR</strong> — from wild ideas to working builds, and the lessons that emerge from blending physical and digital spaces.</li><li><strong>Reflections on being a dev</strong> in a shifting tech landscape — navigating uncertainty, staying curious, and building with purpose.</li></ul><h3><strong>How</strong></h3><p>By building in public. By sharing not just polished results but also half-finished prototypes, late-night questions, and the occasional creative tangent. I’ll write, code, analyze, and explore every step of the way.</p><p>So that’s the plan.</p><p>One part dev log, one part digital journal, one part mildly chaotic idea factory. If you’re into code, creativity, and the occasional rabbit hole into why a boss fight feels emotionally devastating (or deeply satisfying), you’re in the right place.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=518eda8118ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>