Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Interface de linha de comando","local":"command-line-interface","sections":[{"title":"Comandos disponíveis","local":"available-commands","sections":[],"depth":2},{"title":"env","local":"env","sections":[],"depth":2},{"title":"schema","local":"schema","sections":[],"depth":2},{"title":"executar","local":"run","sections":[{"title":"Passando argumentos de pipeline","local":"passing-pipeline-arguments","sections":[],"depth":3},{"title":"Carregando","local":"loading","sections":[],"depth":3},{"title":"Otimizações","local":"optimizations","sections":[],"depth":3},{"title":"Pipelines modulares","local":"modular-pipelines","sections":[],"depth":3},{"title":"Saídas","local":"outputs","sections":[],"depth":3},{"title":"Execução remota ( --remote )","local":"remote-execution----remote-","sections":[],"depth":3}],"depth":2},{"title":"custom_blocks","local":"customblocks","sections":[],"depth":2},{"title":"fp16_safetensors","local":"fp16safetensors","sections":[],"depth":2},{"title":"habilidades","local":"skills","sections":[],"depth":2}],"depth":1}"/> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/start.0S0_iEoG.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/I9eooN77.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/Bupkjr9f.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/entry/app.CPdOxCbw.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/CyvZ3FS5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/l0QnnOED.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DnVIJfC5.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/0.DteTvmQZ.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/CoSrdQax.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/nodes/388.Cww0re_K.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/main/en/_app/immutable/chunks/DSPDl1gz.js" rel="modulepreload"> | |
| <!--1wkohmy--><meta name="hf:doc:metadata" content="{"title":"Command line interface","local":"command-line-interface","sections":[{"title":"Available commands","local":"available-commands","sections":[],"depth":2},{"title":"env","local":"env","sections":[],"depth":2},{"title":"schema","local":"schema","sections":[],"depth":2},{"title":"run","local":"run","sections":[{"title":"Passing pipeline arguments","local":"passing-pipeline-arguments","sections":[],"depth":3},{"title":"Loading","local":"loading","sections":[],"depth":3},{"title":"Optimizations","local":"optimizations","sections":[],"depth":3},{"title":"Modular pipelines","local":"modular-pipelines","sections":[],"depth":3},{"title":"Outputs","local":"outputs","sections":[],"depth":3},{"title":"Remote execution ( --remote )","local":"remote-execution----remote-","sections":[],"depth":3}],"depth":2},{"title":"custom_blocks","local":"customblocks","sections":[],"depth":2},{"title":"fp16_safetensors","local":"fp16safetensors","sections":[],"depth":2},{"title":"skills","local":"skills","sections":[],"depth":2}],"depth":1}"/><!----> | |
| <link href="/docs/diffusers/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <div class="items-center shrink-0 min-w-[100px] max-sm:min-w-[50px] justify-end ml-auto flex" style="float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"><div dir="ltr" class="inline-flex rounded-md max-sm:rounded-sm"><button class="inline-flex items-center gap-1 h-7 max-sm:h-7 px-2 max-sm:px-1.5 text-sm font-medium text-gray-800 border border-r-0 rounded-l-md max-sm:rounded-l-sm border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-live="polite"><span class="inline-flex items-center justify-center rounded-md p-0.5 max-sm:p-0 hover:text-gray-800 dark:hover:text-gray-200"><svg class="sm:size-3.5 size-3" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----></span> <span dir="auto">Copy page</span></button> <button class="inline-flex items-center justify-center w-6 max-sm:w-5 h-7 max-sm:h-7 disabled:pointer-events-none text-sm text-gray-500 hover:text-gray-700 dark:hover:text-white rounded-r-md max-sm:rounded-r-sm border border-l transition border-gray-200 bg-white hover:shadow-inner dark:border-gray-850 dark:bg-gray-950 dark:text-gray-200 dark:hover:bg-gray-800" aria-haspopup="menu" aria-expanded="false" aria-label="Open copy menu"><svg class="transition-transform text-gray-400 overflow-visible sm:size-3.5 size-3 rotate-0" width="1em" height="1em" viewBox="0 0 12 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="currentColor"></path></svg><!----></button></div> <!--[-1--><!--]--></div><!----> <!--[0--><h1 class="relative group"><a id="command-line-interface" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#command-line-interface"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Interface de linha de comando<!----></span></h1><!--]--><!----> <p><code>diffusers-cli</code> é um cliente de linha de comando para executar, inspecionar e empacotar pipelines do Diffusers.</p> <!--[1--><h2 class="relative group"><a id="available-commands" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#available-commands"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Comandos disponíveis<!----></span></h2><!--]--><!----> <table><thead><tr><th>Comando</th><th>Propósito</th></tr></thead><tbody><tr><td><a href="#env"><code>env</code></a></td><td>Imprime informações do ambiente para relatórios de bugs.</td></tr><tr><td><a href="#schema"><code>schema</code></a></td><td>Inspecione a assinatura de <code>__call__</code> de um pipeline sem baixar os pesos.</td></tr><tr><td><a href="#run"><code>run</code></a></td><td>Execute um pipeline localmente ou em um Hugging Face Sandbox.</td></tr><tr><td><a href="#customblocks"><code>custom_blocks</code></a></td><td>Empacote uma subclasse local de <code>ModularPipelineBlocks</code> para o Hub.</td></tr><tr><td><a href="#fp16safetensors"><code>fp16_safetensors</code></a></td><td>Converta um checkpoint para fp16 <code>.safetensors</code>.</td></tr><tr><td><a href="#skills"><code>skills</code></a></td><td>Instale bundles de habilidades pré-criados no seu agente de codificação com IA.</td></tr></tbody></table> <blockquote class="tip"><p>Esta página não fornece detalhes para todas as opções de cada subcomando. Para a lista completa e sempre atualizada de opções de qualquer subcomando, execute <code>diffusers-cli <command> --help</code> (<code>diffusers-cli run --help</code>).</p></blockquote> <!--[1--><h2 class="relative group"><a id="env" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#env"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->env<!----></span></h2><!--]--><!----> <p>Imprime as versões do Python, PyTorch e Diffusers, as informações da CUDA e as dependências opcionais instaladas. Use-o ao abrir uma issue para que os mantenedores possam reproduzir seu ambiente.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!---->diffusers-cli <span class="hljs-built_in">env</span><!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="schema" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#schema"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->schema<!----></span></h2><!--]--><!----> <p>Retorna as entradas aceitas pelo pipeline sem baixar os pesos. Use-o ao construir <code>--pipeline-kwargs</code> para <a href="#run"><code>run</code></a>.</p> <p>Apenas o arquivo de índice é obtido. Os pipelines padrão leem <code>model_index.json</code>. Os pipelines modulares leem <code>modular_model_index.json</code>. Os repositórios de blocos personalizados leem <code>modular_config.json</code> e precisam de <code>--trust-remote-code</code>, pois carregá-los executa código do Hub.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!---->diffusers-cli --format json schema --model black-forest-labs/FLUX.1-dev | |
| diffusers-cli schema --model my-org/my-custom-blocks --trust-remote-code<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="run" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#run"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->executar<!----></span></h2><!--]--><!----> <p>Execute um pipeline de ponta a ponta. O CLI detecta automaticamente repositórios padrão ou modulares. Ele carrega automaticamente entradas de mídia de URLs ou caminhos locais, salva as saídas com base no tipo de retorno do pipeline e pode ser executado remotamente em um Hugging Face Sandbox via <code>--remote</code>.</p> <p>Exemplo mínimo:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!---->diffusers-cli run \ | |
| --model black-forest-labs/FLUX.1-dev \ | |
| --dtype bf16 \ | |
| --pipeline-kwargs <span class="hljs-string">'{"prompt": "an astronaut riding a horse"}'</span><!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="passing-pipeline-arguments" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#passing-pipeline-arguments"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Passando argumentos de pipeline<!----></span></h3><!--]--><!----> <p><code>--pipeline-kwargs</code> aceita um objeto JSON que é encaminhado para <code>pipeline(**kwargs)</code>. Valores de string nas chaves de entrada de mídia conhecidas são carregados automaticamente:</p> <ul><li>Imagens (<code>image</code>, <code>last_image</code>, <code>mask_image</code>, <code>control_image</code>, <code>ip_adapter_image</code>, <code>image_2</code>) → <code>PIL.Image</code> via <code>load_image</code>.</li> <li>Vídeos (<code>video</code>, <code>control_video</code>) → <code>list[PIL.Image]</code> via <code>load_video</code>.</li> <li>Áudio (<code>initial_audio_waveforms</code>, <code>reference_audio</code>, <code>src_audio</code>) → <code>torch.Tensor</code> via <code>torchaudio.load</code>.</li></ul> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!---->diffusers-cli run \ | |
| --model black-forest-labs/FLUX.2-klein-9B --dtype bf16 \ | |
| --pipeline-kwargs <span class="hljs-string">'{"prompt": "make the fur grey", "image": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png", "strength": 0.6}'</span><!----></pre></div><!----> <p>Tanto as chaves de mídia quanto as chaves de texto aceitam um array JSON para executar um lote em uma única chamada de pipeline. Cada entrada | |
| em uma lista de mídia é carregada individualmente (URL, caminho local ou caminho de bucket montado), e o Diffusers processa a | |
| lista inteira em uma única passagem de frente na GPU:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!---->diffusers-cli run \ | |
| --model black-forest-labs/FLUX.1-Kontext-dev --dtype bf16 \ | |
| --pipeline-kwargs <span class="hljs-string">'{ | |
| "prompt": ["make it grey", "make it pink", "make it blue"], | |
| "image": [ | |
| "https://.../cat1.png", | |
| "https://.../cat2.png", | |
| "https://.../cat3.png" | |
| ] | |
| }'</span><!----></pre></div><!----> <!--[2--><h3 class="relative group"><a id="loading" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#loading"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Carregando<!----></span></h3><!--]--><!----> <p>Configure como a CLI carrega os pesos do modelo e o código personalizado do pipeline.</p> <ul><li><p><code>--dtype {auto, bfloat16, bf16, float16, fp16, float32, fp32}</code> — dtype dos pesos.</p></li> <li><p><code>--device-map <value></code> — posicionamento dos componentes. Aceita uma string de dispositivo do torch (<code>cuda</code>, <code>cuda:0</code>, <code>cpu</code>, <code>mps</code>), <code>balanced</code> (divide automaticamente os componentes entre as GPUs visíveis) ou um dicionário JSON para posicionamento explícito por componente. | |
| Detectado automaticamente se omitido. Consulte <a href="../optimization/device_map">device_map</a> para mais detalhes.</p></li> <li><p><code>--variant fp16</code> — escolha uma variante de pesos.</p></li> <li><p><code>--revision <sha></code> — fixa uma revisão específica do modelo.</p></li> <li><p><code>--trust-remote-code</code> — permite código personalizado do Hub (necessário para repositórios que incluem classes de pipeline personalizadas ou blocos modulares). Consulte <a href="../using-diffusers/custom_pipeline_overview">Pipelines da comunidade</a> para pipelines personalizados padrão e <a href="../modular_diffusers/overview">Modular Diffusers</a>.</p></li> <li><p><code>--lora <spec></code> — anexe um adaptador LoRA após o carregamento. Cada valor é um dicionário JSON. Repita a flag para empilhar múltiplos adaptadores. <code>lora_id</code> é obrigatório por entrada, <code>lora_scale</code> tem valor padrão de <code>1.0</code>, e <code>adapter_name</code> é opcional (gerado automaticamente como <code>lora_<i></code> ao empilhar).</p> <ul><li>Simples: <code>--lora '{"lora_id": "alvdansen/flux-koda", "lora_scale": 0.8}'</code></li> <li>Múltiplos: <code>--lora '{"lora_id": "alvdansen/flux-koda", "lora_scale": 0.6, "adapter_name": "koda"}' --lora '{"lora_id": "Shakker-Labs/FLUX.1-dev-LoRA-AntiBlur", "lora_scale": 0.4}'</code></li></ul> <p>Todas as especificações são carregadas por <code>pipeline.load_lora_weights(...)</code> e, em seguida, ativadas juntas com uma única chamada de <code>pipeline.set_adapters(names, adapter_weights=scales)</code>. Consulte <a href="../tutorials/using_peft_for_inference">LoRA</a> para um guia mais detalhado sobre empilhamento de adaptadores, agendamento de escala e troca dinâmica.</p></li></ul> <!--[2--><h3 class="relative group"><a id="optimizations" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#optimizations"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Otimizações<!----></span></h3><!--]--><!----> <ul><li><code>--cpu-offload {model, group, auto}</code> — a origem do destino do onload vem de <code>--device-map</code> (string de dispositivo simples necessária para offload). <ul><li><code>model</code> — <code>enable_model_cpu_offload</code> for standard pipelines. See <a href="../optimization/memory#model-offloading">Model offloading</a>.</li> <li><code>group</code> — <code>enable_group_offload(offload_type="leaf_level", use_stream=True)</code> para pipelines padrão. Consulte <a href="../optimization/memory#group-offloading">Group offloading</a>.</li> <li><code>auto</code> — apenas modular com <a href="../modular_diffusers/components_manager"><code>ComponentsManager</code></a>. Os modos padrão geram exceção em pipelines modulares. <code>auto</code> gera exceção em pipelines padrão.</li></ul></li> <li><code>--offload-margin <size></code> — memória do dispositivo mantida livre para ativações sob <code>--cpu-offload auto</code>, passada para <code>enable_auto_cpu_offload</code> como <code>memory_reserve_margin</code> (padrão <code>3GB</code>). Aumente esse valor quando um canvas grande esgotar a memória no meio do forward. O offloader mantém os componentes residentes enquanto couberem, de modo que, em uma placa com muito VRAM, a margem padrão pode deixar pouco espaço para as ativações de um vídeo longo.</li> <li><code>--attention-backend</code> — kernels de atenção hospedados no Hub, baixados automaticamente no primeiro uso. As opções são <code>default</code> mais os backends do Hub registrados no Diffusers (por exemplo, <code>flash_hub</code>, <code>flash_varlen_hub</code>, <code>flash_4_hub</code>, <code>sage_hub</code>, <code>sage_blackwell_hub</code>). Execute <code>diffusers-cli run --help</code> para ver a lista atual. Ele suporta apenas pipelines baseados em Transformer e é ignorado com um aviso em pipelines UNet legados. Veja <a href="../optimization/attention_backends">Backends de atenção</a>.</li> <li><code>--vae-tiling</code> / <code>--vae-slicing</code> — reduz a VRAM usada no decodificação do VAE. Veja <a href="../optimization/memory#vae-tiling">VAE tiling</a> e <a href="../optimization/memory#vae-slicing">VAE slicing</a>.</li> <li><code>--compile [JSON]</code> — compila os módulos do denoiser com <a href="../optimization/fp16#torchcompile">torch.compile</a>. A | |
| CLI prefere <a href="../optimization/fp16#regional-compilation">compilação regional</a> para módulos com blocos repetidos. O | |
| <code>--compile</code> simples usa <code>fullgraph=true</code>. Um objeto JSON é encaminhado para <code>torch.compile</code>. Não é | |
| suportado com <code>--context-parallel</code>.</li> <li><code>--context-parallel</code> — paralelismo de contexto no estilo Ulysses em um pipeline baseado em DiT. Localmente, requer torchrun, mas | |
| sob <code>--remote</code>, a CLI encapsula <code>torchrun --nproc-per-node=gpu</code> para você. Veja <a href="../optimization/context_parallelism">Paralelismo de contexto</a>.</li></ul> <!--[2--><h3 class="relative group"><a id="modular-pipelines" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#modular-pipelines"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Pipelines modulares<!----></span></h3><!--]--><!----> <p><code>run</code> detecta automaticamente um <a href="../modular_diffusers/overview">repositório modular</a> — seja porque ele inclui um <code>modular_model_index.json</code>, seja porque seu <code>model_index.json</code> nomeia uma subclasse de <code>ModularPipeline</code> —, portanto, nenhuma flag é necessária para ativar essa funcionalidade.</p> <p>Alguns repositórios modulares definem vários <em>workflows</em>, como tarefas nomeadas que compartilham componentes, mas diferem em quais blocos são executados e quais entradas recebem. <a href="../api/pipelines/minimax_h3">MiniMax-H3</a>, por exemplo, oferece <code>t2va</code> (texto para vídeo e áudio), <code>fl2va</code> (primeiro e/ou último keyframe) e <code>ref2va</code> (uma mistura ordenada de referências de imagem, vídeo e áudio). Passe <code>--workflow</code> para selecionar um:</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!---->diffusers-cli run \ | |
| --model MiniMaxAI/MiniMax-H3 --workflow fl2va \ | |
| --pipeline-kwargs <span class="hljs-string">'{ | |
| "prompt": "the camera pushes in slowly as rain falls", | |
| "image": "opening-frame.png", | |
| "last_image": "closing-frame.png", | |
| "num_frames": 124 | |
| }'</span> \ | |
| --output-key videos --output-key audio \ | |
| --fps 24 --sampling-rate 32000 \ | |
| --cpu-offload auto --dtype bf16<!----></pre></div><!----> <p>Selecionar um workflow mantém apenas os blocos daquela tarefa, de modo que o pipeline declara somente os componentes de que precisa e <code>load_components</code> busca apenas os subdiretórios correspondentes. Omita <code>--workflow</code> para manter todos os workflows disponíveis e permitir que o pipeline escolha a cada chamada com base nas entradas fornecidas.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!---->diffusers-cli --format json schema --model MiniMaxAI/MiniMax-H3 --trust-remote-code<!----></pre></div><!----> <p><code>--workflow</code> se aplica apenas a pipelines modulares. É ignorado com um aviso em pipelines padrão.</p> <p>Um pipeline modular retorna um <a href="../modular_diffusers/modular_pipeline"><code>PipelineState</code></a> em vez de um único objeto de saída, portanto <code>--output-key</code> nomeia o intermediário a ser salvo.</p> <!--[2--><h3 class="relative group"><a id="outputs" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#outputs"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Saídas<!----></span></h3><!--]--><!----> <p><code>run</code> detecta o tipo de saída do pipeline:</p> <ul><li><code>PIL.Image</code>/lista → <code><NNNN>.png</code> (índice com zeros à esquerda, por exemplo, <code>0000.png</code>)</li> <li>Sequência de imagens → <code>0000.mp4</code> (<code>--fps</code> controla a taxa de quadros, padrão 8)</li> <li>Array de áudio → <code>0000.wav</code> (<code>--sampling-rate</code> controla a taxa)</li> <li>Qualquer outra coisa → despejo JSON</li></ul> <p>O formato padrão do diretório de saída é <code>~/.diffusers/cli/run/outputs/diffusers-run-<YYYYMMDDTHHMMSS>-<uuid>/</code>. Cada | |
| execução recebe seu próprio subdiretório para que invocações consecutivas não sobrescrevam os resultados.</p> <p>Substitua com <code>--output <path></code>. A forma como o caminho é expandido depende do seu formato e do tamanho do lote:</p> <table><thead><tr><th><code>--output</code></th><th>1 saída</th><th>N saídas</th></tr></thead><tbody><tr><td><em>omitido</em></td><td>diretório padrão → <code>0000.png</code></td><td>diretório padrão → <code>0000.png</code>, <code>0001.png</code>, <code>0002.png</code>, …</td></tr><tr><td><code>./results/</code> (com <code>/</code> no final ou um diretório existente)</td><td><code>./results/0000.png</code></td><td><code>./results/0000.png</code>, <code>./results/0001.png</code>, …</td></tr><tr><td><code>my-cat.png</code> (caminho do arquivo)</td><td><code>my-cat.png</code> (usado literalmente)</td><td><code>my-cat-0000.png</code>, <code>my-cat-0001.png</code>, …</td></tr></tbody></table> <p>As saídas de diretório sempre usam nomes com preenchimento simples (<code>0000</code>, <code>0001</code>, …). Os caminhos de arquivo explícitos preservam o prefixo escolhido e recebem o índice com preenchimento anexado quando o lote produz múltiplas saídas.</p> <p>Use <code>--push-to</code> para enviar as saídas para um <a href="https://huggingface.co/docs/hub/en/storage-buckets" rel="nofollow">bucket de armazenamento do Hugging Face</a>. Ele aceita um:</p> <ul><li>ID do bucket do HF (<code><namespace>/<name></code>)</li> <li><code>hf://buckets/<namespace>/<name>[/<subpath>]</code> <a href="https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_uris" rel="nofollow">URI do HF</a></li> <li>URL do navegador</li></ul> <p>Um subpath é usado como um prefixo de pasta. O bucket é criado se não existir, e os objetos são armazenados em <code>[<subpath>/]<run_id>/<filename></code>.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!----><span class="hljs-comment"># HF bucket id — files at hf://buckets/alice/edit-outputs/<run_id>/<file></span> | |
| --push-to alice/edit-outputs | |
| <span class="hljs-comment"># URI with subpath — files at hf://buckets/alice/edit-outputs/greyscale/2026-07/<run_id>/<file></span> | |
| --push-to hf://buckets/alice/edit-outputs/greyscale/2026-07 | |
| <span class="hljs-comment"># Browser URL copy-paste from the Hub also works.</span> | |
| --push-to https://huggingface.co/buckets/alice/edit-outputs/tree/greyscale/2026-07<!----></pre></div><!----> <p>A tabela abaixo descreve execuções remotas. Para execuções locais, <code>--push-to</code> faz o upload da saída salva localmente. Ele não suprime a criação de arquivos locais.</p> <table><thead><tr><th><code>--push-to</code> definido?</th><th><code>--output</code> definido?</th><th>Resultado</th></tr></thead><tbody><tr><td>não</td><td>não</td><td>baixar para o diretório local padrão</td></tr><tr><td>não</td><td>sim</td><td>baixar para <code>--output</code></td></tr><tr><td>sim</td><td>não</td><td>somente bucket, sem download local</td></tr><tr><td>sim</td><td>sim</td><td>bucket E <code>--output</code></td></tr></tbody></table> <p><code>--format</code> define os metadados do stdout (caminhos, tempo de execução, informações do sandbox). Ele não altera o formato de arquivo da própria mídia. As imagens gravadas são sempre PNG, os vídeos MP4 e o áudio WAV.</p> <!--[2--><h3 class="relative group"><a id="remote-execution----remote-" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#remote-execution----remote-"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Execução remota ( --remote )<!----></span></h3><!--]--><!----> <p>Execute a mesma chamada dentro de um <a href="https://huggingface.co/docs/huggingface_hub/en/guides/sandbox" rel="nofollow">Hugging Face Sandbox</a> — uma VM de nuvem isolada que a CLI controla via HTTP: ela faz o upload dos inputs, executa o pipeline, faz o download dos outputs e, em seguida, encerra o sandbox. Requer <code>huggingface_hub>=1.23</code>.</p> <p>O sandbox inicia a partir de <a href="https://hub.docker.com/r/diffusers/diffusers-cli-cuda" rel="nofollow"><code>diffusers/diffusers-cli-cuda</code></a>, uma imagem pré-compilada que já inclui torch, CUDA e as dependências do CLI, de modo que uma execução a frio começa a gerar em vez de instalar primeiro.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!---->diffusers-cli run \ | |
| --model black-forest-labs/FLUX.1-dev --dtype bf16 \ | |
| --pipeline-kwargs <span class="hljs-string">'{"prompt": "an astronaut riding a horse"}'</span> \ | |
| --remote --flavor a100-large<!----></pre></div><!----> <p>Flags remotas:</p> <ul><li><code>--flavor <name></code> — hardware do sandbox (por exemplo, <code>a10g-small</code>, <code>h200</code>, <code>rtx-pro-6000</code>).</li> <li><code>--timeout <duration></code> — tempo máximo de execução do comando de execução dentro do sandbox (padrão <code>10m</code>).</li> <li><code>--dependencies <pkg></code> — dependências pip extras (repetível), instaladas por cima da imagem. Útil para fixar um tarball de uma branch do diffusers ou adicionar extras específicos de pipeline.</li> <li><code>--namespace <name></code> — cria o sandbox em uma organização/conta do HF diferente.</li> <li><code>--image <ref></code> — substitui a imagem do sandbox. Deve incluir torch + CUDA compatível com o driver do seu <code>--flavor</code>. O CLI então instala suas próprias dependências por cima em cada sandbox frio, o que a imagem padrão evita.</li> <li><code>--volume <bucket-id>[:<mount-path>]</code> — monta um <a href="https://huggingface.co/docs/hub/en/storage-buckets" rel="nofollow">bucket de armazenamento do HF</a> na sandbox como um diretório de leitura e gravação (repetível). O caminho de montagem padrão é <code>/mnt/buckets/<bucket-id></code>. Refira-se aos arquivos montados em <code>--pipeline-kwargs</code> como qualquer outro caminho local. | |
| Aplicado apenas na criação de uma nova sandbox e ignorado ao reconectar via <code>--sandbox-id</code>.</li></ul> <p>Por padrão, cada execução de <code>--remote</code> é efêmera (criar → executar → baixar → encerrar). Para reutilizar um sandbox quente entre | |
| execuções — mantendo as dependências, o cache de pesos do modelo e o cache do <code>torch.compile</code> no disco — mantenha-o ativo e | |
| reconecte-se:</p> <ul><li><code>--keep-alive</code> — não encerra o sandbox após a execução. Seu id é exibido.</li> <li><code>--sandbox-id <id></code> — reconecta a um sandbox mantido ativo em vez de criar um novo.</li> <li><code>--idle-timeout <duration></code> — desligamento automático após esse período de inatividade (padrão <code>10m</code>). Aplicado apenas na criação de um novo sandbox e ignorado ao reconectar via <code>--sandbox-id</code>.</li></ul> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!----><span class="hljs-comment"># First run keeps the sandbox alive and prints sandbox_id=<id>.</span> | |
| diffusers-cli run -m black-forest-labs/FLUX.1-dev --dtype bf16 \ | |
| --pipeline-kwargs <span class="hljs-string">'{"prompt": "a cat"}'</span> --remote --flavor a100-large --keep-alive | |
| <span class="hljs-comment"># Reconnect for the next run — the model is already cached, so only inference runs.</span> | |
| diffusers-cli run -m black-forest-labs/FLUX.1-dev --dtype bf16 \ | |
| --pipeline-kwargs <span class="hljs-string">'{"prompt": "a dog"}'</span> --remote --flavor a100-large --sandbox-id <<span class="hljs-built_in">id</span>> | |
| <span class="hljs-comment"># Stop it when done (or let it timeout).</span> | |
| hf sandbox <span class="hljs-built_in">kill</span> <<span class="hljs-built_in">id</span>><!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="customblocks" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#customblocks"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->custom_blocks<!----></span></h2><!--]--><!----> <p>Empacota uma subclasse local de <code>ModularPipelineBlocks</code> para upload no Hub. Lê um arquivo Python, faz um scan via AST em busca de classes derivadas de <code>ModularPipelineBlocks</code> ou de uma de suas subclasses compostas (<code>SequentialPipelineBlocks</code>, <code>AutoPipelineBlocks</code>, <code>ConditionalPipelineBlocks</code>, <code>LoopSequentialPipelineBlocks</code>), instancia a escolhida e | |
| chama <code>save_pretrained</code> no diretório de trabalho atual.</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!----><span class="hljs-comment"># Package the first block found in ./block.py</span> | |
| diffusers-cli custom_blocks | |
| <span class="hljs-comment"># Point at a different file / pick a specific class</span> | |
| diffusers-cli custom_blocks --block_module_name my_block.py --block_class_name MyDenoiseBlock<!----></pre></div><!----> <p>A classe de bloco deve ser instanciável com zero argumentos de construtor e define padrões fixos em <code>__init__</code> ou lê a configuração do estado do pipeline <code>state</code> no momento da chamada.</p> <!--[1--><h2 class="relative group"><a id="fp16safetensors" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#fp16safetensors"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->fp16_safetensors<!----></span></h2><!--]--><!----> <blockquote class="caution"><p>Este comando agora está obsoleto e será removido em uma versão futura.</p></blockquote> <p>Converta um checkpoint no Hub para <code>.safetensors</code> em fp16 e envie o resultado. Útil para reduzir o tamanho dos pesos de um repositório para um carregamento mais rápido. Consulte <code>diffusers-cli fp16_safetensors --help</code> para os argumentos exatos.</p> <!--[1--><h2 class="relative group"><a id="skills" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#skills"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->habilidades<!----></span></h2><!--]--><!----> <p>Instale habilidades do repositório diffusers (<a href="https://github.com/huggingface/diffusers/tree/main/.ai/skills" rel="nofollow"><code>.ai/skills/</code></a>).</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Copiado</div><!----></button><!----></div> <pre class="language-bash "><!----><span class="hljs-comment"># Install a single skill</span> | |
| diffusers-cli skills add <span class="hljs-string">"<skill name>"</span> | |
| <span class="hljs-comment"># Install every skill in the registry</span> | |
| diffusers-cli skills add --all | |
| <span class="hljs-comment"># List available skills with a one-line summary of each</span> | |
| diffusers-cli skills list | |
| <span class="hljs-comment"># Preview a skill's SKILL.md without installing</span> | |
| diffusers-cli skills preview diffusers-cli | |
| <span class="hljs-comment"># Refetch and reinstall every managed skill</span> | |
| diffusers-cli skills update | |
| <span class="hljs-comment"># Install to the user-level directory instead of the current project</span> | |
| diffusers-cli skills add diffusers-cli --global | |
| <span class="hljs-comment"># Install for one agent instead of detecting it from the environment</span> | |
| diffusers-cli skills add --all --claude <span class="hljs-comment"># or --codex / --cursor</span><!----></pre></div><!----> <p>Sem a flag de destino, o CLI instala para o agente que o lançou, ou para todos os agentes quando não consegue identificá-lo. O Claude Code recebe um pacote de plugins em <code>.claude/skills/diffusers/</code> (com namespace <code>/diffusers:<skill name></code>). O Codex e o Cursor recebem <code>.agents/skills/<skill name>/</code>.</p> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/cli.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]--> | |
| <script> | |
| { | |
| __sveltekit_1qsdbwf = { | |
| base: "/docs/diffusers/main/en", | |
| assets: "/docs/diffusers/main/en" | |
| }; | |
| const element = document.currentScript.parentElement; | |
| Promise.all([ | |
| import("/docs/diffusers/main/en/_app/immutable/entry/start.0S0_iEoG.js"), | |
| import("/docs/diffusers/main/en/_app/immutable/entry/app.CPdOxCbw.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 388], | |
| data: [null,null], | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 61.8 kB
- Xet hash:
- 9bd83bd9258cbe8da1836bcc835b3eefdfde1a07a0d9992477bc85d5ba8a5f2c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.