<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>VLLM on Intellectual Guides</title><link>https://ckw19810413.github.io/en/tags/vllm/</link><description>Recent content in VLLM on Intellectual Guides</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Mon, 17 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://ckw19810413.github.io/en/tags/vllm/index.xml" rel="self" type="application/rss+xml"/><item><title>Daily Graduate-Concept Fable: Speculative Decoding</title><link>https://ckw19810413.github.io/en/blog/speculative-decoding-fable/</link><pubDate>Mon, 17 Aug 2026 00:00:00 +0000</pubDate><guid>https://ckw19810413.github.io/en/blog/speculative-decoding-fable/</guid><description>&lt;p&gt;Good evening! Here is today&amp;rsquo;s &amp;ldquo;Daily Graduate-Concept Fable.&amp;rdquo;&lt;/p&gt;
&lt;h2 id="the-clever-apprentice-of-the-royal-scriptorium"&gt;The Clever Apprentice of the Royal Scriptorium
&lt;/h2&gt;&lt;p&gt;At the heart of the empire&amp;rsquo;s capital, the Royal Scriptorium faced a crisis unlike any before.&lt;/p&gt;
&lt;p&gt;The empire&amp;rsquo;s Grand Scholar, &amp;ldquo;Balthazar,&amp;rdquo; was the only person alive with the wisdom to draft the sacred legal code. He had a photographic memory, and his mind held ten million ancient texts. Yet he had one fatal flaw: he wrote far too slowly.&lt;/p&gt;
&lt;p&gt;The scholar&amp;rsquo;s rigor bordered on obsession. For every single word he wrote, he would leaf through countless heavy tomes in the library of his mind, deliberating carefully before slowly setting the word to the page. Having written that word, he would then reconsider everything he had just written to work out the next one. As a result, he could produce only one word per minute. The front lines desperately needed new decrees, yet the scholar could only squeeze them out one word at a time.&lt;/p&gt;
&lt;p&gt;At this point, the scriptorium had a young apprentice named &amp;ldquo;Leo.&amp;rdquo; Leo&amp;rsquo;s learning was nowhere near the scholar&amp;rsquo;s — the books in his head amounted to less than one percent of the scholar&amp;rsquo;s — but he had one strength: he was extremely quick, and he was very good at guessing the scholar&amp;rsquo;s mind.&lt;/p&gt;
&lt;p&gt;After observing for a few days, Leo made a bold proposal to the scholar.&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Master, rather than agonizing over every word from scratch, why don&amp;rsquo;t we change how we work?&amp;rdquo; said Leo. &amp;ldquo;Let me be your &amp;lsquo;drafter.&amp;rsquo; In one go, I&amp;rsquo;ll guess the next five words you&amp;rsquo;re likely to write and quickly jot them on a slate. Then you simply look at the slate.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The scholar frowned. &amp;ldquo;Absurd! Your learning is shallow — if the words you write are wrong, they&amp;rsquo;ll ruin the dignity of the code!&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&amp;ldquo;Master, you misunderstand,&amp;rdquo; Leo explained with a smile. &amp;ldquo;&lt;strong&gt;Conceiving a word from nothing&lt;/strong&gt; costs you enormous effort hauling tomes through your mind; but &lt;strong&gt;glancing over a few words and judging whether they match your intent&lt;/strong&gt; is effortless and lightning-fast for you. If you find the words I&amp;rsquo;ve written are correct, you simply stamp them with your seal. The moment you spot a single word that differs from what you had in mind, you erase that word and everything after it, write in the correct word yourself, and then I resume guessing from the word you corrected.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;Half-doubting, the scholar agreed.&lt;/p&gt;
&lt;p&gt;The work began. Leo swiftly wrote on the slate: &amp;ldquo;The empire / shall / levy / taxes / on the north.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The scholar swept his eyes across it, his mind instantly completing the verification — the five words fit his line of thought perfectly! He immediately stamped his great seal. A sentence that would once have taken five agonizing minutes was now done in seconds.&lt;/p&gt;
&lt;p&gt;Leo then quickly wrote: &amp;ldquo;the tax rate / is / annually / fifty / gold / coins.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The scholar glanced at it, frowned, and pointed to the fourth word: &amp;ldquo;Wrong. Not fifty — &amp;lsquo;one hundred.&amp;rsquo;&amp;rdquo;&lt;/p&gt;
&lt;p&gt;With a sweep of his brush, the scholar erased &amp;ldquo;fifty / gold / coins&amp;rdquo; and wrote in &amp;ldquo;one hundred&amp;rdquo; with his own hand.&lt;/p&gt;
&lt;p&gt;Then, looking at the word &amp;ldquo;one hundred,&amp;rdquo; Leo once more began his rapid guessing and drafting.&lt;/p&gt;
&lt;p&gt;Although Leo sometimes guessed wrong, he hit most ordinary phrasings precisely. Most remarkable of all, the final quality and wording of the code turned out to be &amp;ldquo;exactly identical&amp;rdquo; to what the scholar would have labored over one word at a time — with no compromise whatsoever — yet the overall drafting speed increased several times over.&lt;/p&gt;
&lt;h2 id="the-reveal-speculative-decoding"&gt;The Reveal: Speculative Decoding
&lt;/h2&gt;&lt;p&gt;What this story describes is an exceptionally elegant and pivotal graduate-level algorithm from the field of large-language-model (LLM) inference acceleration: &lt;strong&gt;Speculative Decoding&lt;/strong&gt;. It is also one of the core techniques used by modern high-performance inference engines (such as vLLM) to break through hardware performance bottlenecks.&lt;/p&gt;
&lt;p&gt;In traditional LLM text generation, the model must generate &lt;strong&gt;autoregressively&lt;/strong&gt; — one token after another. For large models with tens of billions of parameters (say, the Qwen 35B class), generating each single token requires hauling tens of gigabytes of weights from GPU memory to the compute cores. This means the bottleneck of large-model inference isn&amp;rsquo;t &lt;strong&gt;compute&lt;/strong&gt; at all, but &lt;strong&gt;memory bandwidth&lt;/strong&gt; — just as, in the story, the scholar has to laboriously haul heavy tomes to write a single word.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Speculative decoding&lt;/strong&gt; cleverly breaks this deadlock:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It introduces a tiny, extremely fast &lt;strong&gt;draft model&lt;/strong&gt; (the apprentice, Leo) to quickly generate several consecutive tokens in one go.&lt;/li&gt;
&lt;li&gt;It then hands these generated tokens to the large, precise &lt;strong&gt;target model&lt;/strong&gt; (the scholar) for a single round of &lt;strong&gt;parallel verification&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Because the target model, when &lt;em&gt;verifying&lt;/em&gt; the given tokens, can fully exploit the GPU&amp;rsquo;s massive parallel compute (compute-bound), it can judge in an instant whether these tokens&amp;rsquo; probability distribution matches its own output.&lt;/li&gt;
&lt;li&gt;If accepted, this amounts to generating multiple tokens in a single forward pass; if a token is rejected, the model corrects it at that point, discards the subsequent guesses, and starts over.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The most fascinating mathematical property is this: through a specific verification rejection-sampling algorithm, speculative decoding can guarantee that the final output&amp;rsquo;s probability distribution is mathematically &amp;ldquo;100% equivalent&amp;rdquo; to the distribution the target model would have produced on its own, slow generation — with no loss of generation quality whatsoever.&lt;/p&gt;
&lt;h2 id="mapping-the-metaphor"&gt;Mapping the Metaphor
&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Element in the story&lt;/th&gt;
&lt;th&gt;LLM inference concept&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Grand Scholar &amp;ldquo;Balthazar&amp;rdquo;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Target Model&lt;/td&gt;
&lt;td&gt;The large, highly accurate language model with a huge parameter count.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Clever apprentice &amp;ldquo;Leo&amp;rdquo;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Draft Model / Proposer&lt;/td&gt;
&lt;td&gt;A tiny, extremely fast small language model (or recent multi-head prediction architectures like MTP / Medusa).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Hauling heavy tomes to write&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Memory-bandwidth bound&lt;/td&gt;
&lt;td&gt;The latency caused by hauling model weights in traditional autoregressive generation.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Glancing over the sentence on the slate&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Parallel Verification&lt;/td&gt;
&lt;td&gt;The target model uses its GPU compute advantage to evaluate multiple tokens&amp;rsquo; probabilities in a single forward pass.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stamping the seal / erasing and rewriting&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Acceptance/Rejection Criterion&lt;/td&gt;
&lt;td&gt;If the draft model&amp;rsquo;s prediction falls within the target model&amp;rsquo;s probability tolerance, it is accepted; otherwise the model rolls back from the erroneous point and the target model supplies the correct token.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Quality unchanged&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Lossless Generation&lt;/td&gt;
&lt;td&gt;Speculative decoding&amp;rsquo;s most important mathematical guarantee: it does not alter the target model&amp;rsquo;s original output probability distribution.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;</description></item><item><title>Local AI Infrastructure Setup Guide: From Zero to vLLM + ComfyUI</title><link>https://ckw19810413.github.io/en/blog/local-ai-infrastructure-guide/</link><pubDate>Mon, 27 Jul 2026 00:00:00 +0000</pubDate><guid>https://ckw19810413.github.io/en/blog/local-ai-infrastructure-guide/</guid><description>&lt;h2 id="why-build-local-ai-infrastructure"&gt;Why Build Local AI Infrastructure?
&lt;/h2&gt;&lt;p&gt;In 2026, AI tools have become essential infrastructure for developers, creators, and enterprises. But most people still rely on cloud APIs — paying per call, risking data privacy, and hitting rate limits.&lt;/p&gt;
&lt;p&gt;Local AI infrastructure gives you three things: &lt;strong&gt;full control, unlimited usage, and zero marginal cost&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Once set up, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use LLMs without limits, no API fees&lt;/li&gt;
&lt;li&gt;Process sensitive data without leaving your machine&lt;/li&gt;
&lt;li&gt;Run multiple services simultaneously, no rate limits&lt;/li&gt;
&lt;li&gt;Integrate with frameworks like Cowork MCP for true multi-agent systems&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This guide assumes you have a machine with a GPU (DGX GB10, RTX 4090, or better recommended). I&amp;rsquo;ll walk you through building a complete local AI environment from scratch.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What you&amp;rsquo;ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Install and configure local LLM serving (vLLM)&lt;/li&gt;
&lt;li&gt;Deploy ComfyUI for image generation&lt;/li&gt;
&lt;li&gt;Manage GPU memory and service startup order&lt;/li&gt;
&lt;li&gt;Automate service management (systemd)&lt;/li&gt;
&lt;li&gt;Integrate with Cowork MCP for multi-agent AI teams&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&amp;rsquo;s get started.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="prerequisites"&gt;Prerequisites
&lt;/h2&gt;&lt;p&gt;Before we begin, make sure you have:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Item&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;th&gt;Check Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Linux&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ubuntu 22.04+ or Arch&lt;/td&gt;
&lt;td&gt;&lt;code&gt;uname -a&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;NVIDIA RTX 3090+/4090/GB10&lt;/td&gt;
&lt;td&gt;&lt;code&gt;nvidia-smi&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CUDA&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;≥ 12.4&lt;/td&gt;
&lt;td&gt;&lt;code&gt;nvcc --version&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Docker&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;≥ 24.0&lt;/td&gt;
&lt;td&gt;&lt;code&gt;docker --version&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Node.js&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;≥ 20&lt;/td&gt;
&lt;td&gt;&lt;code&gt;node --version&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Python&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;≥ 3.10&lt;/td&gt;
&lt;td&gt;&lt;code&gt;python3 --version&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If your GPU has less than 24GB memory, consider closing unnecessary GUI apps or services before starting.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="step-1-install-docker-and-nvidia-container-toolkit"&gt;Step 1: Install Docker and NVIDIA Container Toolkit
&lt;/h2&gt;&lt;p&gt;Docker is the recommended way to deploy local AI services because it isolates dependencies, avoids version conflicts, and prevents system pollution.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Install Docker&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt update
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt install -y docker.io docker-compose-v2
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Install NVIDIA Container Toolkit (enables GPU access in Docker)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;distribution&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;. /etc/os-release;echo $ID$VERSION_ID&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed &lt;span style="color:#e6db74"&gt;&amp;#39;s#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g&amp;#39;&lt;/span&gt; | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt update
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt install -y nvidia-container-toolkit
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo nvidia-ctk runtime configure --runtime&lt;span style="color:#f92672"&gt;=&lt;/span&gt;docker
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl restart docker
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Verify GPU availability:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;docker run --rm --gpus all nvidia/cuda:12.4.0-base-ubuntu22.04 nvidia-smi
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you see GPU info and memory usage, your environment is correctly configured.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="step-2-deploy-vllm-local-language-model"&gt;Step 2: Deploy vLLM Local Language Model
&lt;/h2&gt;&lt;p&gt;vLLM is currently the most efficient local LLM inference framework, supporting multiple model formats (GGUF, GPTQ, AWQ).&lt;/p&gt;
&lt;h3 id="21-deploy-with-docker"&gt;2.1 Deploy with Docker
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;docker run -d &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --name vllm-server &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --gpus all &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -p 8000:8000 &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -v ~/.cache/huggingface:/root/.cache/huggingface &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; vllm/vllm-openai:latest &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --model &lt;span style="color:#e6db74"&gt;&amp;#34;nvidia/Llama-3.1-Nemotron-70B-Instruct&amp;#34;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --gpu-memory-utilization 0.9 &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --max-model-len &lt;span style="color:#ae81ff"&gt;8192&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Parameter explanation:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--model&lt;/code&gt;: The model to deploy (replace with any HuggingFace model)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--gpu-memory-utilization&lt;/code&gt;: Ratio of GPU memory to use (0.9 means 90%)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--max-model-len&lt;/code&gt;: Maximum context length&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If your GPU has less than 80GB memory, start with smaller models (7B or 13B) before trying larger ones.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id="22-test-the-api-endpoint"&gt;2.2 Test the API Endpoint
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -X POST http://localhost:8000/v1/completions &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -H &lt;span style="color:#e6db74"&gt;&amp;#34;Content-Type: application/json&amp;#34;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -d &lt;span style="color:#e6db74"&gt;&amp;#39;{
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; &amp;#34;model&amp;#34;: &amp;#34;nvidia/Llama-3.1-Nemotron-70B-Instruct&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; &amp;#34;prompt&amp;#34;: &amp;#34;Explain what a multi-agent AI system is&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; &amp;#34;max_tokens&amp;#34;: 200
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; }&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you receive a response, vLLM is successfully deployed.&lt;/p&gt;
&lt;h3 id="23-setup-as-system-service-auto-start"&gt;2.3 Setup as System Service (Auto-start)
&lt;/h3&gt;&lt;p&gt;Create a systemd service file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo tee /etc/systemd/system/vllm.service &lt;span style="color:#e6db74"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;[Unit]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;Description=vLLM Local LLM Server
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;After=docker.service
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;Requires=docker.service
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;[Service]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;Type=oneshot
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;RemainAfterExit=yes
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;ExecStart=/usr/bin/docker start vllm-server
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;ExecStop=/usr/bin/docker stop vllm-server
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;[Install]
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;WantedBy=multi-user.target
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;EOF&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Enable and start the service:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl daemon-reload
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl enable vllm.service
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl start vllm.service
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h2 id="step-3-deploy-comfyui-image-generation"&gt;Step 3: Deploy ComfyUI Image Generation
&lt;/h2&gt;&lt;p&gt;ComfyUI is the most powerful local image generation tool, supporting Flux, Stable Diffusion, LTX, and various other models.&lt;/p&gt;
&lt;h3 id="31-deploy-with-docker"&gt;3.1 Deploy with Docker
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;docker run -d &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --name comfyui &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; --gpus all &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -p 8188:8188 &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -v ~/.cache/huggingface:/root/.cache/huggingface &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; -v ~/comfyui-output:/output &lt;span style="color:#ae81ff"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ghcr.io/ai-forest/comfyui:latest
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This starts ComfyUI at &lt;code&gt;http://localhost:8188&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="32-manual-installation-advanced-option"&gt;3.2 Manual Installation (Advanced Option)
&lt;/h3&gt;&lt;p&gt;If you need more control, you can install manually:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Clone ComfyUI repository&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd ~/comfyui
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git clone https://github.com/comfyanonymous/ComfyUI.git
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd ComfyUI
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Install dependencies&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pip install -r requirements.txt
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Install custom nodes (optional)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git clone https://github.com/Fannovel16/ComfyUI-Frame-Interpolation.git custom_nodes/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git clone https://github.com/laksjdjoy/deforum-comfy.git custom_nodes/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Start the service&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;python main.py --listen 0.0.0.0 --port &lt;span style="color:#ae81ff"&gt;8188&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="33-download-common-models"&gt;3.3 Download Common Models
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Use HuggingFace CLI to download models&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;pip install huggingface_hub
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;huggingface-cli download stabilityai/stable-diffusion-xl-base-1.0 --local-dir ~/models/sdxl
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;huggingface-cli download stabilityai/stable-diffusion-3.5-large --local-dir ~/models/sd3.5
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h2 id="step-4-gpu-memory-management-strategies"&gt;Step 4: GPU Memory Management Strategies
&lt;/h2&gt;&lt;p&gt;When running AI services locally, GPU memory is the biggest bottleneck. Here are some battle-tested practices:&lt;/p&gt;
&lt;h3 id="41-check-available-memory"&gt;4.1 Check Available Memory
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;free -h
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;nvidia-smi --query-gpu&lt;span style="color:#f92672"&gt;=&lt;/span&gt;memory.used,memory.free,temperature.gpu --format&lt;span style="color:#f92672"&gt;=&lt;/span&gt;csv
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="42-recommended-service-startup-order"&gt;4.2 Recommended Service Startup Order
&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Start vLLM first&lt;/strong&gt; (language models typically have fixed memory requirements)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Start ComfyUI second&lt;/strong&gt; (image generation can adjust memory usage dynamically)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Close unnecessary GUI apps&lt;/strong&gt; (browsers, Discord, etc.)&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="43-memory-monitoring-script"&gt;4.3 Memory Monitoring Script
&lt;/h3&gt;&lt;p&gt;Create a simple monitoring script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# monitor-gpu.sh&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;while&lt;/span&gt; true; &lt;span style="color:#66d9ef"&gt;do&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; echo &lt;span style="color:#e6db74"&gt;&amp;#34;=== &lt;/span&gt;&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;date&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;&lt;span style="color:#e6db74"&gt; ===&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; nvidia-smi --query-gpu&lt;span style="color:#f92672"&gt;=&lt;/span&gt;memory.used,memory.free,temperature.gpu --format&lt;span style="color:#f92672"&gt;=&lt;/span&gt;csv
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; docker ps --filter &lt;span style="color:#e6db74"&gt;&amp;#34;name=vllm\|name=comfyui&amp;#34;&lt;/span&gt; --format &lt;span style="color:#e6db74"&gt;&amp;#34;table {{.Names}}\t{{.Status}}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; sleep &lt;span style="color:#ae81ff"&gt;30&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h2 id="step-5-integrate-cowork-mcp-multi-agent-framework"&gt;Step 5: Integrate Cowork MCP Multi-Agent Framework
&lt;/h2&gt;&lt;p&gt;Once your local AI infrastructure is ready, connect it to Cowork MCP to build multi-agent systems.&lt;/p&gt;
&lt;h3 id="51-register-vllm-as-a-brain"&gt;5.1 Register vLLM as a Brain
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# If using Hermes Agent&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hermes register-cowork
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Or manually set up MCP endpoints&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# In your Agent config file:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;mcpServers&amp;#34;&lt;/span&gt;: &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;cowork&amp;#34;&lt;/span&gt;: &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;url&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;http://localhost:6868/mcp&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;transport&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;streamable-http&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;vllm&amp;#34;&lt;/span&gt;: &lt;span style="color:#f92672"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;url&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;http://localhost:8000/v1&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;transport&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;streamable-http&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="52-real-application-local-ai-content-pipeline"&gt;5.2 Real Application: Local AI Content Pipeline
&lt;/h3&gt;&lt;pre tabindex="0"&gt;&lt;code&gt;Local vLLM (Content Generation) → ComfyUI (Image Generation) → ffmpeg (Post-processing)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Every step of this pipeline can be coordinated by different AI agents:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Research Agent&lt;/strong&gt;: Use vLLM to generate content outlines&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Writing Agent&lt;/strong&gt;: Use vLLM to expand into full articles&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Image Agent&lt;/strong&gt;: Use ComfyUI to generate corresponding illustrations&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Integration Agent&lt;/strong&gt;: Combine content and images into final output&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2 id="step-6-automation-and-backup"&gt;Step 6: Automation and Backup
&lt;/h2&gt;&lt;h3 id="61-container-backup"&gt;6.1 Container Backup
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Backup ComfyUI container state&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;docker commit comfyui comfyui-backup:&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;date +%Y%m%d&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Export image&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;docker save comfyui:latest | gzip &amp;gt; ~/backups/comfyui-&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;date +%Y%m%d&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;.tar.gz
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="62-model-backup"&gt;6.2 Model Backup
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Regularly backup HuggingFace cache&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -avh ~/.cache/huggingface ~/backups/huggingface-cache/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Or use rclone to backup to cloud&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rclone sync ~/.cache/huggingface remote:backup-huggingface --progress
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="63-health-check-script"&gt;6.3 Health Check Script
&lt;/h3&gt;&lt;p&gt;Create health check cron jobs:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Check service status every 5 minutes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;*/5 * * * * curl -f http://localhost:8000/v1/models &lt;span style="color:#f92672"&gt;||&lt;/span&gt; echo &lt;span style="color:#e6db74"&gt;&amp;#34;vLLM is down at &lt;/span&gt;&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;date&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; | mail -s &lt;span style="color:#e6db74"&gt;&amp;#34;vLLM Alert&amp;#34;&lt;/span&gt; admin@example.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h2 id="troubleshooting"&gt;Troubleshooting
&lt;/h2&gt;&lt;h3 id="q1-docker-cannot-use-gpu"&gt;Q1: Docker Cannot Use GPU
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Check if NVIDIA Container Toolkit is installed&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;nvidia-ctk runtime verify
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Restart Docker service&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl restart docker
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="q2-gpu-memory-insufficient"&gt;Q2: GPU Memory Insufficient
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Reduce vLLM memory utilization&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Add to docker run command:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;--gpu-memory-utilization 0.7
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Or stop unnecessary services&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo systemctl stop bluetooth
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="q3-comfyui-fails-to-start"&gt;Q3: ComfyUI Fails to Start
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Check Docker logs&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;docker logs comfyui
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Try restarting&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;docker restart comfyui
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="q4-slow-model-downloads"&gt;Q4: Slow Model Downloads
&lt;/h3&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Use HuggingFace mirror (for users in mainland China)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;export HF_ENDPOINT&lt;span style="color:#f92672"&gt;=&lt;/span&gt;https://hf-mirror.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;hr&gt;
&lt;h2 id="whats-next"&gt;What&amp;rsquo;s Next
&lt;/h2&gt;&lt;p&gt;You now have a complete local AI infrastructure:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Today:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Confirm vLLM and ComfyUI are running&lt;/li&gt;
&lt;li&gt;Test API endpoints to verify content and image generation work&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;This Week:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up systemd services for auto-start on boot&lt;/li&gt;
&lt;li&gt;Create backup and monitoring mechanisms&lt;/li&gt;
&lt;li&gt;Connect at least one LLM backend to Cowork MCP&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;This Month:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Explore the &lt;a class="link" href="https://github.com/slashman413/cowork" target="_blank" rel="noopener"
&gt;Cowork MCP framework&lt;/a&gt; for more AI agent teams&lt;/li&gt;
&lt;li&gt;Experiment with different models to find the best configuration for your needs&lt;/li&gt;
&lt;li&gt;Build your own AI content production pipeline&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="faq"&gt;FAQ
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;Q: What level of GPU do I need to run these services?&lt;/strong&gt;
A: At least 24GB memory recommended (RTX 3090/4090). If memory is smaller, you can run smaller models (7B-13B) or use Docker memory limits.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: Can I run this on a machine without GPU?&lt;/strong&gt;
A: Yes, but it will be slow. CPU inference is possible, but not practical for large models (70B+).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: How do I update models?&lt;/strong&gt;
A: Use HuggingFace CLI: &lt;code&gt;huggingface-cli download &amp;lt;model-name&amp;gt; --local-dir &amp;lt;path&amp;gt;&lt;/code&gt;. Docker containers will automatically use updated local models.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: What&amp;rsquo;s the difference between vLLM and Ollama?&lt;/strong&gt;
A: vLLM is optimized for high-throughput inference and supports more model formats and advanced features. Ollama is more lightweight and easier to use but has fewer features. For local AI infrastructure, vLLM is recommended.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Q: How does ComfyUI differ from Automatic1111?&lt;/strong&gt;
A: ComfyUI uses a node-based workflow, making it more flexible and efficient. Automatic1111 has a GUI that&amp;rsquo;s more beginner-friendly. Both work well, but ComfyUI is more popular in production environments.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;Read time: ~15 minutes | Published: 2026-07-27&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Find this guide helpful? Explore more guides on &lt;a class="link" href="https://ckw19810413.github.io/en/" &gt;Slashman Tools&lt;/a&gt; or check out our &lt;a class="link" href="https://ckw19810413.github.io/enhttps://gumroad.com/l/diwoc" &gt;AI Toolchain Template Library&lt;/a&gt; for ready-to-use configurations.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;[&lt;a class="link" href="https://ckw19810413.github.io/en/" &gt;- Back to Home&lt;/a&gt;]&lt;/p&gt;</description></item></channel></rss>