Buckets:

mishig's picture
download
raw
98 kB
<meta charset="utf-8" /><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;FLUX 3 Image Klein&quot;,&quot;local&quot;:&quot;flux-3-image-klein&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Prompt örnekleme&quot;,&quot;local&quot;:&quot;prompt-upsampling&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Görselden görseli&quot;,&quot;local&quot;:&quot;image-to-image&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Düzen kontrolü&quot;,&quot;local&quot;:&quot;layout-control&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Yönlendirme ölçeği&quot;,&quot;local&quot;:&quot;guidance-scale&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Adım-distilled model&quot;,&quot;local&quot;:&quot;step-distilled-model&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Tekrarlanabilir üretim&quot;,&quot;local&quot;:&quot;reproducible-generation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;İş Akışları&quot;,&quot;local&quot;:&quot;workflows&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Adım başına geri çağrılar&quot;,&quot;local&quot;:&quot;per-step-callbacks&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Bellek&quot;,&quot;local&quot;:&quot;memory&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Tek dosya yükleme&quot;,&quot;local&quot;:&quot;single-file-loading&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Flux3ModularPipeline&quot;,&quot;local&quot;:&quot;diffusers.Flux3ModularPipeline&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Flux3AutoBlocks&quot;,&quot;local&quot;:&quot;diffusers.Flux3AutoBlocks&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Flux3DistilledAutoBlocks&quot;,&quot;local&quot;:&quot;diffusers.Flux3DistilledAutoBlocks&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Flux3DistilledModularPipeline&quot;,&quot;local&quot;:&quot;diffusers.Flux3DistilledModularPipeline&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/>
<link href="/docs/diffusers/main/en/_app/immutable/entry/start.vZc-dOUR.js" rel="modulepreload">
<link href="/docs/diffusers/main/en/_app/immutable/chunks/Bafuik5c.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.B6c3Ml05.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.BQlx092V.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/180.Dy0d8VKm.js" rel="modulepreload">
<link href="/docs/diffusers/main/en/_app/immutable/chunks/B4AMoTAu.js" rel="modulepreload">
<!--hchutw--><meta name="hf:doc:metadata" content="{&quot;title&quot;:&quot;FLUX 3 Image Klein&quot;,&quot;local&quot;:&quot;flux-3-image-klein&quot;,&quot;sections&quot;:[{&quot;title&quot;:&quot;Prompt upsampling&quot;,&quot;local&quot;:&quot;prompt-upsampling&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Image-to-image&quot;,&quot;local&quot;:&quot;image-to-image&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Layout control&quot;,&quot;local&quot;:&quot;layout-control&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Guidance scale&quot;,&quot;local&quot;:&quot;guidance-scale&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Step-distilled model&quot;,&quot;local&quot;:&quot;step-distilled-model&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Reproducible generation&quot;,&quot;local&quot;:&quot;reproducible-generation&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Workflows&quot;,&quot;local&quot;:&quot;workflows&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Per-step callbacks&quot;,&quot;local&quot;:&quot;per-step-callbacks&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Memory&quot;,&quot;local&quot;:&quot;memory&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Single-file loading&quot;,&quot;local&quot;:&quot;single-file-loading&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Flux3ModularPipeline&quot;,&quot;local&quot;:&quot;diffusers.Flux3ModularPipeline&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Flux3AutoBlocks&quot;,&quot;local&quot;:&quot;diffusers.Flux3AutoBlocks&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Flux3DistilledAutoBlocks&quot;,&quot;local&quot;:&quot;diffusers.Flux3DistilledAutoBlocks&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2},{&quot;title&quot;:&quot;Flux3DistilledModularPipeline&quot;,&quot;local&quot;:&quot;diffusers.Flux3DistilledModularPipeline&quot;,&quot;sections&quot;:[],&quot;depth&quot;:2}],&quot;depth&quot;:1}"/><!---->
<link href="/docs/diffusers/main/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <!--[0--><h1 class="relative group"><a id="flux-3-image-klein" 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="#flux-3-image-klein"><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><!---->FLUX 3 Image Klein<!----></span></h1><!--]--><!----> <p>FLUX 3 Image Klein, Black Forest Labs tarafından geliştirilen 5,6B parametreli bir görüntü üretim modelidir: tek bir transformer (<a href="/docs/diffusers/main/tr/api/models/flux3_transformer#diffusers.Flux3Transformer2DModel">Flux3Transformer2DModel</a>), bir metin komutundan, yalnızca kendisi veya bir veya daha fazla referans görüntüyle birlikte görüntüler üretir. Metin koşullandırması Qwen3-VL'den gelir ve görüntüler FLUX.2 paketlenmiş otoenkoderını (<code>AutoencoderKLFlux2</code>) kullanır.</p> <p>FLUX 3 Image Klein, <a href="../../modular_diffusers/overview">modüler bir pipeline</a> olarak sunulur. Metinden görüntüye üretimle başlayın:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ModularPipeline
pipe = ModularPipeline.from_pretrained(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>)
pipe.load_components(dtype={<span class="hljs-string">&quot;vae&quot;</span>: torch.float32, <span class="hljs-string">&quot;default&quot;</span>: torch.bfloat16})
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
image = pipe(
prompt=<span class="hljs-string">&quot;A red fox in a snow-covered forest clearing at golden hour&quot;</span>,
generator=torch.Generator().manual_seed(<span class="hljs-number">0</span>),
output=<span class="hljs-string">&quot;images&quot;</span>,
)[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;fox.png&quot;</span>)<!----></pre></div><!----> <p><code>prompt</code> tek zorunlu girdidir: pipeline, önerilen örneklem ayarlarını (50 adım, yönlendirme ölçeği 3.5, zamanlayıcı kayması 6.93) taşır ve varsayılan olarak 1024 x 1024 boyutunda görüntüler üretir. Her çağrıda bir prompt alır; aynı prompt için birden fazla görüntü üretmek için <code>num_images_per_prompt</code> parametresini kullanın.</p> <p>Yukarıdaki örnekte de görebileceğiniz gibi, yükleme ve çalıştırma <code>DiffusionPipeline</code>'den biraz farklıdır. Yükleme tembel (lazy)dir: <a href="/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline.from_pretrained">from_pretrained()</a> yalnızca hattı (pipeline) oluşturur ve ağırlıkları yüklemek için <a href="/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline.load_components">load_components()</a> çağrısını yaparsınız. Bir çağrı hattın durumunu döndürür ve ihtiyacınız olanı <code>output</code> ile istersiniz: burada <code>output="images"</code> veya prompt upsampler'ın yazdığı başlığı da almak için <code>output=["images", "prompt"]</code>.</p> <blockquote class="tip"><p>If you’re working with <code>ModularPipeline</code> for the first time, read the <a href="../../modular_diffusers/quickstart">quickstart</a>, and <a href="../../modular_diffusers/coming_from_diffusion_pipeline">Coming from DiffusionPipeline</a> if you know the standard pipelines. Besides loading and outputs, a few other things differ: <a href="#guidance-scale">guidance</a>, <a href="#per-step-callbacks">callbacks</a> and <a href="#memory">offloading</a>.</p></blockquote> <!--[1--><h2 class="relative group"><a id="prompt-upsampling" 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="#prompt-upsampling"><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><!---->Prompt örnekleme<!----></span></h2><!--]--><!----> <p>Prompting önemlidir: FLUX 3 Image Klein, kısa promptlar yerine konuyu, kompozisyonu, aydınlatmayı ve atmosferi açıklayan tam sahne betimlemeleri alır; olduğu gibi gönderilen bir istek genel bir çıktı verir. Bu nedenle pipeline, her istekte, metinden görüntüye ve düzenleme olsun, önce prompt upsampler'ı çalıştırır. Black Forest Labs'e ait ayrı bir 9B modeldir (<a href="https://huggingface.co/black-forest-labs/flux-3-image-klein-pup" rel="nofollow">black-forest-labs/flux-3-image-klein-pup</a>) ve metin kodlayıcıdan önce <code>prompt</code>'u böyle bir betimlemeye genişletir; bunun için kısa bir prompt yeterlidir.</p> <p>Prompt upsampler, kısa bir isteği (düzenleme sırasında referans görsellerle birlikte) modelin kullandığı tam sahne açıklamasına dönüştürür: orta ve stil, sahne, aydınlatma ve kamera, her bir konunun renkleri, malzemeleri ve karedeki konumu. Tek bir model, metinden görsel oluşturma, referans görsellerle düzenleme ve kutularla yerleşim düzenini kapsar. Yazdığı açıklama, <code>prompt</code> çıktısı olarak geri döner. Yukarıdaki örnekte, görsel modelinin ne aldığını görmek için görsellerle birlikte isten:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->out = pipe(
prompt=<span class="hljs-string">&quot;A red fox in a snow-covered forest clearing at golden hour&quot;</span>,
generator=torch.Generator().manual_seed(<span class="hljs-number">0</span>),
output=[<span class="hljs-string">&quot;images&quot;</span>, <span class="hljs-string">&quot;prompt&quot;</span>],
)
<span class="hljs-built_in">print</span>(out[<span class="hljs-string">&quot;prompt&quot;</span>])<!----></pre></div><!----> <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> Kopyalandı</div><!----></button><!----></div> <pre class=" "><!---->Full-color outdoor wildlife photograph taken <span class="hljs-built_in">from</span> <span class="hljs-keyword">a</span> low eye-level perspective <span class="hljs-keyword">in</span> <span class="hljs-keyword">a</span> snow-covered forest clearing <span class="hljs-keyword">at</span> golden hour. In <span class="hljs-keyword">the</span> center foreground, <span class="hljs-keyword">a</span> red fox stands <span class="hljs-keyword">in</span> profile facing left, its body turned toward <span class="hljs-keyword">the</span> viewer <span class="hljs-keyword">and</span> its head raised <span class="hljs-keyword">as</span> <span class="hljs-keyword">it</span> looks across <span class="hljs-keyword">the</span> clearing. The fox has dense rust-red winter fur, <span class="hljs-keyword">a</span> white throat <span class="hljs-keyword">and</span> chest, <span class="hljs-keyword">black</span> <span class="hljs-built_in">lower</span> legs, pointed ears <span class="hljs-keyword">with</span> dark tips, <span class="hljs-keyword">and</span> <span class="hljs-keyword">a</span> <span class="hljs-keyword">long</span> bushy tail ending <span class="hljs-keyword">in</span> white. ...<!----></pre></div><!----> <p>Tam açıklama yaklaşık 240 kelime uzunluğundadır; <code>max_new_tokens</code> uzunluğunu sınırlar (varsayılan olarak 3584).</p> <p>Adımın <code>doc</code> değerini yazdırarak ne aldığını ve ne yazdığını görebilirsiniz:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-built_in">print</span>(pipe.blocks.sub_blocks[<span class="hljs-string">&quot;prompt_upsampler&quot;</span>].doc)<!----></pre></div><!----> <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> Kopyalandı</div><!----></button><!----></div> <pre class=" "><!----> <span class="hljs-symbol">Inputs</span>:
prompt (<span class="hljs-string">`str`</span>):
<span class="hljs-symbol">The</span> edit instruction to expand into the full caption (one per call).
image (<span class="hljs-string">`Image | list`</span>, *optional*):
<span class="hljs-symbol">The</span> reference image(s) of the edit, at most <span class="hljs-number">10</span>; the same ones the pipeline receives.
boxes (<span class="hljs-string">`list`</span>, *optional*):
<span class="hljs-symbol">Layout</span> boxes, each {<span class="hljs-string">&#x27;id&#x27;</span>, <span class="hljs-string">&#x27;desc&#x27;</span>, <span class="hljs-string">&#x27;from&#x27;</span>, <span class="hljs-string">&#x27;src_bbox&#x27;</span>, <span class="hljs-string">&#x27;tgt_bbox&#x27;</span>} with the boxes as [y_min, x_min, y_max, x_max] in
<span class="hljs-number">0</span><span class="hljs-number">-1</span>: ...
max_new_tokens (<span class="hljs-string">`int`</span>, *optional*, defaults to <span class="hljs-number">3584</span>):
<span class="hljs-symbol">The</span> most tokens the upsampler may generate for the caption.
<span class="hljs-symbol">Outputs</span>:
prompt (<span class="hljs-string">`str`</span>):
<span class="hljs-symbol">The</span> full caption, replacing the request.<!----></pre></div><!----> <p>Hattın diğer blokları gibi <code>prompt_upsampler</code> bloğu da kendi başına çalışır. Önerilen yöntem, bloklardan çıkarılmasıdır: çıkarılan blok bağımsız bir upsampler olur, kalan bloklar ise genişletilmiş başlığı <code>prompt</code> olarak alan bir hat oluşturur:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->blocks = ModularPipeline.from_pretrained(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>).blocks
pup_block = blocks.sub_blocks.pop(<span class="hljs-string">&quot;prompt_upsampler&quot;</span>)
pup = pup_block.init_pipeline(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>)
pup.load_components(dtype=torch.bfloat16)
pup.to(<span class="hljs-string">&quot;cuda&quot;</span>)
caption = pup(prompt=<span class="hljs-string">&quot;A red fox in a snow-covered forest clearing at golden hour&quot;</span>, output=<span class="hljs-string">&quot;prompt&quot;</span>)
pipe = blocks.init_pipeline(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>)
pipe.load_components(dtype={<span class="hljs-string">&quot;vae&quot;</span>: torch.float32, <span class="hljs-string">&quot;default&quot;</span>: torch.bfloat16})
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
image = pipe(prompt=caption, generator=torch.Generator().manual_seed(<span class="hljs-number">0</span>), output=<span class="hljs-string">&quot;images&quot;</span>)[<span class="hljs-number">0</span>]<!----></pre></div><!----> <p>Bu sayede ayrı bir aşama olarak, kendi GPU’sunda veya kendi endpoint’i arkasında sunulabilir ve bir arayüz, yazdığı başlığı gösterebilir ve üretmeden önce kullanıcının düzenlemesine izin verebilir. Upsampler’ın yerini aynı sistem istemleriyle herhangi bir başka LLM alabilir: upsampler deposundan <code>system_prompts["t2i"]</code>’yi (veya referanslar kullanıcı mesajında önce gelecek şekilde <code>"i2i"</code>) sistem istemi olarak ve isteği kullanıcı mesajı olarak verin, ardından döndürdüğü başlığı <code>pipe</code>’e <code>prompt</code> olarak iletin.</p> <!--[1--><h2 class="relative group"><a id="image-to-image" 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="#image-to-image"><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><!---->Görselden görseli<!----></span></h2><!--]--><!----> <p><code>image</code> ile bir veya daha fazla referans görüntü geçin. Tek bir referans bütünüyle korunur: yalnızca 4 megapikselin üzerinde olduğunda küçültülür, 16 piksel ızgarasına tamamlanır ve üretim varsayılan olarak bu boyutu kullanır; bu nedenle düzenleme, girdinin boyutunda geri döner. Birden fazla referansın her biri 1 megapikselin altına sığdırılır ve ızgaraya kırpılır; üretim varsayılan olarak ilkinin boyutunu kullanır. Belirtilen <code>height</code>/<code>width</code> değeri varsayılanı geçersiz kılar. <em>Hedef</em> görüntüyü, tek satırlık bir talimat yerine, düzenlemenizi referansın tam bir açıklamasına entegre ederek tanımlayın ya da <a href="#prompt-upsampling">prompt upsampler</a>'ın bunu talimattan ve referanslardan yazmasına izin verin:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->night = pipe(
prompt=<span class="hljs-string">&quot;the same scene at night under a full moon&quot;</span>,
image=image,
generator=torch.Generator().manual_seed(<span class="hljs-number">0</span>),
output=[<span class="hljs-string">&quot;images&quot;</span>, <span class="hljs-string">&quot;prompt&quot;</span>],
)<!----></pre></div><!----> <p>Birden fazla referans varsa, bunlara <code>image</code> parametresine geçiş sırasına göre ilk görsel, ikinci görsel, … şeklinde atıfta bulunulur; görsel modeli için başlık bunları <code>&lt;ref_image_0></code>, <code>&lt;ref_image_1></code>, … olarak adlandırır:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->combined = pipe(
prompt=<span class="hljs-string">&quot;the fox from the first image sitting on the wooden bench from the second image&quot;</span>,
image=[image, bench],
height=<span class="hljs-number">768</span>,
width=<span class="hljs-number">1360</span>,
output=<span class="hljs-string">&quot;images&quot;</span>,
)[<span class="hljs-number">0</span>]<!----></pre></div><!----> <p>Türetilen boyutu geçersiz kılmak için <code>height</code> ve/veya <code>width</code> parametrelerini iletin.</p> <!--[1--><h2 class="relative group"><a id="layout-control" 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="#layout-control"><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><!---->Düzen kontrolü<!----></span></h2><!--]--><!----> <p>İçeriği açıkça konumlandırmak için <code>boxes</code> parametresini iletin: her öğe için bir <code>id</code>, kısa bir <code>desc</code> ve 0-1 aralığında (orijin sol üst köşe) <code>[y_min, x_min, y_max, x_max]</code> biçiminde bir <code>bbox</code> verin; böylece çıktı boyutundan bağımsız olur. Upsampler, başlığı bu öğelerin etrafına yazar, her öğeyi <code>&lt;id></code> olarak atıf gösterir ve kutuların tablosunu ekler; sizinkiler aynen korunur:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->boxes = [
{<span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-string">&quot;balloon_1&quot;</span>, <span class="hljs-string">&quot;desc&quot;</span>: <span class="hljs-string">&quot;a red and yellow striped hot-air balloon&quot;</span>, <span class="hljs-string">&quot;bbox&quot;</span>: [<span class="hljs-number">0.08</span>, <span class="hljs-number">0.06</span>, <span class="hljs-number">0.48</span>, <span class="hljs-number">0.38</span>]},
{<span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-string">&quot;balloon_2&quot;</span>, <span class="hljs-string">&quot;desc&quot;</span>: <span class="hljs-string">&quot;a small blue hot-air balloon&quot;</span>, <span class="hljs-string">&quot;bbox&quot;</span>: [<span class="hljs-number">0.20</span>, <span class="hljs-number">0.62</span>, <span class="hljs-number">0.42</span>, <span class="hljs-number">0.80</span>]},
]
out = pipe(prompt=<span class="hljs-string">&quot;hot-air balloons over a green valley at sunrise&quot;</span>, boxes=boxes, output=[<span class="hljs-string">&quot;images&quot;</span>, <span class="hljs-string">&quot;prompt&quot;</span>])<!----></pre></div><!----> <p>Düzenleme sırasında bir kutu, kaynağını <code>from</code> ile adlandırır: <code>tgt_bbox</code> içeren <code>"target"</code>, oraya yeni bir öğe ekler; <code>src_bbox</code> ve <code>tgt_bbox</code> içeren <code>"ref_image_0"</code>, o referansın bir öğesini taşır (eşit kutular öğeyi yerinde tutar):</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->boxes = [{<span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-string">&quot;cactus&quot;</span>, <span class="hljs-string">&quot;desc&quot;</span>: <span class="hljs-string">&quot;a small potted cactus&quot;</span>, <span class="hljs-string">&quot;from&quot;</span>: <span class="hljs-string">&quot;target&quot;</span>, <span class="hljs-string">&quot;src_bbox&quot;</span>: <span class="hljs-literal">None</span>, <span class="hljs-string">&quot;tgt_bbox&quot;</span>: [<span class="hljs-number">0.55</span>, <span class="hljs-number">0.62</span>, <span class="hljs-number">0.85</span>, <span class="hljs-number">0.85</span>]}]
out = pipe(prompt=<span class="hljs-string">&quot;add a small potted cactus in the marked spot&quot;</span>, image=mug, boxes=boxes, output=[<span class="hljs-string">&quot;images&quot;</span>, <span class="hljs-string">&quot;prompt&quot;</span>])
boxes = [{<span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-string">&quot;knight&quot;</span>, <span class="hljs-string">&quot;desc&quot;</span>: <span class="hljs-string">&quot;the knight figure&quot;</span>, <span class="hljs-string">&quot;from&quot;</span>: <span class="hljs-string">&quot;ref_image_0&quot;</span>, <span class="hljs-string">&quot;src_bbox&quot;</span>: [<span class="hljs-number">0.50</span>, <span class="hljs-number">0.15</span>, <span class="hljs-number">0.85</span>, <span class="hljs-number">0.35</span>], <span class="hljs-string">&quot;tgt_bbox&quot;</span>: [<span class="hljs-number">0.19</span>, <span class="hljs-number">0.06</span>, <span class="hljs-number">0.54</span>, <span class="hljs-number">0.26</span>]}]
out = pipe(prompt=<span class="hljs-string">&quot;move the knight up and to the left, keep the rest unchanged&quot;</span>, image=knight, boxes=boxes, output=[<span class="hljs-string">&quot;images&quot;</span>, <span class="hljs-string">&quot;prompt&quot;</span>])<!----></pre></div><!----> <p>Görsel modelin okuduğu başlık, metindeki <code>&lt;id></code> etiketli öğeleri ve 0-1000 tuvalinde kutularla JSON olarak eklenen tabloyu içerir; görmek için <code>prompt</code> çıktısını yazdırın. Bu formda elle yazılan bir başlık, <a href="#prompt-upsampling">Prompt upsampling</a> örneğinde olduğu gibi, bu adım olmadan doğrudan pipeline'a gönderilir.</p> <!--[1--><h2 class="relative group"><a id="guidance-scale" 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="#guidance-scale"><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><!---->Yönlendirme ölçeği<!----></span></h2><!--]--><!----> <p>Pipeline, <code>guider</code> bileşeni aracılığıyla classifier-free guidance uygular ve çağrı sırasında <code>guidance_scale</code> argümanı almaz. Varsayılan guider, her iki iş akışı için önerilen ayar olan <code>guidance_scale=3.5</code> değerine sahip <a href="/docs/diffusers/main/tr/api/modular_diffusers/guiders#diffusers.ClassifierFreeGuidance">ClassifierFreeGuidance</a>'dir. Değiştirmek için guider'ın güncellenmiş bir kopyasını oluşturun:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->pipe.guider = pipe.guider.new(guidance_scale=<span class="hljs-number">5.0</span>)<!----></pre></div><!----> <p>Farklı bir yönlendirme yöntemine geçmek için <a href="../../using-diffusers/guiders">yönlendiriciler kılavuzuna</a> bakın.</p> <!--[1--><h2 class="relative group"><a id="step-distilled-model" 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="#step-distilled-model"><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><!---->Adım-distilled model<!----></span></h2><!--]--><!----> <p>Step-distilled checkpoint, classifier-free guidance olmadan 16 adımda üretim yapar. Transformer'ı bir akış haritasıdır: her adımda hem mevcut timestep hem de adımın atlayacağı timestep kendisine bildirilir. Temel model gibi yüklenir (deponun <code>modular_model_index.json</code> dosyası <a href="/docs/diffusers/main/tr/api/pipelines/flux3#diffusers.Flux3DistilledModularPipeline">Flux3DistilledModularPipeline</a> ve <a href="/docs/diffusers/main/tr/api/pipelines/flux3#diffusers.Flux3DistilledAutoBlocks">Flux3DistilledAutoBlocks</a> olarak çözümlenir); pipeline'da <code>guider</code> yoktur ve <code>negative_prompt</code> parametresini kabul etmez:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->pipe = ModularPipeline.from_pretrained(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein&quot;</span>)
pipe.load_components(dtype=torch.bfloat16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
image = pipe(prompt=prompt, generator=torch.Generator().manual_seed(<span class="hljs-number">0</span>), output=<span class="hljs-string">&quot;images&quot;</span>)[<span class="hljs-number">0</span>]<!----></pre></div><!----> <p>Temel modelle aynı iki iş akışını sunar. <code>num_inference_steps</code> varsayılan olarak 16'dır; model 4 ila 16 adım için eğitilmiştir.</p> <!--[1--><h2 class="relative group"><a id="reproducible-generation" 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="#reproducible-generation"><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><!---->Tekrarlanabilir üretim<!----></span></h2><!--]--><!----> <p><code>generator</code>, hattın çektiği gürültüyü sabitler (bkz. <a href="../../using-diffusers/reusing_seeds">Tekrarlanabilirlik</a>). Başka bir yerde çekilen gürültüyü yeniden kullanmak için, <code>(batch_size, 128, height // 16, width // 16)</code> biçiminde <code>latents</code> olarak iletin. Örneğin, <a href="https://github.com/black-forest-labs/flux-3" rel="nofollow">BFL uygulaması</a> gürültüsünü CPU üzerinde görüntü jetonları olarak çeker ve bf16'ya dönüştürür; bu, belirli bir tohum için örneğini yeniden üretir:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->height, width = <span class="hljs-number">1024</span>, <span class="hljs-number">1024</span>
h, w = height // <span class="hljs-number">16</span>, width // <span class="hljs-number">16</span>
noise = torch.randn((h * w, <span class="hljs-number">128</span>), generator=torch.Generator().manual_seed(<span class="hljs-number">0</span>)).to(torch.bfloat16)
latents = noise.T.reshape(<span class="hljs-number">1</span>, <span class="hljs-number">128</span>, h, w)
image = pipe(prompt=prompt, latents=latents, height=height, width=width, output=<span class="hljs-string">&quot;images&quot;</span>)[<span class="hljs-number">0</span>]<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="workflows" 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="#workflows"><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><!---->İş Akışları<!----></span></h2><!--]--><!----> <p>Pipeline iki iş akışına hizmet eder: <code>text2image</code> ve <code>image_conditioned</code>; çalıştırılacak olanı girdiler belirler (<code>image</code>, image-to-image iş akışını seçer). <a href="/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline.from_pretrained">from_pretrained()</a>, <code>workflow</code> argümanı ile tek bir iş akışı için de pipeline oluşturabilir; bu durumda yalnızca ilgili iş akışının gerektirdiği bileşenler beklenir ve yüklenir:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> Flux3AutoBlocks
<span class="hljs-built_in">print</span>(Flux3AutoBlocks().available_workflows)
<span class="hljs-comment"># [&quot;text2image&quot;, &quot;image_conditioned&quot;]</span>
t2i = ModularPipeline.from_pretrained(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>, workflow=<span class="hljs-string">&quot;text2image&quot;</span>)
<span class="hljs-built_in">print</span>(t2i.blocks.doc)<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="per-step-callbacks" 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="#per-step-callbacks"><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><!---->Adım başına geri çağrılar<!----></span></h2><!--]--><!----> <p>Mevcut bir geri çağırma işlevini kullanmak için, gürültü azaltma döngüsüne bir blok ekleyin. <a href="../../using-diffusers/callback#modular-pipelines">geri çağırma kılavuzu</a>, <code>CallbackOnStepEnd</code> bloğu ve <code>walk_denoise_loops</code> yardımcısıyla basit bir örnek içerir:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->blocks = Flux3AutoBlocks() <span class="hljs-comment"># or Flux3DistilledAutoBlocks</span>
<span class="hljs-keyword">for</span> loop <span class="hljs-keyword">in</span> walk_denoise_loops(blocks):
loop.sub_blocks[<span class="hljs-string">&quot;callback&quot;</span>] = CallbackOnStepEnd()
pipe = blocks.init_pipeline(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>)
image = pipe(prompt=caption, callback_on_step_end=my_callback, output=<span class="hljs-string">&quot;images&quot;</span>)[<span class="hljs-number">0</span>]<!----></pre></div><!----> <p>Erken durdurmak için geri çağrıdan (callback) raise kullanın; <code>interrupt</code> bayrağı yoktur.</p> <!--[1--><h2 class="relative group"><a id="memory" 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="#memory"><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><!---->Bellek<!----></span></h2><!--]--><!----> <p>bf16'da her şeyin yüklenmesi yaklaşık 39 GB ağırlık gerektirir: transformer 5,5B parametreye, Qwen3-VL-4B metin kodlayıcısı 4B'ye ve <a href="#prompt-upsampling">prompt upsampler</a> 9B'ye (tek başına yaklaşık 19 GB) sahipken, görüntü VAE'si fp32'dedir. Upsampler adımı olmadan oluşturulan bir pipeline (oraya bakın) yaklaşık 20 GB yükler. Daha az belleğe sahip GPU'lar için bileşen offloading'i etkinleştirin; yönetici, her adımın ihtiyaç duyduğu bileşenleri (upsampler dahil) CPU ile GPU arasında taşır:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ComponentsManager, ModularPipeline
manager = ComponentsManager()
pipe = ModularPipeline.from_pretrained(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>, components_manager=manager)
pipe.load_components(dtype={<span class="hljs-string">&quot;vae&quot;</span>: torch.float32, <span class="hljs-string">&quot;default&quot;</span>: torch.bfloat16})
manager.enable_auto_cpu_offload(device=<span class="hljs-string">&quot;cuda&quot;</span>)<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="single-file-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="#single-file-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><!---->Tek dosya yükleme<!----></span></h2><!--]--><!----> <p><a href="/docs/diffusers/main/tr/api/models/flux3_transformer#diffusers.Flux3Transformer2DModel">Flux3Transformer2DModel</a>, transformer'ı doğrudan bir Black Forest Labs model paketinden <a href="/docs/diffusers/main/tr/api/loaders/single_file#diffusers.loaders.FromOriginalModelMixin.from_single_file">from_single_file()</a> ile yükler. Paketin <code>config.json</code> dosyası okunmaz; diffusers yapılandırmasını <code>config</code> ve <code>subfolder</code> ile iletin.</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Flux3Transformer2DModel, ModularPipeline
transformer = Flux3Transformer2DModel.from_single_file(
<span class="hljs-string">&quot;https://huggingface.co/black-forest-labs/flux-3-image-klein-base/blob/main/model.safetensors&quot;</span>,
config=<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>,
subfolder=<span class="hljs-string">&quot;transformer&quot;</span>,
dtype=torch.bfloat16,
)
pipe = ModularPipeline.from_pretrained(<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>)
pipe.load_components(dtype={<span class="hljs-string">&quot;vae&quot;</span>: torch.float32, <span class="hljs-string">&quot;default&quot;</span>: torch.bfloat16})
pipe.update_components(transformer=transformer)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)<!----></pre></div><!----> <p>Önce diğer bileşenleri adlarıyla yükleyin: <code>names</code> parametresi olmadan <a href="/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline.load_components">load_components()</a> çağrısı, pipeline deposundan dönüştürücüyü de yükleyecektir.</p> <p>FP8r ve NVFP4 tek dosyalık checkpoint'lerin yüklenmesi de desteklenir. İkisi de <a href="/docs/diffusers/main/tr/api/quantization#diffusers.BFLQuantizationConfig">BFLQuantizationConfig</a> ile aynı çağrı üzerinden yüklenir. Her şema için çekirdek gereksinimlerini görmek için <a href="../../quantization/bfl">BFL kuantizasyon kılavuzu</a>'na bakın.</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> BFLQuantizationConfig
transformer = Flux3Transformer2DModel.from_single_file(
<span class="hljs-string">&quot;https://huggingface.co/black-forest-labs/flux-3-image-klein-base/blob/main/variants/nvfp4/model.safetensors&quot;</span>,
config=<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein-base&quot;</span>,
subfolder=<span class="hljs-string">&quot;transformer&quot;</span>,
quantization_config=BFLQuantizationConfig(compute_dtype=torch.bfloat16),
dtype=torch.bfloat16,
)<!----></pre></div><!----> <p>Adım damıtılmış denetim noktalarını yüklerken yapılandırmalarına (<code>flow_map=True</code>) ihtiyaç duyarız:</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> Kopyalandı</div><!----></button><!----></div> <pre class="language-python "><!---->transformer = Flux3Transformer2DModel.from_single_file(
<span class="hljs-string">&quot;https://huggingface.co/black-forest-labs/flux-3-image-klein/blob/main/variants/nvfp4/model.safetensors&quot;</span>,
config=<span class="hljs-string">&quot;black-forest-labs/flux-3-image-klein&quot;</span>,
subfolder=<span class="hljs-string">&quot;transformer&quot;</span>,
quantization_config=BFLQuantizationConfig(compute_dtype=torch.bfloat16),
dtype=torch.bfloat16,
)<!----></pre></div><!----> <!--[1--><h2 class="relative group"><a id="diffusers.Flux3ModularPipeline" 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="#diffusers.Flux3ModularPipeline"><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><!---->Flux3ModularPipeline<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.Flux3ModularPipeline"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">sınıf</span> <span class="font-medium">diffusers.</span><span class="font-semibold">Flux3ModularPipeline</span></span></h3><!----> <a id="diffusers.Flux3ModularPipeline" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.Flux3ModularPipeline"><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><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/flux3/modular_pipeline.py#L24" target="_blank"><span>&lt;</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">blocks<span class="opacity-60">: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">pretrained_model_name_or_path<span class="opacity-60">: str | os.PathLike | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">components_manager<span class="opacity-60">: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">collection<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">workflow<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">modular_config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">**kwargs<span class="opacity-60"></span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>FLUX.3 için bir ModularPipeline.</p></div> <!--[1--><h2 class="relative group"><a id="diffusers.Flux3AutoBlocks" 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="#diffusers.Flux3AutoBlocks"><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><!---->Flux3AutoBlocks<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.Flux3AutoBlocks"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">sınıf</span> <span class="font-medium">diffusers.</span><span class="font-semibold">Flux3AutoBlocks</span></span></h3><!----> <a id="diffusers.Flux3AutoBlocks" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.Flux3AutoBlocks"><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><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/flux3/modular_blocks_flux3.py#L339" target="_blank"><span>&lt;</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>FLUX.3 kullanarak metinden görüntüye ve görüntüden görüntüye üretim yapan Auto blokları. <code>prompt</code> önce prompt upsampler'dan geçer; <code>prompt_upsampler</code> adımını kaldırarak verildiği gibi kodlanmasını sağlayın.</p> <p>Desteklenen iş akışları:</p> <ul><li><code>text2image</code>: <code>prompt</code> gerektirir</li> <li><code>image_conditioned</code>: <code>prompt</code> ve <code>image</code> gerektirir</li></ul> <p>Bileşenler:
prompt_upsampler (<code>Qwen3_5ForConditionalGeneration</code>): Prompt upsampler. prompt_upsampler_processor
(<code>AutoProcessor</code>): İşleyicisi. text_encoder (<code>Qwen3VLForConditionalGeneration</code>) tokenizer
(<code>AutoProcessor</code>) image_processor (<code>Flux3ImageProcessor</code>) vae (<code>AutoencoderKLFlux2</code>) transformer
(<code>Flux3Transformer2DModel</code>) scheduler (<code>FlowMatchEulerDiscreteScheduler</code>) guider (<code>ClassifierFreeGuidance</code>)</p> <p>Girdiler:
prompt (<code>str</code>):
Tam altyazıya genişletilecek düzenleme talimatı (her çağrıda bir tane).
image (<code>Image | list</code>, <em>isteğe bağlı</em>):
Düzenlemenin referans görselleri, en fazla 10 adet; hattın (pipeline) aldığı görsellerle aynı olanlar.
boxes (<code>list</code>, <em>isteğe bağlı</em>):
Düzen kutuları, her biri {‘id’, ‘desc’, ‘from’, ‘src_bbox’, ‘tgt_bbox’} biçiminde ve kutular 0-1 aralığında [y_min, x_min, y_max,
x_max] olarak: ‘from’: ‘target’ ve <code>tgt_bbox</code> oraya bir öğe ekler, ‘from’: ‘ref_image_0’, … ve <code>src_bbox</code> ile <code>tgt_bbox</code> bir öğeyi referans görselden taşır.
max_new_tokens (<code>int</code>, <em>isteğe bağlı</em>, varsayılan 3584):
Altyazı için upsampler’ın üretebileceği en fazla token sayısı.
negative_prompt (<code>str</code>, <em>isteğe bağlı</em>):
Üretimi yönlendirmeyecek prompt
max_sequence_length (<code>int</code>, <em>isteğe bağlı</em>, varsayılan 8192):
Prompt tokenlarının maksimum sayısı; daha uzun promptlar kırpılır.
text_encoder_out_layers (<code>tuple</code>, <em>isteğe bağlı</em>, varsayılan (4, 8, 12, 16, 20, 24, 28, 32)):
Durumları yığılarak metin gömme (embedding) oluşturulan metin kodlayıcı gizli katmanlarının indeksleri
num_images_per_prompt (<code>int</code>, <em>isteğe bağlı</em>, varsayılan 1):
Her prompt için üretilecek görsel sayısı.
image_cond_latents (<code>list</code>, <em>isteğe bağlı</em>):
Referans görsellerin normalize edilmiş paketlenmiş latantları, her görsel için (B, C, height_i//16, width_i//16) biçiminde bir tensör
height (<code>int</code>, <em>isteğe bağlı</em>, iş akışına bağlı olarak varsayılan None veya 1024):
Üretilen görselin piksel cinsinden yüksekliği; varsayılan olarak ilk referans görselin kendi yüksekliğidir
width (<code>int</code>, <em>isteğe bağlı</em>, iş akışına bağlı olarak varsayılan None veya 1024):
Üretilen görselin piksel cinsinden genişliği; varsayılan olarak ilk referans görselin kendi genişliğidir
reference_crop (<code>list | NoneType</code>, <em>isteğe bağlı</em>):
Her referans için, referansın dolgulu tuvali içindeki kutusu veya ön işleme adımından gelen None
latents (<code>Tensor</code>):
Görsel üretimi için önceden üretilmiş gürültülü latantlar.
generator (<code>Generator</code>, <em>isteğe bağlı</em>):
Belirlenebilir (deterministik) üretim için Torch üreteci.
num_inference_steps (<code>int</code>):
Gürültü azaltma (denoising) adım sayısı.
timesteps (<code>Tensor</code>):
Gürültü azaltma süreci için zaman adımları. (verildiğinde <code>num_inference_steps</code> değerini geçersiz kılar)
sigmas (<code>list</code>, <em>isteğe bağlı</em>):
Gürültü azaltma süreci için özel sigmalar. (verildiğinde <code>num_inference_steps</code> değerini geçersiz kılar)
*<em>denoiser_input_fields (<code>None</code>,</em>isteğe bağlı<em>):
Gürültü azaltıcı (denoiser) için koşullu model girdileri: örn. prompt_embeds, negative_prompt_embeds vb.
attention_kwargs (<code>dict</code>,</em>isteğe bağlı<em>):
Dikkat (attention) işleyicileri için ek kwargs.
output_type (<code>str</code>,</em>isteğe bağlı*, varsayılan pil):
Çıktı biçimi: ‘pil’, ‘np’, ‘pt’.</p> <p>Çıktılar:
images (<code>list</code>):
Oluşturulan görüntüler.
latents (<code>Tensor</code>):
Gürültüsü azaltılmış latentler.</p></div> <!--[1--><h2 class="relative group"><a id="diffusers.Flux3DistilledAutoBlocks" 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="#diffusers.Flux3DistilledAutoBlocks"><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><!---->Flux3DistilledAutoBlocks<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.Flux3DistilledAutoBlocks"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">sınıf</span> <span class="font-medium">diffusers.</span><span class="font-semibold">Flux3DistilledAutoBlocks</span></span></h3><!----> <a id="diffusers.Flux3DistilledAutoBlocks" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.Flux3DistilledAutoBlocks"><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><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/flux3/modular_blocks_flux3_distilled.py#L258" target="_blank"><span>&lt;</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Adım damıtılmış FLUX.3 modelini (16 adım, sınıflandırıcı-ücretsiz yönlendirme yok) kullanarak metinden görüntüye ve görüntüden görüntüye üretim yapan otomatik bloklar. <code>prompt</code> önce istem yükselticisinden geçer; <code>prompt_upsampler</code> adımını kaldırarak verildiği gibi kodlanmasını sağlayın.</p> <p>Desteklenen iş akışları:</p> <ul><li><code>text2image</code>: <code>prompt</code> gerektirir</li> <li><code>image_conditioned</code>: <code>prompt</code> ve <code>image</code> gerektirir</li></ul> <p>Bileşenler:
prompt_upsampler (<code>Qwen3_5ForConditionalGeneration</code>): Prompt upsampler. prompt_upsampler_processor
(<code>AutoProcessor</code>): İşleyicisi. text_encoder (<code>Qwen3VLForConditionalGeneration</code>) tokenizer
(<code>AutoProcessor</code>) image_processor (<code>Flux3ImageProcessor</code>) vae (<code>AutoencoderKLFlux2</code>) transformer
(<code>Flux3Transformer2DModel</code>) scheduler (<code>FlowMatchEulerDiscreteScheduler</code>)</p> <p>Girdiler:
prompt (<code>str</code>):
Tam altyazıya genişletilecek düzenleme talimatı (her çağrı için bir tane).
image (<code>Image | list</code>, <em>isteğe bağlı</em>):
Düzenlemenin referans görselleri, en fazla 10 adet; hattın (pipeline) aldığı görsellerle aynı olanlar.
boxes (<code>list</code>, <em>isteğe bağlı</em>):
Düzen kutuları, her biri {‘id’, ‘desc’, ‘from’, ‘src_bbox’, ‘tgt_bbox’} biçiminde ve kutular 0-1 aralığında [y_min, x_min, y_max,
x_max] olarak: ‘from’: ‘target’ ve <code>tgt_bbox</code> oraya bir öğe ekler, ‘from’: ‘ref_image_0’, … ve <code>src_bbox</code> ile <code>tgt_bbox</code> bir öğeyi referans görselden taşır.
max_new_tokens (<code>int</code>, <em>isteğe bağlı</em>, varsayılan 3584):
Altyazı için genişleticinin (upsampler) üretebileceği en fazla jeton sayısı.
max_sequence_length (<code>int</code>, <em>isteğe bağlı</em>, varsayılan 8192):
İstem (prompt) jetonlarının maksimum sayısı; daha uzun istemler kısaltılır.
text_encoder_out_layers (<code>tuple</code>, <em>isteğe bağlı</em>, varsayılan (4, 8, 12, 16, 20, 24, 28, 32)):
Durumları yığılarak metin gömme (embedding) oluşturulan metin kodlayıcı gizli katmanlarının indeksleri
num_images_per_prompt (<code>int</code>, <em>isteğe bağlı</em>, varsayılan 1):
İstem başına üretilecek görsel sayısı.
image_cond_latents (<code>list</code>, <em>isteğe bağlı</em>):
Referans görsellerin normalize edilmiş paketlenmiş latantları, her görsel için (B, C, height_i//16, width_i//16)
şeklinde bir tensör
height (<code>int</code>, <em>isteğe bağlı</em>, iş akışına bağlı olarak varsayılan None veya 1024):
Üretilen görselin piksel cinsinden yüksekliği; varsayılan olarak ilk referans görselin kendi yüksekliğidir
width (<code>int</code>, <em>isteğe bağlı</em>, iş akışına bağlı olarak varsayılan None veya 1024):
Üretilen görselin piksel cinsinden genişliği; varsayılan olarak ilk referans görselin kendi genişliğidir
reference_crop (<code>list | NoneType</code>, <em>isteğe bağlı</em>):
Her referans için, dolgulu tuvalin içindeki referansın kutusu veya ön işleme adımından gelen None
latents (<code>Tensor</code>):
Görsel üretimi için önceden oluşturulmuş gürültülü latantlar.
generator (<code>Generator</code>, <em>isteğe bağlı</em>):
Belirlenebilir üretim için Torch üreteci.
num_inference_steps (<code>int</code>):
Gürültü azaltma (denoising) adım sayısı.
timesteps (<code>Tensor</code>):
Gürültü azaltma süreci için zaman adımları. (verildiğinde <code>num_inference_steps</code> değerini geçersiz kılar)
sigmas (<code>list</code>, <em>isteğe bağlı</em>):
Gürültü azaltma süreci için özel sigmalar. (verildiğinde <code>num_inference_steps</code> değerini geçersiz kılar)
*<em>denoiser_input_fields (<code>None</code>,</em>isteğe bağlı<em>):
Gürültü azaltıcı için koşullu model girdileri: örn. prompt_embeds, negative_prompt_embeds vb.
output_type (<code>str</code>,</em>isteğe bağlı*, varsayılan pil):
Çıktı biçimi: ‘pil’, ‘np’, ‘pt’.</p> <p>Çıktılar:
images (<code>list</code>):
Oluşturulan görüntüler.
latents (<code>Tensor</code>):
Gürültüsü azaltılmış latentler.</p></div> <!--[1--><h2 class="relative group"><a id="diffusers.Flux3DistilledModularPipeline" 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="#diffusers.Flux3DistilledModularPipeline"><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><!---->Flux3DistilledModularPipeline<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.Flux3DistilledModularPipeline"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">sınıf</span> <span class="font-medium">diffusers.</span><span class="font-semibold">Flux3DistilledModularPipeline</span></span></h3><!----> <a id="diffusers.Flux3DistilledModularPipeline" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.Flux3DistilledModularPipeline"><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><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/flux3/modular_pipeline.py#L52" target="_blank"><span>&lt;</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">blocks<span class="opacity-60">: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">pretrained_model_name_or_path<span class="opacity-60">: str | os.PathLike | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">components_manager<span class="opacity-60">: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">collection<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">workflow<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">modular_config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">**kwargs<span class="opacity-60"></span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Adım-distilled FLUX.3 modeli için bir ModularPipeline (16 adım, classifier-free guidance yok).</p></div> <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/api/pipelines/flux3.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_1rjuniz = {
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.vZc-dOUR.js"),
import("/docs/diffusers/main/en/_app/immutable/entry/app.B6c3Ml05.js")
]).then(([kit, app]) => {
kit.start(app, element, {
node_ids: [0, 180],
data: [null,null],
form: null,
error: null
});
});
}
</script>

Xet Storage Details

Size:
98 kB
·
Xet hash:
1d9f6f2b4d69fa6842751a04f01efbd6fbbbeccc4160fb53989cd9ed283004fa

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.