<?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 netsvetaev on Medium]]></title>
        <description><![CDATA[Stories by netsvetaev on Medium]]></description>
        <link>https://medium.com/@netsvetaev?source=rss-931a43d53d24------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*P1ZaqODzoCuhJ7uqtfy95A.png</url>
            <title>Stories by netsvetaev on Medium</title>
            <link>https://medium.com/@netsvetaev?source=rss-931a43d53d24------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 03:06:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@netsvetaev/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[Fear of AI, Technological Progress & Future Crisis]]></title>
            <link>https://medium.com/@netsvetaev/fear-of-ai-technological-progress-future-crisis-807c83d31e25?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/807c83d31e25</guid>
            <category><![CDATA[progress]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[crisis]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[future]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Fri, 01 Aug 2025 16:05:20 GMT</pubDate>
            <atom:updated>2025-08-01T16:07:20.204Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q6hE_eiZSNXvUdru.jpg" /></figure><p>Having dashes ( — ) as evidence of generative AI text is a funny idea. It used to be OK not to use dashes everyday: it was just hard to type it in Windows. But now everyone has dashes, even on smartphones. Experienced designers and writers know when to use which characters (around 10 similar but different ones).</p><p>All these years we have been trying our best to format texts correctly: with dashes, quotation marks, spaces and easily used error correction in Word, now what?</p><p>But the psychological reasons for the fear of generative dashes are more complex and interesting. Among other things, the “anti-dash movement” is an attempt to recognize “friend or foe”. it’s as if people are saying that <strong>being human = being wrong</strong>, and we’d rather be like uneducated savages, but different from robots. Bring on humanity!</p><p>I also see this reaction as fear of being unnecessary and easily replaced by the existing AI and at the same time recognizing their powerlessness: unlike the Luddites, who broke the few machines physically, now people just recognize that <strong>they can’t do anything</strong> against the corporations deciding their fate.</p><h3>Three small revolutions you haven’t noticed</h3><p>Fear as a reaction to any new technology is the norm, though. Do you know what people thought about PCs, Photoshop and the Internet in the 20th century?</p><h3>Personal Computers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bftsFcwA0rA_OoaL.jpg" /></figure><p>PCs appeared in 75–77 and people thought they were useless.</p><p>In 1982,<strong> 47% of Americans said they didn’t plan to buy a PC</strong> at all in the future.<br>People started talking about the dangers of PCs:</p><ul><li>It seemed that now <em>people would stop learning and thinking</em>, and autocorrectors would correct mistakes.</li><li>Those <em>who don’t learn to use computers will become redundant</em> and lose their jobs, and robots will replace workers. Same with AI generators.</li></ul><h3>Adobe Photoshop</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wHiafbxBkmQBc00eghC1MQ.png" /></figure><p>Photoshop 1.0 appeared in 1990. Professionals immediately realized: now <em>anyone</em> can do their work with minimal effort.</p><p>Many were against retouching. There was talk about the impact of photo manipulation on society: now it was possible to fake any photo and eyes could not be trusted!</p><p>By the mid-90s, it became clear that people had become less trusting and increasingly didn’t believe images and texts: they adapted to the new technology. Same with AI generators.</p><h3>Internet</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*NhlPclJX7gHI7gLdpclLng.png" /></figure><p>Networked computers were initially shown in pop culture as something dangerous and creepy (see Tron 1982 or The Net 1995 for example).</p><ul><li>People saw the Internet as even more dangerous than regular networks, and partly useless. “No database will replace the newspaper and the CD-ROM, no competent teacher, and no change in the way government works,” they wrote in 1995.</li><li>Before Google, the web was treated as an <em>archive of unverified, unfiltered information and feared fake news</em>.</li><li>Naturally, people doubted the possibility of paying for services over the Internet — cause there was no safe way to do it.</li><li><em>People were even afraid to use e-mail</em>, preferring faxes and face-to-face communication.</li></ul><p>Now we’re going through roughly the same thing with the new generation of neural networks and content generators.</p><h3>AI illusions</h3><p>Don’t get your hopes up: <a href="https://netsvetaev.com/blog/ai/what-will-become-important-in-the-ai-age/">modern AI will not replace you</a>. Yes, with every leap in technology, entire industries may have disappeared. There are no more printing presses, no more metal lettering and monotyping, lithography on an industrial scale. But people have learned new technologies, manufacturers have switched to new devices, and we still read books (despite e-ink).</p><p>You will have to <a href="https://netsvetaev.com/blog/design/ai-will-took-your-job-if-you-dont-use-it/">learn modern tools to stay in the profession</a> and change your role to a more leadership and proactive one. You’ll be setting tasks to ChatGPT instead of chatting with people. There also will be more work, but you will do it faster.</p><h3>Future crisis</h3><p>In a few years there will be another disillusionment with generative models, which are already starting to hit the limit of the existing 2017 architecture (still, I hope <a href="https://arxiv.org/pdf/2501.00663">Google will change it</a>). Investors will stop throwing money around. Startups that are now being given billions will go bankrupt. The dotcom crash will seem like an imperceptible rehearsal for the future crisis. Be prepared.</p><p>What makes me think that there will be a disillusionment and economic crisis? First of all, ChatGPT and N8N will not solve all the problems of the world, and OpenAI has raised<strong> tens of billions</strong> for the idea of a bright future with AGI right now<em>tomorrow</em>.</p><p>Secondly, progress develops non-linearly: after short periods of enthusiasm and active growth and implementation, there is always a phase of slowdown and rollback in R&amp;D as soon as the boundaries become clear.</p><p>All this was already the case in the 70s and the technology was developed a lot since, but we don’t know how long it’s going to take to get there. And by the way, what is <em>there</em>?</p><h3>About me</h3><p>My name is Artur Netsvetaev, I am a product manager, <a href="https://netsvetaev.com/blog/category/projects/">entrepreneur</a> and UI/UX designer. I write <a href="https://netsvetaev.com/blog">about AI</a>, <a href="https://netsvetaev.com/blog/category/music/">music</a> and design.</p><p><a href="https://netsvetaev.com/blog/ai/fear-of-ai-technological-progress-future-crisis/">https://netsvetaev.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=807c83d31e25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 Books Every Designer Must Read]]></title>
            <link>https://medium.com/@netsvetaev/7-books-every-designer-must-read-d29032aed16c?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/d29032aed16c</guid>
            <category><![CDATA[ui-ux-design]]></category>
            <category><![CDATA[design-principles]]></category>
            <category><![CDATA[fonts]]></category>
            <category><![CDATA[books-recommendation]]></category>
            <category><![CDATA[typography]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Wed, 30 Jul 2025 16:24:54 GMT</pubDate>
            <atom:updated>2025-07-30T16:24:54.339Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*06xdS21RqiXJPx_enIz60Q.jpeg" /></figure><p>When I was learning web &amp; graphic design in 2004–2006, there were no any modern commercial designcourses in Russia at all, so I learned from classic books on design and typography. Now I think that English-speaking designers should be reminded of them as well.</p><p>There are a lot of books, the more fundamental, the older, the better — UI/UX design is standing more on psychological and social principles than technological ones.</p><h3>1. The Complete Manual of Typography — J. Felici</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/0*geYZ5UajfuYULXCm.jpg" /></figure><p>An essential guide to professional typesetting and typography principles, widely used in design education. James Felici is a publishing veteran with over 30 years of experience in both traditional and digital typography.</p><p>Designers should read this book to grasp fundamental typography skills and create readable, professional text layouts.</p><h3>2. Stop Stealing Sheep &amp; Find out how type works — E. Spiekermann</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/201/0*9xts3PVHUl7UUJOd.jpg" /></figure><p>A compelling introduction to typography, exploring how type affects readers and how to choose and use fonts effectively. Author Erik Spiekermann is a renowned German typographer and co-founder of the pioneering digital type foundry FontShop.</p><p>Designers should read this book to master basic typography and thoughtful font selection.</p><h3>3. The New Typography — Jan Tschichold</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*TbbmPI8Q868XBvRJ8iMW6g.jpeg" /></figure><p>This manifesto of modernist graphic design set the rules for contemporary typography, advocating asymmetry and functional simplicity. Interestingly, Tschichold later criticized his own movement for excessive rigidity.</p><p>Designers should read it to understand the origins and evolution of today’s typographic conventions.</p><h3>4. The Design of Everyday Things — D. Norman</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/193/0*V_ccpT3D0RkvsINn.jpg" /></figure><p>Donald Norman’s iconic book explores how the design of everyday objects influences user experience. It argues that user errors are usually caused by poor design rather than user incompetence. Norman coined the term “user experience” and championed human-centered design.</p><p>Designers must read it to learn core principles of intuitive and user-friendly design.</p><h3>5. The Inmates Are Running the Asylum — A. Cooper</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/199/0*VCMj-iOFhnUhouSN.jpg" /></figure><p>This book explains why digital products often frustrate users and how to avoid common pitfalls. Alan Cooper, known as the “Father of Visual Basic,” argues that when engineers dominate design decisions, usability suffers. He introduces the “persona” approach to user-centered design. I personally like the variety of examples of UI he provide: not only computer GUI, but physical interfaces, too.</p><p>Designers should read this to create friendlier software and hardware products.</p><h3>6. About Face — A. Cooper</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/0*2B4btl39xgw5pNQ5.jpg" /></figure><p>A foundational guide to interface design, this influential book systematized UI design principles and introduced Goal-Directed Design. Alan Cooper founded one of the earliest UX design companies, shaping modern user experience practice.</p><p>Essential reading for designers aiming to build systematic, intuitive interfaces.</p><h3>7. The Humane Interface — J. Raskin</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/204/0*8WFotrcjIgwsqTIp.jpg" /></figure><p>Jef Raskin, initiator of Apple’s Macintosh project and inventor of the one-button mouse, addresses human cognitive limits and advocates eliminating modes in interfaces to improve usability. Designers should read this book to reconsider conventions and create simpler, more human-friendly interactions.</p><h3>What Else?</h3><p>Of course, there are plenty of great books by other authors. For example, Jakob Nielsen is another living classic. His work has more to do with the internet and the usability of websites. Nielsen and Norman created a company to research user behavior and formulated effective ways to test usability.</p><p>What would you add to this list?</p><h3>About me</h3><p>My name is Artur Netsvetaev, I am a product manager, <a href="https://netsvetaev.com/blog/category/projects/">entrepreneur</a> and UI/UX designer. I write <a href="https://netsvetaev.com/blog">about AI</a>, <a href="https://netsvetaev.com/blog/category/music/">music</a> and design.</p><p><a href="https://netsvetaev.com/">https://netsvetaev.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d29032aed16c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What will become important in the AI age]]></title>
            <link>https://medium.com/@netsvetaev/what-will-become-important-in-the-ai-age-38e8b9fc096c?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/38e8b9fc096c</guid>
            <category><![CDATA[humanism]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[future]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[art]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Mon, 28 Jul 2025 16:16:12 GMT</pubDate>
            <atom:updated>2025-07-28T16:16:12.196Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IyV2fsZhs-fBcMTMs6Fjog.png" /></figure><p>It’s interesting to see who and what will be valued when GPT will be able to generate<em> whatever </em>you want.</p><p>I’m going to assume that style over <a href="https://netsvetaev.com/blog/ai/i-trained-a-neural-network-on-my-drawings/">stylization</a> will be increasingly important. Distinctiveness in the work of specific artists — as opposed to the averageness of generative art. Peculiarity, authenticity, randomness. Increasingly subtle and complex combinations of details that are only possible in the mind of someone with a particular experience and culture. The individual, not the corporation.</p><p>Generalizing modern stereotypes and the most popular things is easy enough: consider that everything you can easily recall and imagine can already be reproduced with sufficient accuracy. But what about specific hard-to-recall and even endangered cultures? What about those who, as a matter of principle, haven’t publish their original work online, unable or unwilling?</p><h3>Stranger things</h3><p>In fact, a lot of interesting things will remain offline: in tribes, in villages, in archives and libraries that nobody cares about. Perhaps the raise of generics and general averageness (like the “sterile studio look” of many box-office Hollywood movies ) will lead to an interest in previously unknown independent authors.</p><p>As before, unusual outliers and unknown authors will be of interest for several reasons. Of course, the first reason is to collect and digitize more data, to add to the model to differentiate from the competors. To me, corporations themselves will eventually go and dig out new and unusual examples of creativity to surprise users (and sell more subscriptions). Of course, over time, the authors will be paid some money for this — like Spotify pays musicians for the number of listens (you know, <em>how much</em>).</p><h3>Death of the author</h3><p>The second reason is the living authors themselves, personally filtering reality with their own consciousness and creating something new. It is the author’s personality that will become important and defining: no matter how you stylize, the author always knows how he himself would have done, what he would have changed.</p><p>Also, many curious results and style-forming elements of creativity are achieved by <a href="https://netsvetaev.com/blog/ai/qa_mdt-training-without-lmdb/">experiments</a>, accidents, changing interests and experience — many people miss this, not realizing that the author changes every second, while the neural network doesn’t (and even if it does, it will still be in another direction).</p><p>However, a rehearsed and fixed studio recording (and generated content, too) doesn’t cancel going to a live concert improvisation. For people, an emotional connection with the author is always important — identity, belonging to a certain community, sharing values, emotions and views with other living beings. Artificial intelligence can reproduce the form, but it cannot create a real personal story, and the author’s attitude to it. These specific details that make the consumer feel involved and emotionally engaged.</p><p>Presence in a common database and the possibility to generate something “in style of” will probably only provoke more curiosity about persons and phenomena we have never heard of before, and in general — about accidents, happenings, performances, live concerts and other things that are of much much less in the recorded form.</p><p>As a result, on the one hand, the development of generative reproduction will continue the trend of the “<a href="https://en.wikipedia.org/wiki/The_Death_of_the_Author">death of the author</a>” and the separation of the individuals from their works, and on the other hand, it will begin the revival of the author.</p><h3>About me</h3><p>My name is Artur Netsvetaev, I am a product manager, <a href="https://netsvetaev.com/blog/category/projects/">entrepreneur</a> and UI/UX designer. I write <a href="https://netsvetaev.com/blog">about AI</a>, <a href="https://netsvetaev.com/blog/category/music/">music</a> and design.</p><p><a href="https://netsvetaev.com/">https://netsvetaev.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38e8b9fc096c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I recreated MacOS Launchpad in 4 hours with ChatGPT]]></title>
            <link>https://medium.com/@netsvetaev/how-i-recreated-macos-launchpad-in-4-hours-with-chatgpt-253488f2f2ca?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/253488f2f2ca</guid>
            <category><![CDATA[launchpad]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[gpt]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Fri, 25 Jul 2025 17:07:44 GMT</pubDate>
            <atom:updated>2025-07-25T17:07:44.336Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TiMLTLQEmU7lsm8gwJds7g.jpeg" /></figure><p>Apple removed Launchpad from macOS 26 Tahoe, replacing it with a modest pop-up “Apps” window as a part of so-called Spotlight (search). Such a move seemed like a step backward to me, so I wrote my own Launchpad clone in one morning, vibe-coding style.</p><h3>Old Launchpad is:</h3><p>— 7 × 5 icon grid, independent pages, drag-and-drop, and folders<br> — instant in-grid apps search<br> — Automatic tracking of /Applications and ~/Applications;<br> — Storing layouts separately from Apple DB (JSON in ~/Library/Application Support).</p><h3>Important note</h3><p>It was an experiment. I understand a bit of python and C++, but I’d never touched SwiftUI before; 80% of the time was spent polishing the UI. I used the o3 model, only 3 different chatgpts were used; chatgpt itself fixed bugs directly in Xcode.</p><h3>Download</h3><p><strong>Code and finished .app: </strong><a href="https://github.com/netsvetaev/Old-Launchpad"><strong>https://github.com/netsvetaev/Old-Launchpad </strong></a><strong>(BSD-3 license).</strong><br>Fork it, change it &amp; show Apple that Old Launchpad is still needed!</p><h3>Video demo</h3><p><a href="https://netsvetaev.com/blog/wp-content/uploads/2025/06/launchpad-demo.mov">launchpad-demo.mov</a></p><h3>Process</h3><p>Previously I’ve been writing small apps and bots in python since 2022 with ChatGPT and IDE Void in the same way. Now I thought, why not to try re-create a real desktop app?</p><p>So I connected ChatGPT o3 and 4.1 to my XCode and described what I want to do and most importanly how I want it.</p><p><a href="https://netsvetaev.com/blog/wp-content/uploads/2025/06/launchpad-code.mov">launchpad-code.mov</a></p><p>I started with deep research o3 model and a simple task:</p><pre>You are an experienced macOS, Swift UI, and Xcode programmer.<br>Problem: In the new version macOS 26, Launchpad has been removed — the screen with applications where icons could be grouped into folders and arranged in any order. Now applications are displayed in Spotlight and are strictly tied to the alphabet or built-in automatic categories. <br>My idea: create your own app that replicates the old Launchpad.<br>Figure out how to do this. Write the app structure for macOS. Think through the architecture. And suggest a minimal code option that can be compiled in macOS 26.</pre><p>GPT asked me some questions about how it should work, for example, do I need to show all apps from the /Applications folder, do I need drag’n’drop and folders and so for an MVP. Then, it’d searched for solutions on various websites, from apple official manuals and stackoverflow, to macrumors and a few blogs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*0eUxZsCA0D2i9JTTwzgs3Q.png" /></figure><p>GPT proposed to use LazyVGrid as an icons container:</p><pre>struct LaunchpadView: View {<br>    @ObservedObject var viewModel: LaunchpadViewModel<br>    let columns = Array(repeating: GridItem(.fixed(100), spacing: 20), count: 6)<br>    <br>    var body: some View {<br>        VStack(spacing: 20) {<br>SearchBar(text: $viewModel.searchQuery)<br>            ScrollView {<br>                LazyVGrid(columns: columns, spacing: 20) {<br>                    ForEach(viewModel.filteredApps) { item in<br>                        AppIconView(item: item)<br>                            .onDrag { <br>                                viewModel.dragItem = item<br>                                return NSItemProvider(object: item.id as NSString)<br>                            }<br>                            .onDrop(of: [.text], delegate: AppDropDelegate(item: item, viewModel: viewModel))<br>                    }<br>                }<br>            }<br>        }<br>        .frame(maxWidth: .infinity, maxHeight: .infinity)<br>        .background(backgroundView) <br>    }<br>}</pre><p>And a semi-transparent background:</p><pre>var backgroundView: some View {<br>    VisualEffectView(material: .hudWindow, blendingMode: .withinWindow)<br>      .ignoresSafeArea()<br>}</pre><p>I also wanted to remove apps more easily than by click on a small cross icon, so I asked to add a context menu:</p><pre>AppIconView(item: app)<br>    .contextMenu {<br>        Button(role: .destructive) {<br>            viewModel.delete(app: app)<br>        } label: {<br>            Text(&quot;Delete \&quot;\(app.name)\&quot;&quot;)<br>            Image(systemName: &quot;trash&quot;)<br>        }<br>    }</pre><p>If I get it right, all these features were created very easy with some default MacOS APIs. For example, search is 17 lines only:</p><pre>struct SearchBar: View {<br>    @Binding var text: String<br>    var body: some View {<br>        HStack {<br>            Image(systemName: &quot;magnifyingglass&quot;)<br>            TextField(&quot;Search&quot;, text: $text)<br>                .textFieldStyle(.roundedBorder)<br>                .disableAutocorrection(true)<br>            if !text.isEmpty {<br>                Button(action: { text = &quot;&quot; }) {<br>                    Image(systemName: &quot;xmark.circle.fill&quot;).foregroundColor(.gray)<br>                }<br>            }<br>        }<br>        .padding()<br>    }<br>}</pre><p>There were more code and its iterations. Typical problems were with an old code, incopatible with my Tahoe version of XCode/Swift, but it’s all was almost automatic right in my XCode</p><h3>Tuning the UI/UX</h3><p>The most difficult thing was not the re-write the code of an original app (despite I spent much time to make the folders work as I want), but to fine-tune the animations, hovers, the look &amp; feel of the app. I had two major problems:</p><ol><li>The standard swipe animations were too slow and unresponsive compared to the original Launchpad.</li><li>The apps didn’t fit in the grid! When an app was added or deleted, either empty cells remained on the screen or they were added to the next screen.</li></ol><p>The first issue was solved by search in apple docs. GPT proposed this numbers:</p><blockquote><em>Launchpad relies on the same </em><strong><em>interactive spring</em></strong><em> Apple presents in WWDC sessions on spring animations: a critically damped spring (ζ≈0.85) with a short response (≈0.35 s) and no overshoot. When the pan gesture ends, the current offset is compared with a </em><strong><em>0.12 page-width threshold</em></strong><em>; meeting that threshold commits to the next page, otherwise it snaps back. To mimic the feel, remove .scrollTargetBehavior, keep an interactiveSpring of </em><strong><em>response ≈ 0.35 s, damping ≈ 0.85, blend ≈ 0 s</em></strong><em>, and use a swipe threshold of </em><strong><em>12 % of page width</em></strong><em>. These numbers reproduce the ease-in/out curve, slight deceleration, and subtle “ease over” that Launchpad shows.</em></blockquote><blockquote><em>— ChatGPT</em></blockquote><p>But theese didn’t feel right. So I manually tuned the animations.</p><p>The problem with the grid reminded me of a similar problem in <a href="https://masonry.desandro.com/">JS masonry grids</a>, where sometimes I had issues with the right positioning of the objects. In short, the grid incorrectly calculated the number of free cells and the corresponding location of objects in them.</p><p>I have more or less solved this problem, but even now I’m not sure if there isn’t a bug somewhere. The time I could spend on the project (around 6 hours) ran out, and after fixing the main bugs, I published the project on GitHub.</p><h3>Download</h3><p><strong>Code and finished .app: </strong><a href="https://github.com/netsvetaev/Old-Launchpad"><strong>https://github.com/netsvetaev/Old-Launchpad </strong></a><strong>(BSD-3 license).</strong><br>Fork it, change it &amp; show Apple that Old Launchpad is still needed!</p><h3>Author</h3><p>My name is Artur Netsvetaev. I’m a <a href="https://netsvetaev.com/blog/category/design/">UI/UX Designer</a>, Product Manager, <a href="https://netsvetaev.com/blog/category/projects/">Entrepreneur</a> with 20+ years of experience. Interested in <a href="https://netsvetaev.com/blog/category/ai/">AI &amp; Startups</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=253488f2f2ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Made a Delivery Service in Montenegro at COVID-19 Time]]></title>
            <link>https://medium.com/@netsvetaev/how-i-made-a-delivery-service-in-montenegro-at-covid-19-time-85982949ca31?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/85982949ca31</guid>
            <category><![CDATA[montenegro]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[delivery]]></category>
            <category><![CDATA[create-online-store]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Fri, 25 Jul 2025 16:54:09 GMT</pubDate>
            <atom:updated>2025-07-25T16:55:47.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Yr1v2nYuP89lQ5nlZJTvA.jpeg" /></figure><p>In 2020, my friends suggested to start food and goods delivery in Montenegro. I agreed — I have experience in <a href="https://netsvetaev.com/">developing IT products</a> and <a href="https://netsvetaev.com/personal/openmonte/">created several communities</a>, and they have couriers. I was curious.</p><h3>Small montenegrin market</h3><p>Year 2020: COVID-19, everyone is staying at home. There is still no affordable yet quality Russian-language service: courier delivery is still not usual in Montenegro — couriers are often late or forget about orders at all, and only speak Serbian.</p><p>Until 2020, restaurant delivery was only provided by a local service Donesi, which was bought by Spanish startup Glovo after several years of operation. Products delivery from the local supermarket Voli was only available in one city — Podgorica. In general, this market segment was small, but free.</p><h3>How much did it cost to launch the delivery service?</h3><p>My friends were already delivering their own homemade food and had a good reputation, but they wanted to grow and simplify their work. I had access to a Russian-speaking audience and <a href="https://netsvetaev.com/blog/about-art-netsvetaev/">good experience in advertising and website development</a>.</p><h3>Investments? Around zero!</h3><p>The initial advertising was free for me — through my communities. Then I spent a few hundred dollars from my income part on targeting on Facebook and Instagram.</p><p>I built the websites myself at minimal cost. But if you count the actual work, I spent about €2,000 and 3 months on website development: landing pages with a delivery custom order form, a store website with 1,000 products and several iterations of wordpress templates, plus minor improvements and refinements to plugins, templates, and my time to set up the ads.</p><p>I wanted to make a turtle on a skateboard as the logo, so I paid a colleague €100 to do it. I thought it was funny enough for a delivery.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CySvqiv17JEtSeWF26nySQ.png" /></figure><h3>How the delivery service worked</h3><p>For the first months, we only delivered items, documents, and home-cooked meals.</p><p>I came up with a handy order calculator for things delivery: we had reasonable volume and weight limits on things. Also, members of my <a href="https://www.facebook.com/groups/montesell">Facebook community for selling used things</a> received a discount on the delivery service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*yVxKDhhsrcQcAQ6VQmKbhQ.png" /></figure><h3>Where to go?</h3><p><strong>Delivery was difficult: </strong>Montenegro is a small country, so maps often don’t show streets or houses. But we were prepared for this. I ordered my own WordPress plugin so that when placing an order, the customer could mark their location on the map and save the coordinates for the couriers, who would then add them to their car navigation system.</p><p><strong>We had refrigerators for transporting frozen products and special bags for keeping food warm.</strong></p><p>Since there were few customers at the beginning, we only delivered 2–3 days a week at the start — but we’re able to cover all the major cities in the country. We made an exception for our city Bar — and delivered there every day.</p><h3>Online store for shops in several cities</h3><p>To develop a food delivery service, we reached an agreement with the local “Russian” (actually German) supermarket chain MixMarkt: they base their marketing on products that are familiar to Russian-speaking immigrants in Europe. I created a separate website for the store in our city, and then added stores in other cities.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Ff0-zVmD7FyQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Df0-zVmD7FyQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Ff0-zVmD7FyQ%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b2705c202572d5bee0088d5d450a32e4/href">https://medium.com/media/b2705c202572d5bee0088d5d450a32e4/href</a></iframe><p><strong>It worked like this:</strong></p><ol><li>The user placed an order on the website.</li><li>The store picked up the order on the same day in the evening.</li><li>The courier picked up the order the next morning.</li><li>The buyer received the order in the evening.</li></ol><h3>Delivery service issues</h3><p>A major issue was in a<strong> warehouse synchronization with the products on the website</strong>. Montenegro has its own accounting system linked to the local tax authority, but it was impossible to connect it to the WordPress website. In addition, we soon had other stores with different products — each city had its own.</p><p>We had to specify on the website that some products might not be available and contact customers to replace missing items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*m1MG7LI2kdBG23XcJmMjWg.png" /></figure><p><strong>The second problem was store control.</strong> Supermarkets appeared in our delivery process, over which we had almost no influence. In some cases, stores forgot to pick up orders on time or contact customers to clarify the contents, and sometimes they simply forgot to include certain products.</p><p>Due to the lack of overall inventory synchronization, customers sometimes received only half or even a third of their order. The prices on the website did not match the actual prices, and store employees didn’t want to spend time correcting them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qu2TF1nalXQkN5CTCDCkhw.png" /></figure><p>As a result, about half of the collected baskets (which we, of course, tracked in detail) and orders in WooCommerce did not match what was actually paid for.</p><p><strong>These errors affected our reputation: I was responsible for all advertising under my brand, Openmonte</strong>.</p><h3>Additional sales sources</h3><h3>Facebook store</h3><p>In addition to the website, I created a Facebook store for Mixmarkt. Technically, it was simple: products were automatically uploaded via the official Facebook plugin. There was no ordering through the Facebook catalog — the main button led to our website. I only needed to additionally configure the ad pixel to track users and returns to the website.</p><p><strong>Problems arose with moderation: </strong>Facebook had a very strange attitude toward certain product categories. Sometimes I received messages about the removal of alcoholic beverages, but some of them remained available. <strong>Sometimes sausages, red fish, caviar, and pork were equated with the sale of animals</strong> and cruelty to them, but they also remained partially available in the catalog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pfcq4PshUGugMvVouU3Agw.png" /></figure><h3>Telegram bot for a delivery</h3><p>Through a simple WordPress plugin, I also launched a bot on Telegram — the Russian-speaking audience and my communities were there, so the bot was convenient for users. It was the first bot in Montenegro for ordering products.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*fbQCjK3IcIg7wZ4-8KzivA.png" /></figure><h3>Advertising</h3><p>The main source of traffic was Facebook and Telegram. I decided to remind people about the delivery service in several ways:</p><ol><li><strong>Write interesting articles about food products for social media</strong>. I don’t like hard SEO and SMM, so our articles were a little unusual (thank you, Catherine). People actively shared them along with information about our delivery service on Facebook and Instagram. Some users even thank us for such a good native ads.</li><li><strong>Add recipes from products available in the store to the website and order them with one click</strong>. Usually, recipes are added so that the online store has some thematic content. But I went a little further and allowed all the products listed in the recipe to be added to the cart.</li><li><strong>Targeted advertising and reposts</strong> in my communities worked well in conjunction with the store on Facebook. Facebook allows you to tag products from the catalog in pictures in posts, so people could go to specific products and then to our website to place an order.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*BnA1goBADbQQXPjIFexVRQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*3JMd9A6MsM-PibQOwZuV4w.png" /></figure><p>At one point, we even decided to try shooting promotional product reviews. I did a few test runs, but I was dissatisfied with the quality of the recording. The store refused to give a budget for proper filming, so I abandoned the idea.</p><h3>Results</h3><p>The delivery service lasted around three years: since late fall 2022, I have had no connection with the MixMarkt website and am no longer involved in delivery.</p><p>Much remained unfulfilled: at some point, we wanted to deliver flowers and add at least some synchronization with cash registers and actual store inventories for stores.</p><p>There were enough food orders and they’re stable, but due to the nature of MixMarkt’s products line, most of them were for holidays and birthdays: people wanted their borscht, salads, caviar, condensed milk and buckwheat porridge. Prices in these stores were higher than usual in Montenegro. In addition, the weather had an impact: rain and heat led to an increase in the number of orders.</p><p>But Montenegro is a small country with a specific geography. The lack of a large market does not allow for rapid business development or large investments — it will not pay off, no matter what you plan to do there, and even more so in the limited Russian-speaking segment. For example, my communities in Montenegro pay for themselves and bring in a small profit — but nothing more, and I can’t scale it properly.</p><p>By the time of delivery launch, I had already created my own online store and many e-commerce websites for others. Nevertheless, the development of this delivery service was an interesting and useful experience as <a href="https://netsvetaev.com/blog/posts/business/">any business</a>.</p><p>More on <a href="https://netsvetaev.com/personal/openmonte/">Openmonte services and communities</a>.</p><h3>Author</h3><p><strong>My name is </strong><a href="https://netsvetaev.com/blog/author/netsvetaev/"><strong>Artur Netsvetaev</strong></a><strong>. </strong>I’m a UI/UX <a href="https://netsvetaev.com/blog/category/design/">Designer</a>, Product Manager, <a href="https://netsvetaev.com/blog/posts/business/">Entrepreneur</a> with 20+ years of experience. Interested in AI &amp; Startups.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85982949ca31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UI/UX of Modern AI Web Browsers]]></title>
            <link>https://medium.com/@netsvetaev/ui-ux-of-modern-ai-web-browsers-374594e39da9?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/374594e39da9</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ui-ux-design]]></category>
            <category><![CDATA[preplexity]]></category>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Thu, 24 Jul 2025 17:25:50 GMT</pubDate>
            <atom:updated>2025-07-24T17:25:50.574Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jNk6JGxF0Ytvl5U-s1DNnA.jpeg" /></figure><p>Web browsers are changing rapidly: some are incorporating small AI-features, while others are built around AI assistants, chatbots, and voice input. Since I spend a significant amount of time in my browser every day, I tried to figure out what is happening with interfaces and what they might become in the future.</p><h3>Key new features of AI browsers:</h3><ul><li><strong>Voice control. </strong>Almost all AI browsers implement voice input. Examples: in Arc, you can simply voice your question; in SigmaOS, you can control the browser with your voice; Opera and Aria respond to the user aloud. The voice assistant becomes a conversation partner, which is especially convenient when on the move. <em>Still, I prefer the old text-and-buttons UI and can’t imagine how to work with voice ui when I listening to music.</em></li><li><strong>Chatbots in the UI. </strong>Chat is built right into the browser (sidebar or a separate window). AI assistant sees open pages, can summarize text, and help with tasks (for example, <a href="https://netsvetaev.com/blog/ai/using-new-chatgpt-agent-in-a-real-life/">buying a product </a>or scheduling a meeting). In SigmaOS, Perplexity, Edge, and Opera, chatbots are becoming an integral part of the interface.</li><li><strong>Workspaces and tabs.</strong> Browsers are rethinking how they work with tabs: now they are combined into “workspaces” (Spaces, Workspaces), where you can separate projects and topics. This reduces chaos, with tabs automatically hidden when not in use.</li><li><strong>Address bar is now multifunctional: </strong>you can search, ask questions, or run commands with the assistant. In Arc and Dia, queries and commands are executed directly from a single text field.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TZDICuZaZKRAu40_.png" /><figcaption>SigmaOS</figcaption></figure><h3>UX changes</h3><p>AI is changing the way we use browsers: instead of traditional navigation, we now interact with a chat UI. The user formulates a task, and the browser searches for information, compares options, and performs tasks.</p><p>The most important aspect is trust and control. The LLM’s answers are accompanied by links to sources, and all important actions require user confirmation — it’s better than AI’s mistakes. The user sees what the AI is doing and can correct actions or disable functions if necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*48JD0VCK3FPxbtzz.jpg" /><figcaption>Dia Browser (<a href="https://stadt-bremerhaven.de/dia-der-neue-browser-der-arc-macher/">source</a>)</figcaption></figure><h3>The main principles of the new UX design:</h3><ul><li><strong>Natural language</strong> and dialogue instead of complex navigation.</li><li><strong>Proactive assistance: </strong>the assistant itself suggests useful actions.</li><li><strong>Seamless experience: </strong>all functions are available in a single UI and synced.</li><li><strong>Personalization: t</strong>he browser adapts to the user’s habits on the fly.</li><li><strong>Transparency and control: </strong>sources and task progress are visible, and actions can be easily canceled or adjusted.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9a3KopFudRkfgacljrNXjw.jpeg" /><figcaption>Preplexity Comet</figcaption></figure><h3>Mobile AI browsers:</h3><ul><li><strong>Mobile devices are still compact: </strong>the focus is on voice input and quick responses without unnecessary clicks. In Arc Search and Opera, users can simply say their question, and the assistant will instantly provide an answer, while the UI is as minimalistic as possible.</li><li>Chatbots, summaries of long texts, and intelligent<strong> prompts are integrated</strong> into the mobile UI, saving the user time.</li><li>Mobile AI browsers are becoming <strong>part of the ecosystem</strong>, integrating with other applications (such as calendars or maps).</li><li>Everything is moving towards a <strong>“AI-browser-assistant in a pocket”</strong>: fast, personalized, voice-activated — solutions appear with just a couple of gestures.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XDmTMUiCYRixftOj.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*20TXDDEVBVcbH8Uq.png" /></figure><h3>Fine line between desktop &amp; mobile</h3><p>Traditional browsers (Chrome, Safari, Firefox) remain universal tools for browsing the web: the familiar UI with tabs, search, and navigation depend on the user. Development is gradual: acceleration, new modes, improved privacy and light experiments. AI features are mainly added through extensions, while built-in AI is just emerging and has little impact on the interface.</p><p>AI browsers (Arc, Perplexity, SigmaOS, Opera Neon, Edge with Copilot) are built around artificial intelligence from the outset: chatbots, voice control, chat commands, task automation. <strong>The boundaries between browser and assistant are blurring — users are increasingly interacting with AI directly.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V30VwnMODfRebqw6Ej14GQ.jpeg" /><figcaption>Opera Neon — Agentic Browser</figcaption></figure><p>We are already seeing different but similar LLM features and AI agents in browsers, LLMs, and even at the OS level (hi, Apple). In the near future, these UIs may disappear aat all, penetrating deeper and deeper into every feature of every application we are familiar with.</p><p>Ideally, users should not even know whether their application or device has AI — they’ll just use it. The best interface is invisible.</p><h3>About me</h3><p>My name is Artur Netsvetaev, I am a product manager, entrepreneur and UI/UX designer. I write <a href="https://netsvetaev.com/blog">about AI</a>, music and design.</p><p><a href="https://netsvetaev.com/">https://netsvetaev.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=374594e39da9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using New ChatGPT Agent in a Real Life: Raw, But it Works]]></title>
            <link>https://medium.com/@netsvetaev/using-new-chatgpt-agent-in-a-real-life-raw-but-it-works-0bc1a6785090?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bc1a6785090</guid>
            <category><![CDATA[food-ordering-app]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[gpt]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Thu, 24 Jul 2025 13:14:11 GMT</pubDate>
            <atom:updated>2025-07-24T13:14:11.805Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mS-aWa0ACLyR7kWhXL4fNw.jpeg" /></figure><p>I just tried OpenAI’s Agent for my typical supermarket order: milk 1l, bananas 1kg, 2 mangos and any potato chips. After 12 minutes, it said:</p><blockquote><em>All of the following items have been found and added to your cart: Parmalat milk, 1 liter (1 item) Bananas — 8 pieces, which is approximately 1.08 kg. Mangoes — 2 pieces (approximately 0.97 kg). Chips (PAPA FRITA ORIGINAL).</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/0*coFzh3B2KV6zRTqF.png" /><figcaption>Small browser previews looks funny</figcaption></figure><p>By the way, I’m in Paraguay and this website is in spanish only, but I can use any language with GPT. So, the agent hunted through a jittery grocery website, filled my cart with close enough items, and politely stopped short of checkout (it can’t do that without user’s action).</p><p><em>This thing will save me at least 4 hours a week!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*w_1hJgC6YJ8SjS6zwtvHXw.png" /><figcaption>And yes, it did the job!</figcaption></figure><h3>What is ChatGPT Agent?</h3><p>A chatbot with its own virtual browser, terminal, and mini-apps to finish multistep tasks by itself. It can scroll, click, fill forms, run code, and even juggle APIs without sending you loads of follow-up questions.</p><h3>Open source alternatives</h3><p>Two monts ago I tried <a href="https://github.com/browser-use/browser-use">browser-use</a> agent with OpenAI’s API. It worked well through a local browser, but was very slow.</p><h3>Faster grocery orders with GPT Agent reusable prompt</h3><p>After a few experiments, I wrote a plain document that spells out every click the agent should make. Now my entire prompt is just:</p><blockquote><em>Run the task described in my note.</em></blockquote><p>ChatGPT with enabled app connection loads the document from MacOS Notes as context, follows the checklist, and searches up whatever I’ve written inside the list. I can reuse that script and tweak in seconds.</p><p>The note contents are:</p><pre>1. Go to https://losjardinesonline.com.py<br>2. Log in with my login … and password …<br>3. Open my saved products list at https://losjardinesonline.com.py/mi-lista?id=615<br>4. Add the following to cart: <br><br>Milk 1 L<br>Cream 500 ml<br>Coke Zero 2 L<br>Dark chocolate (sugar-free) 1 bar<br>Sweet white wine 1 bottle<br>Tomatoes 2 kg<br>Maestra pasta 1 pack</pre><p>For a better experience I allso added a full list of my products with ID’s from that store, so GPT can find exact products right here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/0*cm-vFEff7k_A7tFP.png" /></figure><h3>OpenAI Agent’s current limits</h3><ul><li><strong>Slow speed: </strong>even OpenAI admits it’s slow. In my previous grocery test it added 7 items in 9 minutes. The full order is around 35 items, so I think you can expect 45 minutes?</li><li><strong>No checkout:</strong> disabled for safety, through I would like to see that as a feature in next updates.</li><li><strong>Layout difficulties: </strong>captchas, pop-ups, dynamic JS links, hovers — works a little worser than expected.</li><li><strong>Server’s ban: </strong>I saw the 502 error too often in the process of crawling.</li></ul><h3>Agent’s possible activities</h3><ul><li><strong>Meal prep: </strong>paste a recipe; the agent builds a shopping list and fills a cart on Instacart or Walmart.</li><li><strong>Office supply: </strong>same as I did, but for office needs</li><li><strong>Price compare: </strong>Compare the same products across several stores and drop the cheapest in your basket.</li><li><strong>Birthday gift:</strong> browse Etsy or Amazon, shortlist ideas, and remind you before the shipping cut-off.</li><li><strong>Subscription end: </strong>some services have <a href="https://netsvetaev.com/blog/design/why-is-bad-ux-actually-good/">too complicated subscription canceling</a>, so GPT may help get rid of them and save your time.</li><li><strong>Accessibility help: </strong>For users with limited mobility, voice a shopping list and let the agent clicks through a website.</li></ul><h3>What do I think</h3><p>I’m Artur, <a href="https://netsvetaev.com/blog/category/design/">UI/UX Designer</a>, Product Manager, Entrepreneur with 20+ years of experience. Interested in <a href="https://netsvetaev.com/blog/category/ai/">AI, ML</a> &amp; Startups. OpenAI’s new ChatGPT Agent feels like a bit raw technology, which still just gets things done. It looks like a more reliable product than opensource agents.</p><h3>What do <em>you </em>think?</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bc1a6785090" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Melodiya and its Plants in USSR]]></title>
            <link>https://medium.com/@netsvetaev/melodiya-and-its-plants-in-ussr-7f18c27794a3?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f18c27794a3</guid>
            <category><![CDATA[vinyl]]></category>
            <category><![CDATA[ussr]]></category>
            <category><![CDATA[russian-culture]]></category>
            <category><![CDATA[history]]></category>
            <category><![CDATA[music]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Wed, 16 Jul 2025 04:46:02 GMT</pubDate>
            <atom:updated>2025-07-16T06:35:17.254Z</atom:updated>
            <content:encoded><![CDATA[<h3>Melodiya and its Vinyl Plants in USSR &amp; Now</h3><figure><img alt="Melodiya and its Plants in USSR" src="https://cdn-images-1.medium.com/max/539/0*UMOTvm6HlcD8AAp_.jpg" /></figure><p>Although I am <a href="https://netsvetaev.com/blog/projects/writing-a-book-about-album-covers/">writing a book</a> about music in the USSR, I am far from nostalgy and from loving that state.<br><br>Most of the technically complex goods in the union were copied from the Europeans, Americans and Japanese. In rare cases it was licensed, like Zhiguli cars, but often it was simply disassembled and rebuilt on Soviet components, like Yamaha HP-1 headphones, which were called TDS-5 (I owned both, USSR is a cheap one).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*aOZxA30OgBihuSRC.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*tsuXNJQJfuJd7dSa.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aN27Y3thFJln7cAX.jpg" /></figure><p>In the case of records, and specifically Melodiya, it was much the same. But the deeper I dug, the more ridiculous the official story seemed.</p><h4>What’s Wrong With Melodiya</h4><p>If you look at wikipedia or other typical sources, you’ll see the same thing everywhere: Melodiya was founded in 1964, the biggest company, a monopolist, wow! BTW, recently they released a book about their records and right in the announcement the unknown author again says that «”Melodiya” was the main and the only record label in the Soviet Union». They omits only a couple of details. <br><br>First, how did the largest record production company emerge from nothing? Russian Wikipedia article cautiously specifies that it was “based on existing factories”. They built factories, I guess? No way. Further a little less carefully they write “nationalized”, but, of course, do not specify how exactly. In general, briefly about the factories that suddenly became “Melodiya”:</p><p>- <strong>Aprelevsky (April)</strong>, the biggest one: USSR took the factory from the German Moll after the revolution<br>- <strong>Moscow plant</strong>: initially USSR took the machines from the French Pathe at the same time in 1910s<br>- <strong>Leningrad plant</strong>: USSR took the machines from the Germans in ‘45<br>- <strong>Riga plant</strong>: USSR took the factory together with the whole Latvia in ‘40<br>- <strong>Tbilisi plant</strong>: USSR bought the machines from USA<br>- <strong>Tallinn plant</strong>: USSR bought the machines from Germany.</p><p>Then, at the time of the unification of plants in ’64 and for some time after, there were a lot of small enterprises in the Union, producing their own records, which then simply closed down. Melodiya and that’s it.</p><p>By the way, Melodiya, which has been selling its archive of classics to the West for the last 20 years, was once again resold in 2020 for a fraction of its real value through a strange (as always in Russia) government tender. In addition to the book, the Melodiya website sells a T-shirt, a panama and a bag as a merchandise.</p><h4>Original experimental records before vinyl</h4><p>Was it something of its own in USSR, not copied and not taken away from someone? Before the WWII, yes. For example, amazing experimental factories that tried, obviously, to replace shellac with something (the invention of a suitable plastic/vinyl was yet to come). But there is very little information about them.</p><p>All this disappeared; only rare surviving records made of something like rubber remain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/0*iexehTko2SUrc4Yr.jpg" /></figure><p>Experimental record from 1930s</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*MPWroWHeciFZ__sQ.jpg" /></figure><p>The Aprelevsky factory now “produces socks and paper forms for the exams”.</p><h3>About me</h3><p>My name is Artur Netsvetaev, I am a product manager, entrepreneur and UI/UX designer. I write <a href="https://netsvetaev.com/blog">about AI</a>, <a href="https://netsvetaev.com/blog/category/book">music</a> and design.</p><p><a href="https://netsvetaev.com/">https://netsvetaev.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f18c27794a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[QA_MDT Training Without LMDB]]></title>
            <link>https://medium.com/@netsvetaev/qa-mdt-training-without-lmdb-fa8122251a89?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa8122251a89</guid>
            <category><![CDATA[ai-model]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[ai-model-optimization]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-model-training]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 07:03:18 GMT</pubDate>
            <atom:updated>2025-07-15T17:21:26.252Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5RBwAMgup-HudPYk.jpeg" /></figure><p>In december 2024, I prepared a dataset for QA_MDT music generation training. I added about 12 hours of audio — 0.1% of the total material in the original model, using multitracks of songs I familiar with: from The Beatles and DIre Straits to Queen, Peter Gabriel and Cerrone. I found some files on the net — for research purposes only, of course.</p><p>But while <a href="https://netsvetaev.com/blog/ai/audioldm-ai-music/">inference worked well</a>, training didn’t. The method suggested by qa-mdt authors to train the model by packing files into LMDB database, as I tried earlier under the GPT supervision, did not work.</p><p>The training was started, the video card RAM filled up, and the process froze. Oh.</p><p>I wrote to the author of the code about it, and he confirmed my doubts. He said if it didn’t work, I should throw out his code and insert another one. take the code from AudioLDM, he wrote me, only the loader, and read the files without the base, so it will be easier.</p><p>I <a href="https://netsvetaev.com/blog/ai/audioldm-runpod-finetuning/">tried AudioLDM</a>. The training worked well there. But the architecture of the model there is different, and I really needed a file loader only to read new files directly from the file system, not from the database.</p><p>The first solution that came to mind was to upload files from both projects to GPT and ask 4o to transfer some logic from one to another. They were very similar. I assumed that the 4o model would do a better job because you can upload files to it and it goes online.</p><p>I was so naive: gpt 4o suggested changing individual small parts of the code, constantly forgetting about the rest of the context. The code didn’t work, although I did make some progress and old bugs were replaced by new ones. GPT started going in circles, google didn’t know anything of the sort. All of this cost me 40 cents/hour of server time. Not much, but I don’t like that anyway.</p><p>50 dollars later I was starting to lose hope. After thinking for a couple more days, I decided to ask the newer o1 model to simply rewrite the old code to read from the system, removing all mention of the LMDB.</p><p>This, with some caveats, worked better than directly borrowing the code from another file: the training ran, but was now swearing at the file size. More precisely, the length of the files in the samples did not match the expected length. GPT confidently advised to rewrite everything again (he loves it!), but I didn’t believe him anymore.</p><p>And then it turned out that the problem, as it usually happens, is not in the code, but in the user: I simply forgot to trim frequencies and bring the length to the exact 10.24 seconds — and I did it, of course.</p><h3>LMDB</h3><h4>So, what was modified?</h4><p><strong>Replaced LMDB with loading from JSON in hhhh.py.</strong></p><ul><li>Removed all references to lmdb_path, mos_path, and filter_all.lst.</li><li>Read JSON directly, where each record has fields like {“wav”: “…”, “caption”: “…”, “mos”: 4.5}.</li></ul><p><strong>Made the text field in the dataset be a regular string, not a list/tuple.</strong></p><ul><li>It used to be data[“text”] = [caption], now data[“text”] = caption. This removed the error TextEncodeInput must be Union[TextInputSequence, …].</li></ul><p><strong>Fixed mos so that it wasn’t -1 (which broke mos_embed(…) in PixArt.py).</strong></p><ul><li>For the test, just set mos = 4.5 so as not to cause an error with Embedding (or you could assign an integer 3 if Embedding is waiting for an index).</li></ul><p><strong>In the latent_diffusion.py file:</strong></p><ul><li>Reduced num_workers from 8 to 2 (in DataLoader) to reduce potential memory issues.</li><li>You could also put num_sanity_val_val_steps=0 to disable sanity check and go straight to training.</li><li>You can reduce batch_size in config (or directly in code) to 1 if GPU memory is low.</li></ul><h3>Files &amp; scripts</h3><h4>Preparing a dataset. Here are various scripts I made for my needs.</h4><p>Python script for auto audio slicing, trimming &amp; normalization</p><pre>import os<br>from pydub import AudioSegment<br>from pydub.silence import detect_nonsilent<br>from pydub.effects import normalize<br><br># Настройки<br>SEGMENT_LENGTH_MS = 10_000      # signal length, ms<br>SILENCE_THRESH = -50            # Silence treshold, dbFS<br>MIN_SILENCE_LEN = 1000          # Minimal silence between signals, ms<br><br>MIN_PHRASE_MS = 8_000           # minimal full phrase (signal) (8 sec)<br>MAX_PHRASE_MS = 15_000          # maximum full phrase (15 sec)<br><br>OUTPUT_DIR = &quot;output_segments&quot;<br>os.makedirs(OUTPUT_DIR, exist_ok=True)<br><br>segment_count = 0<br><br>def finalize_segment(segment, prefix, output_subdir):<br>    &quot;&quot;&quot;<br>    Normalize segment, set volume to -0.2 dB and save to the subfolder<br>    &quot;&quot;&quot;<br>    global segment_count<br>    segment = normalize(segment)<br>    segment = segment.apply_gain(-0.2)<br><br>    # Segments count for unique names<br>    segment_filename = f&quot;{prefix}_{segment_count}.wav&quot;<br>    output_path = os.path.join(OUTPUT_DIR, output_subdir)<br>    os.makedirs(output_path, exist_ok=True)  # Create subfolder if none<br>    segment.export(os.path.join(output_path, segment_filename), format=&quot;wav&quot;)<br>    segment_count += 1<br><br>def process_interval(start_ms, end_ms, audio, channel_prefix, output_subdir):<br>    length = end_ms - start_ms<br>    interval_seg = audio[start_ms:end_ms]<br><br>    if length &lt; MIN_PHRASE_MS:<br>        finalize_segment(interval_seg, prefix=f&quot;{channel_prefix}_short&quot;, output_subdir=output_subdir)<br>    elif MIN_PHRASE_MS &lt;= length &lt;= MAX_PHRASE_MS:<br>        finalize_segment(interval_seg, prefix=f&quot;{channel_prefix}_phrase&quot;, output_subdir=output_subdir)<br>    else:<br>        # If more than 15 sec, slice to 10-sec parts<br>        current_pos = start_ms<br>        while current_pos + SEGMENT_LENGTH_MS &lt;= end_ms:<br>            chunk = audio[current_pos : current_pos + SEGMENT_LENGTH_MS]<br>            finalize_segment(chunk, prefix=f&quot;{channel_prefix}_segment&quot;, output_subdir=output_subdir)<br>            current_pos += SEGMENT_LENGTH_MS<br>        <br>        leftover = end_ms - current_pos<br>        if leftover &gt; 0:<br>            leftover_seg = audio[current_pos:end_ms]<br>            if leftover &lt; MIN_PHRASE_MS:<br>                finalize_segment(leftover_seg, prefix=f&quot;{channel_prefix}_short&quot;, output_subdir=output_subdir)<br>            elif MIN_PHRASE_MS &lt;= leftover &lt;= MAX_PHRASE_MS:<br>                finalize_segment(leftover_seg, prefix=f&quot;{channel_prefix}_phrase&quot;, output_subdir=output_subdir)<br>            else:<br><br>                process_interval(current_pos, end_ms, audio, channel_prefix, output_subdir)<br><br>def process_audio_for_intervals(audio_segment, channel_prefix, output_subdir):<br>    &quot;&quot;&quot;Looking for segments without silence and process them&quot;&quot;&quot;<br>    nonsilent_intervals = detect_nonsilent(<br>        audio_segment=audio_segment,<br>        min_silence_len=MIN_SILENCE_LEN,<br>        silence_thresh=SILENCE_THRESH<br>    )<br><br>    for interval in nonsilent_intervals:<br>        start, end = interval<br>        process_interval(start, end, audio_segment, channel_prefix, output_subdir)<br><br>def process_file(filepath):<br>    &quot;&quot;&quot;Process audio: separate channels if stereo&quot;&quot;&quot;<br>    audio = AudioSegment.from_file(filepath)<br><br>    # Create subfoldre depending on OUTPUT_DIR<br>    # If file in &quot;./some/dir/audio.wav», so output_subdir will be &quot;some/dir&quot;<br>    relative_path = os.path.relpath(os.path.dirname(filepath), &quot;.&quot;)<br>    if relative_path == &quot;.&quot;:<br>        # File in current dir<br>        output_subdir = &quot;&quot;<br>    else:<br>        output_subdir = relative_path<br><br>    if audio.channels == 2:<br>        # Separate channels<br>        left_channel, right_channel = audio.split_to_mono()<br>        # Process left channel first<br>        process_audio_for_intervals(left_channel, channel_prefix=&quot;L&quot;, output_subdir=output_subdir)<br>        # Process right channel second<br>        process_audio_for_intervals(right_channel, channel_prefix=&quot;R&quot;, output_subdir=output_subdir)<br>    else:<br>        # If mono, just process<br>        process_audio_for_intervals(audio, channel_prefix=&quot;M&quot;, output_subdir=output_subdir)<br><br><br># Primary logic: searching for every file in a dir, recursively<br>AUDIO_EXTENSIONS = [&quot;.wav&quot;, &quot;.mp3&quot;, &quot;.flac&quot;, &quot;.ogg&quot;, &quot;.m4a&quot;]<br><br>for root, dirs, files in os.walk(&quot;.&quot;):<br>    for file in files:<br>        if any(file.lower().endswith(ext) for ext in AUDIO_EXTENSIONS):<br>            filepath = os.path.join(root, file)<br>            print(f&quot;Processing: {filepath}&quot;)<br>            process_file(filepath)<br><br>print(f&quot;Done! Sliced to {segment_count} files.&quot;)</pre><h4>Result</h4><p><a href="https://netsvetaev.com/blog/ai/qa_mdt-training-without-lmdb/">https://netsvetaev.com/blog/ai/qa_mdt-training-without-lmdb/</a></p><h4>Generate keys_train.json / keys_val.json</h4><pre>import os<br>import json<br>import random<br><br>def generate_keys(dataset_path, output_file, split_ratio=0.8):<br>    &quot;&quot;&quot;<br>    Generates JSON with file paths for further training<br>    param split_ratio: train / val data split from 0.0 to 1.0.<br>    &quot;&quot;&quot;<br>    # Oh, by the way, which one is pink?<br>    audio_extensions = {&quot;.wav&quot;, &quot;.mp3&quot;, &quot;.flac&quot;, &quot;.aac&quot;, &quot;.ogg&quot;}<br>    <br>    # Search for audio<br>    audio_files = []<br>    for root, _, files in os.walk(dataset_path):<br>        for file in files:<br>            if os.path.splitext(file)[1].lower() in audio_extensions:<br>                audio_files.append(os.path.join(root, file))<br>    <br>    # shuffle files<br>    random.shuffle(audio_files)<br>    <br>    # Split for train and val<br>    split_index = int(len(audio_files) * split_ratio)<br>    train_files = audio_files[:split_index]<br>    val_files = audio_files[split_index:]<br>    <br>    # save JSON<br>    with open(output_file.replace(&quot;.json&quot;, &quot;_train.json&quot;), &quot;w&quot;) as train_file:<br>        json.dump({&quot;keys&quot;: train_files}, train_file, indent=4)<br>    <br>    with open(output_file.replace(&quot;.json&quot;, &quot;_val.json&quot;), &quot;w&quot;) as val_file:<br>        json.dump({&quot;keys&quot;: val_files}, val_file, indent=4)<br>    <br>    print(f&quot;Files generated:\n- {output_file.replace(&#39;.json&#39;, &#39;_train.json&#39;)}\n- {output_file.replace(&#39;.json&#39;, &#39;_val.json&#39;)}&quot;)<br>dataset_path = &quot;/path/to/your/dataset&quot;  # Path to a dataset folder<br>output_file = &quot;keys.json&quot;  # Output JSON name<br># Generate!<br>generate_keys(dataset_path, output_file)</pre><h4>Make tokens from filenames and save to CSV</h4><pre>import os<br>import csv<br>import re<br><br>def clean_filename_for_duplicates(filename):<br>    &quot;&quot;&quot;<br>    Erases &#39;copy&#39;, &#39;copy 2&#39; from filenames, if existed.<br>    &quot;&quot;&quot;<br>    return re.sub(r&quot;(\s-\s|_)?(copy|copy\s\d+)$&quot;, &quot;&quot;, filename, flags=re.IGNORECASE).strip()<br><br>def generate_csv_with_combined_tokens(root_dir, output_csv):<br>    &quot;&quot;&quot;<br>    Makes CSV with paths to files and tokens<br>    :param root_dir: Root folder<br>    :param output_csv: Output CSV<br>    &quot;&quot;&quot;<br>    rows = []<br>    token_exceptions = {&quot;CHORD&quot;, &quot;NOTE&quot;}  # Special tokens for chords and notes<br>    # Searching for files<br>    for root, dirs, files in os.walk(root_dir):<br>        # Генерация токенов для текущей папки<br>        tokens = root.replace(root_dir, &quot;&quot;).strip(os.sep).split(os.sep)<br>        tokens = [token.replace(&quot; &quot;, &quot;_&quot;) for token in tokens]  # Make spaces like &quot;_&quot;<br>        # If a folder is CHORD or NOTE<br>        is_special_folder = any(token in token_exceptions for token in tokens)<br>        # Process<br>        for file in files:<br>            if file.endswith((&#39;.wav&#39;, &#39;.mp3&#39;, &#39;.flac&#39;)):  # Check audio formats<br>                file_path = os.path.join(root, file)<br>                # CLean file name<br>                cleaned_filename = clean_filename_for_duplicates(os.path.splitext(file)[0])<br>                if is_special_folder:<br>                    combined_token = f&quot;{tokens[-1]}_{cleaned_filename}&quot; <br>                    all_tokens = tokens[:-1] + [combined_token]  <br>                else:<br>                    all_tokens = tokens  <br>                rows.append({&quot;file_path&quot;: file_path, &quot;tokens&quot;: &quot; &quot;.join(all_tokens)})<br>    # Save CSV<br>    with open(output_csv, mode=&quot;w&quot;, newline=&quot;&quot;) as csv_file:<br>        writer = csv.DictWriter(csv_file, fieldnames=[&quot;file_path&quot;, &quot;tokens&quot;])<br>        writer.writeheader()<br>        writer.writerows(rows)<br>    print(f&quot;CSV created: {output_csv}&quot;)<br><br># Parameters<br>root_directory = &quot;/workspace/output&quot;  # root folder with audio files<br>output_csv_file = &quot;audio_metadata.csv&quot;  # output CSV<br># Generate!<br>generate_csv_with_combined_tokens(root_directory, output_csv_file)<br></pre><h4>And from CSV to JSON with tokens</h4><pre>import csv<br>import json<br>import random<br><br>def split_csv_to_train_val(input_csv, train_json, val_json, split_ratio=0.8):<br>    &quot;&quot;&quot;<br>    Splits CSV to train and val sets, saves them to JSON.<br>    :param split_ratio: train / val data split from 0.0 to 1.0.<br>    &quot;&quot;&quot;<br>    data = []<br>    # Read CSV<br>    with open(input_csv, mode=&quot;r&quot;) as csv_file:<br>        reader = csv.DictReader(csv_file)<br>        for row in reader:<br>            data.append({<br>                &quot;wav&quot;: row[&quot;file_path&quot;],<br>                &quot;caption&quot;: row[&quot;tokens&quot;]<br>            })<br>    # Shuffle<br>    random.shuffle(data)<br>    # Split train and val<br>    train_size = int(len(data) * split_ratio)<br>    train_data = {&quot;data&quot;: data[:train_size]}<br>    val_data = {&quot;data&quot;: data[train_size:]}<br>    # Save JSON<br>    with open(train_json, mode=&quot;w&quot;) as train_file:<br>        json.dump(train_data, train_file, indent=4)<br>    print(f&quot;Train JSON created: {train_json} ({len(train_data[&#39;data&#39;])} records)&quot;)<br>    with open(val_json, mode=&quot;w&quot;) as val_file:<br>        json.dump(val_data, val_file, indent=4)<br>    print(f&quot;Val JSON created: {val_json} ({len(val_data[&#39;data&#39;])} records)&quot;)<br><br>input_csv_file = &quot;audio_metadata.csv&quot;  # Input CSV<br>train_json_file = &quot;train_audio_metadata.json&quot;  # Output train JSON <br>val_json_file = &quot;val_audio_metadata.json&quot;  # Output val JSON<br>split_ratio = 0.8  # 80% train, 20% val<br># Generate!<br>split_csv_to_train_val(input_csv_file, train_json_file, val_json_file, split_ratio)</pre><h3>Changing dataloader to use JSON and WAVs instead of LMDB</h3><h4>Change qa_mdt.yaml to work with json</h4><pre>log_directory: &quot;./log/latent_diffusion&quot;<br>project: &quot;audioldm&quot;<br>precision: &quot;high&quot;<br>base_root: &quot;./qa_mdt&quot;<br>pretrained:<br>  clap_music: &quot;./qa_mdt/checkpoints/clap_music&quot;<br>  flan_t5: &quot;./qa_mdt/checkpoints/flant5&quot;<br>  hifi-gan: &quot;./qa_mdt/checkpoints/hifi-gan/checkpoints&quot;<br>  roberta-base: &quot;./qa_mdt/checkpoints/robertabase&quot;<br>mos_path: &quot;/path/to/mos_scores.json&quot;  # Use it or delete it<br>train_path:<br>  train_key_path: &quot;./train_metadata.json&quot;  # Path to train JSON<br>val_path:<br>  val_key_path: &quot;./val_metadata.json&quot;  # Path to val JSON<br>variables:<br>  sampling_rate: &amp;sampling_rate 16000<br>  mel_bins: &amp;mel_bins 64<br>  latent_embed_dim: &amp;latent_embed_dim 8<br>  latent_t_size: &amp;latent_t_size 256<br>  latent_f_size: &amp;latent_f_size 16<br>  in_channels: &amp;unet_in_channels 8<br>  optimize_ddpm_parameter: &amp;optimize_ddpm_parameter true<br>  optimize_gpt: &amp;optimize_gpt true<br>  warmup_steps: &amp;warmup_steps 2000<br>step:<br>  validation_every_n_epochs: 10000<br>  save_checkpoint_every_n_steps: 1000<br>  max_steps: 8000000<br>  save_top_k: 1000<br>preprocessing:<br>  audio:<br>    sampling_rate: *sampling_rate<br>    max_wav_value: 32768.0<br>    duration: 10.24<br>  stft:<br>    filter_length: 1024<br>    hop_length: 160<br>    win_length: 1024<br>  mel:<br>    n_mel_channels: *mel_bins<br>    mel_fmin: 0<br>    mel_fmax: 8000 <br>augmentation:<br>  mixup: 0.0<br>model:<br>  target: qa_mdt.audioldm_train.modules.latent_diffusion.ddpm.LatentDiffusion<br>  params:<br>    first_stage_config:<br>      target: qa_mdt.audioldm_train.modules.latent_encoder.autoencoder.AutoencoderKL<br>      params: <br>        reload_from_ckpt: &quot;./qa_mdt/checkpoints/hifi-gan/checkpoints/vae_mel_16k_64bins.ckpt&quot;<br>        sampling_rate: *sampling_rate<br>        batchsize: 1<br>        monitor: val/rec_loss<br>        image_key: fbank<br>        subband: 1<br>        embed_dim: *latent_embed_dim<br>        time_shuffle: 1<br>        lossconfig:<br>          target: qa_mdt.audioldm_train.losses.LPIPSWithDiscriminator<br>          params:<br>            disc_start: 50001<br>            kl_weight: 1000.0<br>            disc_weight: 0.5<br>            disc_in_channels: 1<br>        ddconfig: <br>          double_z: true<br>          mel_bins: *mel_bins<br>          z_channels: 8<br>          resolution: 256<br>          downsample_time: false<br>          in_channels: 1<br>          out_ch: 1<br>          ch: 128 <br>          ch_mult:<br>          - 1<br>          - 2<br>          - 4<br>          num_res_blocks: 2<br>          attn_resolutions: []<br>          dropout: 0.0<br>    base_learning_rate: 8.0e-5<br>    warmup_steps: *warmup_steps<br>    optimize_ddpm_parameter: *optimize_ddpm_parameter<br>    sampling_rate: *sampling_rate<br>    batchsize: 16<br>    linear_start: 0.0015<br>    linear_end: 0.0195<br>    num_timesteps_cond: 1<br>    log_every_t: 200<br>    timesteps: 1000<br>    unconditional_prob_cfg: 0.1<br>    parameterization: eps<br>    first_stage_key: fbank<br>    latent_t_size: *latent_t_size<br>    latent_f_size: *latent_f_size<br>    channels: *latent_embed_dim<br>    monitor: val/loss_simple_ema<br>    scale_by_std: true<br>    unet_config:<br>      target: qa_mdt.audioldm_train.modules.diffusionmodules.PixArt.PixArt_MDT_MOS_AS_TOKEN<br>      params:<br>        input_size : [256, 16]<br>        patch_size : [4, 1]<br>        overlap_size: [0, 0]<br>        in_channels : 8<br>        hidden_size : 1152<br>        depth : 28<br>        num_heads : 16<br>        mlp_ratio : 4.0<br>        class_dropout_prob : 0.1<br>        pred_sigma : True<br>        drop_path : 0.<br>        window_size : 0<br>        window_block_indexes : None<br>        use_rel_pos : False<br>        cond_dim : 1024<br>        lewei_scale : 1.0<br>        overlap: [0, 0]<br>        use_cfg: true<br>        mask_ratio: 0.30<br>        decode_layer: 8<br>    cond_stage_config:<br>      crossattn_flan_t5:<br>        cond_stage_key: text<br>        conditioning_key: crossattn<br>        target: qa_mdt.audioldm_train.conditional_models.FlanT5HiddenState</pre><h4>New hhhh.py — our dataloader</h4><pre>import sys<br>import os<br>import math<br>import pandas as pd<br>import zlib<br>import yaml<br>import qa_mdt.audioldm_train.utilities.audio as Audio<br>from qa_mdt.audioldm_train.utilities.tools import load_json<br>from qa_mdt.audioldm_train.dataset_plugin import *<br>import librosa<br>from librosa.filters import mel as librosa_mel_fn<br>import threading<br>import random<br>from torch.utils.data import Dataset<br>import torch.nn.functional<br>import torch<br>from pydub import AudioSegment<br>import numpy as np<br>import torchaudio<br>import io<br>import json<br><br>def dynamic_range_compression_torch(x, C=1, clip_val=1e-5):<br>    return torch.log(torch.clamp(x, min=clip_val) * C)<br>def dynamic_range_decompression_torch(x, C=1):<br>    return torch.exp(x) / C<br>def spectral_normalize_torch(magnitudes):<br>    output = dynamic_range_compression_torch(magnitudes)<br>    return output<br>def spectral_de_normalize_torch(magnitudes):<br>    output = dynamic_range_decompression_torch(magnitudes)<br>    return output<br>class AudioDataset(Dataset):<br>    &quot;&quot;&quot;<br>    New AudioDataset:<br>    - JSON as is, no LMDB.<br>    - No filter_all.lst and mos_path.<br>    - `text` as a string (not list).<br>    &quot;&quot;&quot;<br>    def __init__(<br>        self,<br>        config,<br>        key_path,  # JSON key path<br>        lock=True<br>    ):<br>        self.config = config<br>        self.pad_wav_start_sample = 0<br>        self.trim_wav = False<br>        # Initialise<br>        self.build_setting_parameters()<br>        self.build_dsp()<br>        # Load JSON<br>        with open(key_path, &quot;r&quot;, encoding=&quot;utf-8&quot;) as f:<br>            # Если JSON имеет структуру {&quot;data&quot;: [...]}, нужно взять file_content[&quot;data&quot;]<br>            file_content = json.load(f)<br>            # допустим, сразу это список<br>            if isinstance(file_content, dict) and &quot;data&quot; in file_content:<br>                self.data = file_content[&quot;data&quot;]<br>            elif isinstance(file_content, list):<br>                self.data = file_content<br>            else:<br>                # if different format<br>                raise ValueError(&quot;JSON should be a list or have a &#39;data&#39; key with a list.&quot;)<br>        <br>        print(f&quot;Dataset initialized! Length: {len(self.data)}&quot;)<br>    def __len__(self):<br>        return len(self.data)<br>    def __getitem__(self, index):<br>        (<br>            fname,<br>            waveform,<br>            stft,<br>            log_mel_spec,<br>            label_vector,<br>            random_start,<br>            caption,<br>            mos<br>        ) = self.feature_extraction(index)<br>        data = {<br>            &quot;text&quot;: caption,  # string, not a list<br>            &quot;fname&quot;: fname,   # string without [fname]<br>            &quot;waveform&quot;: &quot;&quot; if (waveform is None) else waveform.float(),<br>            &quot;stft&quot;: &quot;&quot; if (stft is None) else stft.float(),<br>            &quot;log_mel_spec&quot;: &quot;&quot; if (log_mel_spec is None) else log_mel_spec.float(),<br>            &quot;duration&quot;: self.duration,<br>            &quot;sampling_rate&quot;: self.sampling_rate,<br>            &quot;random_start_sample_in_original_audio_file&quot;: random_start,<br>            &quot;label_vector&quot;: label_vector,<br>            &quot;mos&quot;: mos<br>        }<br>        if data[&quot;text&quot;] is None:<br>            print(&quot;Warning: The model returned None on key text&quot;, fname)<br>            data[&quot;text&quot;] = &quot;&quot;<br>        return data<br>    def feature_extraction(self, index):<br>        if index &gt;= len(self.data):<br>            raise IndexError(f&quot;Index {index} out of range for dataset of length {len(self.data)}&quot;)<br>        # Из JSON берём поля<br>        datum = self.data[index]<br>        wav_path = datum.get(&quot;wav&quot;, &quot;&quot;)<br>        caption_original = datum.get(&quot;caption&quot;, &quot;music&quot;).lower()<br>        # If no mos, use 4.5<br>        # Or int(...)<br>        mos = float(datum.get(&quot;mos&quot;, 4.5))<br>        # Load WAV<br>        try:<br>            waveform_np, sr = librosa.load(wav_path, sr=None, mono=True)<br>        except FileNotFoundError:<br>            raise FileNotFoundError(f&quot;File not found: {wav_path}&quot;)<br>        except Exception as e:<br>            raise RuntimeError(f&quot;Error loading audio {wav_path}: {e}&quot;)<br>        # Resample<br>        if sr != self.sampling_rate:<br>            waveform_t = torch.from_numpy(waveform_np)<br>            waveform_t = torchaudio.functional.resample(<br>                waveform_t, orig_freq=sr, new_freq=self.sampling_rate<br>            )<br>            waveform_np = waveform_t.numpy()<br>            sr = self.sampling_rate<br>        waveform_np = self.normalize_wav(waveform_np)<br>        # Trim<br>        waveform_np, random_start = self.random_segment_wav(<br>            waveform_np, target_length=int(sr * self.duration)<br>        )<br>        # Pad<br>        waveform_tensor = torch.FloatTensor(waveform_np).unsqueeze(0)<br>        waveform_tensor = self.pad_wav(waveform_tensor, target_length=int(self.sampling_rate * self.duration))<br>        waveform_np = waveform_tensor.squeeze(0).numpy()<br>        # Make final caption<br>        prefix = &quot;medium quality&quot;<br>        if mos &gt;= 4.05:<br>            prefix = &quot;high quality&quot;<br>        elif mos &lt;= 3.55:<br>            prefix = &quot;low quality&quot;<br>        if caption_original == &quot;none&quot;:<br>            caption_original = &quot;&quot;<br>        caption = f&quot;{prefix}, {caption_original}&quot;<br>        log_mel_spec, stft = self.read_audio_file(waveform_np, wav_path)<br>        label_vector = torch.FloatTensor(np.zeros(0, dtype=np.float32))<br>        return (<br>            wav_path,                  # fname<br>            torch.FloatTensor(waveform_np),<br>            stft,<br>            log_mel_spec,<br>            label_vector,<br>            random_start,<br>            caption,<br>            mos<br>        )<br>    def build_setting_parameters(self):<br>        self.melbins = self.config[&quot;preprocessing&quot;][&quot;mel&quot;][&quot;n_mel_channels&quot;]<br>        self.sampling_rate = self.config[&quot;preprocessing&quot;][&quot;audio&quot;][&quot;sampling_rate&quot;]<br>        self.hopsize = self.config[&quot;preprocessing&quot;][&quot;stft&quot;][&quot;hop_length&quot;]<br>        self.duration = self.config[&quot;preprocessing&quot;][&quot;audio&quot;][&quot;duration&quot;]<br>        self.target_length = int(self.duration * self.sampling_rate / self.hopsize)<br>    def build_dsp(self):<br>        self.mel_basis = {}<br>        self.hann_window = {}<br>        self.filter_length = self.config[&quot;preprocessing&quot;][&quot;stft&quot;][&quot;filter_length&quot;]<br>        self.hop_length = self.config[&quot;preprocessing&quot;][&quot;stft&quot;][&quot;hop_length&quot;]<br>        self.win_length = self.config[&quot;preprocessing&quot;][&quot;stft&quot;][&quot;win_length&quot;]<br>        self.n_mel = self.config[&quot;preprocessing&quot;][&quot;mel&quot;][&quot;n_mel_channels&quot;]<br>        self.sampling_rate = self.config[&quot;preprocessing&quot;][&quot;audio&quot;][&quot;sampling_rate&quot;]<br>        self.mel_fmin = self.config[&quot;preprocessing&quot;][&quot;mel&quot;][&quot;mel_fmin&quot;]<br>        self.mel_fmax = self.config[&quot;preprocessing&quot;][&quot;mel&quot;][&quot;mel_fmax&quot;]<br>        self.STFT = Audio.stft.TacotronSTFT(<br>            self.filter_length,<br>            self.hop_length,<br>            self.win_length,<br>            self.n_mel,<br>            self.sampling_rate,<br>            self.mel_fmin,<br>            self.mel_fmax,<br>        )<br>    def normalize_wav(self, waveform):<br>        if len(waveform) == 0:<br>            return waveform<br>        waveform = waveform - np.mean(waveform)<br>        waveform = waveform / (np.max(np.abs(waveform)) + 1e-8)<br>        return waveform * 0.5<br>    def random_segment_wav(self, waveform, target_length):<br>        waveform_length = len(waveform)<br>        if waveform_length &lt; 100:<br>            return waveform, 0<br>        if waveform_length &lt;= target_length:<br>            return waveform, 0<br>        random_start = random.randint(0, waveform_length - target_length)<br>        segment = waveform[random_start: random_start + target_length]<br>        return segment, random_start<br>    def pad_wav(self, waveform, target_length):<br>        waveform_length = waveform.shape[-1]<br>        if waveform_length &lt; 100:<br>            waveform = torch.nn.functional.pad(waveform, (0, target_length - waveform_length))<br>        if waveform_length == target_length:<br>            return waveform<br>        if waveform_length &gt; target_length:<br>            return waveform[..., :target_length]<br>        temp_wav = torch.zeros((1, target_length), dtype=waveform.dtype)<br>        temp_wav[0, :waveform_length] = waveform<br>        return temp_wav<br>    def trim_wav(self, waveform):<br>        return waveform<br>    def read_audio_file(self, file, k):<br>        waveform = file<br>        log_mel_spec, stft = self.wav_feature_extraction(waveform)<br>        return log_mel_spec, stft<br>    def wav_feature_extraction(self, waveform):<br>        waveform = waveform[None, ...]<br>        waveform = torch.FloatTensor(waveform)<br>        log_mel_spec, stft = self.mel_spectrogram_train(waveform)<br>        log_mel_spec = torch.FloatTensor(log_mel_spec.T)<br>        stft = torch.FloatTensor(stft.T)<br>        log_mel_spec = self.pad_spec(log_mel_spec)<br>        stft = self.pad_spec(stft)<br>        return log_mel_spec, stft<br>    def mel_spectrogram_train(self, y):<br>        if torch.min(y) &lt; -1.0:<br>            print(&quot;train min value is &quot;, torch.min(y))<br>        if torch.max(y) &gt; 1.0:<br>            print(&quot;train max value is &quot;, torch.max(y))<br>        key_name = str(self.mel_fmax) + &quot;_&quot; + str(y.device)<br>        if key_name not in self.mel_basis:<br>            mel = librosa_mel_fn(<br>                sr=self.sampling_rate,<br>                n_fft=self.filter_length,<br>                n_mels=self.n_mel,<br>                fmin=self.mel_fmin,<br>                fmax=self.mel_fmax,<br>            )<br>            self.mel_basis[key_name] = torch.from_numpy(mel).float().to(y.device)<br>            self.hann_window[str(y.device)] = torch.hann_window(self.win_length).to(y.device)<br>        y = torch.nn.functional.pad(<br>            y.unsqueeze(1),<br>            (<br>                int((self.filter_length - self.hop_length) / 2),<br>                int((self.filter_length - self.hop_length) / 2),<br>            ),<br>            mode=&quot;reflect&quot;,<br>        )<br>        y = y.squeeze(1)<br>        stft_spec = torch.stft(<br>            y,<br>            self.filter_length,<br>            hop_length=self.hop_length,<br>            win_length=self.win_length,<br>            window=self.hann_window[str(y.device)],<br>            center=False,<br>            pad_mode=&quot;reflect&quot;,<br>            normalized=False,<br>            onesided=True,<br>            return_complex=True,<br>        )<br>        stft_spec = torch.abs(stft_spec)<br>        mel = spectral_normalize_torch(<br>            torch.matmul(self.mel_basis[key_name], stft_spec)<br>        )<br>        return mel[0], stft_spec[0]<br>    def pad_spec(self, spec):<br>        n_frames = spec.shape[0]<br>        p = self.target_length - n_frames<br>        if p &gt; 0:<br>            spec = torch.nn.functional.pad(spec, (0, 0, 0, p))<br>        elif p &lt; 0:<br>            spec = spec[: self.target_length, :]<br>        if spec.size(-1) % 2 != 0:<br>            spec = spec[..., :-1]<br>        return spec<br><br>class AudioDataset_infer(Dataset):<br>    &quot;&quot;&quot;<br>    For inference<br>    &quot;&quot;&quot;<br>    def __init__(self, config, caption_list, lock=True):<br>        self.config = config<br>        self.duration = self.config[&quot;preprocessing&quot;][&quot;audio&quot;][&quot;duration&quot;]<br>        self.sampling_rate = self.config[&quot;variables&quot;][&quot;sampling_rate&quot;]<br>        self.target_length = int(self.sampling_rate * self.duration)<br>        self.waveform = torch.zeros((1, self.target_length))<br>        self.captions = []<br>        with open(caption_list, &#39;r&#39;) as f:<br>            for line in f:<br>                key = line.strip()<br>                self.captions.append(key)<br>    def __getitem__(self, index):<br>        if index &gt;= len(self.captions):<br>            raise IndexError(f&quot;Index {index} out of range for caption_list of length {len(self.captions)}&quot;)<br>        fname = f&quot;sample_{index}&quot;<br>        mos = 4.5  # or any<br>        data = {<br>            &quot;text&quot;: self.captions[index],<br>            &quot;fname&quot;: fname,<br>            &quot;waveform&quot;: &quot;&quot;,<br>            &quot;stft&quot;: &quot;&quot;,<br>            &quot;log_mel_spec&quot;: &quot;&quot;,<br>            &quot;duration&quot;: self.duration,<br>            &quot;sampling_rate&quot;: self.sampling_rate,<br>            &quot;random_start_sample_in_original_audio_file&quot;: 0,<br>            &quot;label_vector&quot;: torch.FloatTensor(np.zeros(0, dtype=np.float32)),<br>            &quot;mos&quot;: mos<br>        }<br>        return data<br>    def __len__(self):<br>        return len(self.captions)<br><br>if __name__ == &quot;__main__&quot;:<br>    import torch<br>    from tqdm import tqdm<br>    from pytorch_lightning import seed_everything<br>    from torch.utils.data import DataLoader<br>    seed_everything(0)<br>    config = yaml.load(<br>        open(<br>            &quot;/mnt/bn/lqhaoheliu/project/audio_generation_diffusion/config/vae_48k_256/ds_8_kl_1.0_ch_16.yaml&quot;,<br>            &quot;r&quot;,<br>        ),<br>        Loader=yaml.FullLoader,<br>    )<br>    train_key_path = &quot;/workspace/output/train_audio_metadata.json» # hardcode, change to yours<br>    dataset = AudioDataset(<br>        config=config,<br>        key_path=train_key_path<br>    )<br>    loader = DataLoader(dataset, batch_size=1, num_workers=2, shuffle=True)<br>    for cnt, each in enumerate(loader):<br>        print(&quot;fname:&quot;, each[&quot;fname&quot;],<br>              &quot;text:&quot;, each[&quot;text&quot;],<br>              &quot;mos:&quot;, each[&quot;mos&quot;])<br>        print(&quot;waveform size:&quot;,<br>              each[&quot;waveform&quot;].size() if isinstance(each[&quot;waveform&quot;], torch.Tensor) else None)<br>        print(&quot;log_mel_spec size:&quot;,<br>              each[&quot;log_mel_spec&quot;].size() if isinstance(each[&quot;log_mel_spec&quot;], torch.Tensor) else None)<br>        print(&quot;stft size:&quot;,<br>              each[&quot;stft&quot;].size() if isinstance(each[&quot;stft&quot;], torch.Tensor) else None)<br>        print(&quot;----&quot;)<br>        if cnt &gt;= 2:<br>            break</pre><h4>New latent_diffusion.py — training script without sanity check and fewer workers</h4><pre>import sys<br>import shutil<br>import os<br>os.environ[&quot;TOKENIZERS_PARALLELISM&quot;] = &quot;true&quot;<br>import argparse<br>import yaml<br>import torch<br>from tqdm import tqdm<br>from pytorch_lightning.strategies.ddp import DDPStrategy<br>from qa_mdt.audioldm_train.modules.latent_diffusion.ddpm import LatentDiffusion<br>from torch.utils.data import WeightedRandomSampler<br>from torch.utils.data import DataLoader<br>from pytorch_lightning import Trainer, seed_everything<br>from pytorch_lightning.callbacks import ModelCheckpoint<br>from pytorch_lightning.loggers import WandbLogger<br>from qa_mdt.audioldm_train.utilities.tools import (<br>    listdir_nohidden,<br>    get_restore_step,<br>    copy_test_subset_data,<br>)<br>import wandb<br>from qa_mdt.audioldm_train.utilities.model_util import instantiate_from_config<br>import logging<br>logging.basicConfig(level=logging.WARNING)<br><br>def convert_path(path):<br>    parts = path.decode().split(&quot;/&quot;)[-4:]<br>    base = &quot;&quot;<br>    result = &quot;/&quot;.join(parts)<br>def print_on_rank0(msg):<br>    if torch.distributed.get_rank() == 0:<br>        print(msg)<br>def main(configs, config_yaml_path, exp_group_name, exp_name, perform_validation):<br>    print(&quot;MAIN START&quot;)<br>    if &quot;seed&quot; in configs.keys():<br>        seed_everything(configs[&quot;seed&quot;])<br>    else:<br>        print(&quot;SEED EVERYTHING TO 0&quot;)<br>        seed_everything(1234)<br>    if &quot;precision&quot; in configs.keys():<br>        torch.set_float32_matmul_precision(configs[&quot;precision&quot;])<br>    log_path = configs[&quot;log_directory&quot;]<br>    batch_size = configs[&quot;model&quot;][&quot;params&quot;][&quot;batchsize&quot;]  # Can use =1 in YAML for less memory<br>    train_key_path = configs[&quot;train_path&quot;][&quot;train_key_path&quot;]<br>    val_key_path = configs[&quot;val_path&quot;][&quot;val_key_path&quot;]<br>    # load dataset from new hhhh.py<br>    from qa_mdt.audioldm_train.utilities.data.hhhh import AudioDataset<br>    dataset = AudioDataset(config=configs, key_path=train_key_path)<br>    loader = DataLoader(<br>        dataset,<br>        batch_size=batch_size,<br>        num_workers=2,  # less memory<br>        pin_memory=True,<br>        shuffle=True,<br>    )<br>    print(<br>        &quot;The length of the dataset is %s, the length of the dataloader is %s, the batchsize is %s&quot;<br>        % (len(dataset), len(loader), batch_size)<br>    )<br>    val_dataset = AudioDataset(config=configs, key_path=val_key_path)<br>    val_loader = DataLoader(<br>        val_dataset,<br>        batch_size=8,  # Can use less<br>        num_workers=2, # 2 for val, too<br>    )<br>    test_data_subset_folder = os.path.join(<br>        os.path.dirname(configs[&quot;log_directory&quot;]),<br>        &quot;testset_data&quot;,<br>        &quot;tmp&quot;,<br>    )<br>    os.makedirs(test_data_subset_folder, exist_ok=True)<br>    try:<br>        config_reload_from_ckpt = configs[&quot;reload_from_ckpt&quot;]<br>    except:<br>        config_reload_from_ckpt = None<br>    try:<br>        limit_val_batches = configs[&quot;step&quot;][&quot;limit_val_batches&quot;]<br>    except:<br>        limit_val_batches = None<br>    validation_every_n_epochs = configs[&quot;step&quot;][&quot;validation_every_n_epochs&quot;]<br>    save_checkpoint_every_n_steps = configs[&quot;step&quot;][&quot;save_checkpoint_every_n_steps&quot;]<br>    max_steps = configs[&quot;step&quot;][&quot;max_steps&quot;]<br>    save_top_k = configs[&quot;step&quot;][&quot;save_top_k&quot;]<br>    checkpoint_path = os.path.join(log_path, exp_group_name, exp_name, &quot;checkpoints&quot;)<br>    wandb_path = os.path.join(log_path, exp_group_name, exp_name)<br>    checkpoint_callback = ModelCheckpoint(<br>        dirpath=checkpoint_path,<br>        monitor=&quot;global_step&quot;,<br>        mode=&quot;max&quot;,<br>        filename=&quot;checkpoint-fad-{val/frechet_inception_distance:.2f}-global_step={global_step:.0f}&quot;,<br>        every_n_train_steps=save_checkpoint_every_n_steps,<br>        save_top_k=save_top_k,<br>        auto_insert_metric_name=False,<br>        save_last=False,<br>    )<br>    os.makedirs(checkpoint_path, exist_ok=True)<br>    if len(os.listdir(checkpoint_path)) &gt; 0:<br>        print(&quot;Load checkpoint from path: %s&quot; % checkpoint_path)<br>        restore_step, n_step = get_restore_step(checkpoint_path)<br>        resume_from_checkpoint = os.path.join(checkpoint_path, restore_step)<br>        print(&quot;Resume from checkpoint&quot;, resume_from_checkpoint)<br>    elif config_reload_from_ckpt is not None:<br>        resume_from_checkpoint = config_reload_from_ckpt<br>        print(&quot;Reload ckpt specified in the config file %s&quot; % resume_from_checkpoint)<br>    else:<br>        print(&quot;Train from scratch&quot;)<br>        resume_from_checkpoint = None<br>    devices = torch.cuda.device_count()<br>    latent_diffusion = instantiate_from_config(configs[&quot;model&quot;])<br>    latent_diffusion.set_log_dir(log_path, exp_group_name, exp_name)<br>    wandb_logger = WandbLogger(<br>        save_dir=wandb_path,<br>        project=configs[&quot;project&quot;],<br>        config=configs,<br>        name=&quot;%s/%s&quot; % (exp_group_name, exp_name),<br>    )<br>    latent_diffusion.test_data_subset_path = test_data_subset_folder<br>    print(&quot;==&gt; Save checkpoint every %s steps&quot; % save_checkpoint_every_n_steps)<br>    print(&quot;==&gt; Perform validation every %s epochs&quot; % validation_every_n_epochs)<br>    trainer = Trainer(<br>        accelerator=&quot;auto&quot;,<br>        devices=&quot;auto&quot;,<br>        logger=wandb_logger,<br>        max_steps=max_steps,<br>        num_sanity_val_steps=0,  # sanity check off<br>        limit_val_batches=limit_val_batches,<br>        check_val_every_n_epoch=validation_every_n_epochs,<br>        strategy=DDPStrategy(find_unused_parameters=True),<br>        gradient_clip_val=2.0,<br>        callbacks=[checkpoint_callback],<br>        num_nodes=1,<br>    )<br>    trainer.fit(latent_diffusion, loader, val_loader, ckpt_path=resume_from_checkpoint)<br>if __name__ == &quot;__main__&quot;:<br>    print(&quot;ok&quot;)<br>    parser = argparse.ArgumentParser()<br>    parser.add_argument(<br>        &quot;-c&quot;,<br>        &quot;--config_yaml&quot;,<br>        type=str,<br>        required=False,<br>        help=&quot;path to config .yaml file&quot;,<br>    )<br>    parser.add_argument(&quot;--val&quot;, action=&quot;store_true&quot;)<br>    args = parser.parse_args()<br>    perform_validation = args.val<br>    assert torch.cuda.is_available(), &quot;CUDA is not available&quot;<br>    config_yaml = args.config_yaml<br>    exp_name = os.path.basename(config_yaml.split(&quot;.&quot;)[0])<br>    exp_group_name = os.path.basename(os.path.dirname(config_yaml))<br>    config_yaml_path = os.path.join(config_yaml)<br>    config_yaml = yaml.load(open(config_yaml_path, &quot;r&quot;), Loader=yaml.FullLoader)<br>    if perform_validation:<br>        config_yaml[&quot;model&quot;][&quot;params&quot;][&quot;cond_stage_config&quot;][&quot;crossattn_audiomae_generated&quot;][&quot;params&quot;][&quot;use_gt_mae_output&quot;] = False<br>        config_yaml[&quot;step&quot;][&quot;limit_val_batches&quot;] = None<br>    main(config_yaml, config_yaml_path, exp_group_name, exp_name, perform_validation)</pre><h4>New run.sh</h4><pre>#!/bin/bash<br>export CUDA_LAUNCH_BLOCKING=1<br>export WANDB_MODE=offline<br>export OMP_NUM_THREADS=1<br><br>nvidia-smi<br>source bashrc_path<br>python3 ./audioldm_train/train/latent_diffusion.py -c ./audioldm_train/config/mos_as_token/qa_mdt.yaml</pre><h3>Started it up — it’s learning.</h3><p>Results and examples: <a href="https://netsvetaev.com/blog/ai/qa_mdt-training-without-lmdb/">https://netsvetaev.com/blog/ai/qa_mdt-training-without-lmdb/</a></p><h3>Conclusion</h3><p>With minimal experience, it took me <strong>a week</strong> to implement the necessary functions to generate the audio, and then about <strong>a month </strong>to prepare and upload the audio files for training the AI audio model.</p><p>In fact, most of the work was done by GPT — I only set tasks and sent errors back to chat for solution.</p><h3>About me</h3><p>My name is Artur Netsvetaev, I am a product manager, entrepreneur and UI/UX designer. I write <a href="https://netsvetaev.com/blog">about AI</a>, music and design.</p><p><a href="https://netsvetaev.com/">https://netsvetaev.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa8122251a89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Music Generation: QA_MDT inference]]></title>
            <link>https://medium.com/@netsvetaev/ai-music-generation-qa-mdt-inference-fef5233a49bb?source=rss-931a43d53d24------2</link>
            <guid isPermaLink="false">https://medium.com/p/fef5233a49bb</guid>
            <category><![CDATA[music]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[openmusic]]></category>
            <category><![CDATA[ai-model]]></category>
            <dc:creator><![CDATA[netsvetaev]]></dc:creator>
            <pubDate>Mon, 14 Jul 2025 07:41:02 GMT</pubDate>
            <atom:updated>2025-07-15T17:22:09.487Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c6GSz673xuex9G1Tzo5DkQ.jpeg" /></figure><p>Improving new AI music models qa_mdt for a small project I have in mind.</p><p>For the first time in a long time I’m writing code, including revision of other people’s sources. A year ago, working with code in GPT was like working with a schoolboy: I wrote some prototypes quickly, but everything had to be double-checked and given to a real programmer for revision and re-write.</p><p>Today GPT is already a full-fledged assistant, similar to a normal developer: it explains details, understands poorly formulated tasks, keeps changes in its head, and writes code normally. Problems arise from incompleteness of available information, but are solved by loading and analyzing specific files.</p><p>Having a little experience with picture generators (in fact, I only know how to read code in Python and roughly understand the scheme of work of different functions and components of neural networks, for example, samplers), in a week I finished the small features I needed for sound generation.</p><p>And then I sliced and normalized audio files, configured the software on the runpod server, assigned tokens to the samples and uploaded them to the database for further additional training of the basic model (the authors, by the way, write that it can be complex and they don’t recommend it). Well, not me, but GPT, of course — I just wrote “I want to do all this, help me please”. And it works.</p><p>For example, I found that the generation in QA_MDT always uses a fixed seed. I went into the files and made the generation random, as is usually done in Stable Diffusion (yes, it’s technically SD-based sound frequency picture generation, <a href="https://qa-mdt.github.io/">paper</a>). Then put the control of the seed and other parameters in the interface for easy management and model testing.</p><h3>Modifications</h3><h4>Example modification of infer_mos5.py</h4><pre>import re<br>def sanitize_filename(name: str) -&gt; str:<br>    return re.sub(r&#39;[&lt;&gt;:&quot;/\\|?*]&#39;, &#39;_&#39;, name).replace(&quot; &quot;, &quot;_&quot;)<br><br>def infer(dataset_key, configs, config_yaml_path, exp_group_name, exp_name, seed=0, output_filename=None, prompt=None):<br>    # If pipeline.py already add name, use it<br>    if output_filename is None:<br>        sanitized_prompt = sanitize_filename(prompt)<br>        output_filename = f&quot;{sanitized_prompt}_{seed}.wav&quot;<br>    print(f&quot;Infer: Will save to {output_filename}&quot;)<br>    latent_diffusion.generate_sample(<br>        val_loader,<br>        unconditional_guidance_scale=guidance_scale,<br>        ddim_steps=ddim_sampling_steps,<br>        n_gen=n_candidates_per_samples,<br>        name=output_filename<br>    )</pre><h4>Change ddpm.py to save output files with different names instead of ‘awesome.wav’</h4><pre>if name is None:<br>    name = &quot;awesome.wav&quot;<br>self.save_waveform(waveform, savepath=&quot;./&quot;, name=name)<br><br>output_filename = f&quot;{sanitized_prompt}_{seed}.wav&quot;<br>latent_diffusion.generate_sample(<br>    batchs=batchs,<br>    ddim_steps=ddim_steps,<br>    unconditional_guidance_scale=guidance_scale,<br>    name=output_filename,<br>    ...<br>)</pre><p><strong>Which results in someting like this:</strong></p><pre>Infer: Will save to smoke_on_water_cfg10.0_steps100_42.wav<br>Waveform saved at -&gt; smoke_on_water_cfg10.0_steps100_42.wav</pre><h4>Example modification of pipeline.py for random seed and other parameters</h4><pre>import random<br><br>def __call__(self, prompt: str, seed: int = None, cfg: float = None, steps: int = None):<br>    # If no seed, use random<br>    if seed is None:<br>        seed = random.randint(0, 999999)<br><br>    print(f&quot;Using seed = {seed}&quot;)<br><br>    # Make filename from parameters<br>    cfg_str = f&quot;cfg{cfg}&quot; if cfg is not None else &quot;cfg?&quot;<br>    steps_str = f&quot;steps{steps}&quot; if steps is not None else &quot;steps?&quot;<br>    filename = f&quot;{sanitized_prompt}_{cfg_str}_{steps_str}_{seed}.wav&quot;<br><br>    # Add cfg / steps to self.configs<br>    if cfg is not None:<br>        self.configs[&quot;model&quot;][&quot;params&quot;][&quot;evaluation_params&quot;][&quot;unconditional_guidance_scale&quot;] = cfg<br>    if steps is not None:<br>        self.configs[&quot;model&quot;][&quot;params&quot;][&quot;evaluation_params&quot;][&quot;ddim_sampling_steps&quot;] = steps<br><br>    dataset_key = self.build_dataset_json_from_prompt(prompt)<br>    infer(<br>        dataset_key=dataset_key,<br>        configs=self.configs,<br>        config_yaml_path=self.config_yaml,<br>        exp_group_name=&quot;qa_mdt&quot;,<br>        exp_name=&quot;mos_as_token&quot;,<br>        seed=seed,<br>        output_filename=filename,  # Set filename<br>        prompt=prompt<br>    )<br>    return filename<br><br>pipe = MOSDiffusionPipeline()<br>result = pipe(&quot;A modern synthesizer creating futuristic soundscapes.&quot;, seed=1234, cfg=10.0, steps=100)<br>print(f&quot;Generated file: {result}&quot;)</pre><h4>Example of inference with parameters</h4><pre>from qa_mdt.pipeline import MOSDiffusionPipeline<br><br>pipe = MOSDiffusionPipeline()<br>filename = pipe(prompt=&quot;smoke_on_water&quot;, seed=42, cfg=10.0, steps=100)<br>print(&quot;Generation done. File:&quot;, filename)</pre><h3>How to run QA_MDT (<a href="https://github.com/ivcylc/OpenMusic">OpenMusic</a>) on Runpod</h3><p>Minimum requirements: 36–48gb video ram, 30gb system and 100gb files SSD.</p><h4>Installation Instructions</h4><pre># 0. Docker commands<br>bash -c &quot;apt update;apt install -y wget;DEBIAN_FRONTEND=noninteractive apt-get install openssh-server -y;apt-get install -y magic-wormhole;apt-get install -y nano;apt-get install -y curl;apt-get install -y git;apt-get install -y git-lfs;apt-get install -y ffmpeg;apt-get install -y unzip;cd home;curl -O https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-x86_64.sh;chmod 777 Anaconda3-2024.10-1-Linux-x86_64.sh;cd ..;mkdir -p ~/.ssh;cd $_;chmod 700 ~/.ssh;echo YOUR_PUBLIC_KEY &gt; authorized_keys;chmod 700 authorized_keys;service ssh start;sleep infinity&quot;<br><br># 1. Conda<br>cd /home<br>bash Anaconda3-2024.10-1-Linux-x86_64.sh;<br>source ~/.bashrc<br>conda create -n oml python=3.11 -y &amp;&amp; conda activate oml<br><br># 2. QA_MDT install<br>git clone https://huggingface.co/jadechoghari/openmusic qa_mdt<br>ls -ltr<br>pip install diffusers<br>pip install matplotlib<br>pip install pandas<br>pip install einops<br>pip install h5py<br>pip install gdown<br>pip install xformers==0.0.26.post1<br>pip install torchlibrosa==0.0.9 librosa==0.9.2<br>pip install -q pytorch_lightning==2.1.3 torchlibrosa==0.0.9 librosa==0.9.2 ftfy==6.1.1 braceexpand<br>pip install torch==2.3.0+cu121 torchvision==0.18.0+cu121 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121<br>pip install -r qa_mdt/requirements.txt<br><br># 3. Now create a file with interference command<br>nano new.py<br># from qa_mdt.pipeline import MOSDiffusionPipeline<br>#<br># pipe = MOSDiffusionPipeline()<br># pipe(&quot;A modern synthesizer creating futuristic soundscapes.&quot;)<br><br># 4. Run<br>python new.py</pre><p>Note that I use Magic Wormhole (runpod have its own version of this). It allows you to send files easily from/to the server.</p><h4>Result</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wSaG2GgYdvJ64Moz.jpg" /></figure><p>The progress over the year is awesome. But I wanted to train my own model, <a href="https://netsvetaev.com/blog/ai/qa_mdt-training-without-lmdb/">and so I did</a>.</p><h3>About me</h3><p>My name is Artur Netsvetaev, I am a product manager, entrepreneur and UI/UX designer. I write <a href="https://netsvetaev.com/blog">about AI</a>, music and design.</p><p><a href="https://netsvetaev.com/">https://netsvetaev.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fef5233a49bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>