Buckets:

mishig's picture
|
download
raw
27.2 kB
#
# Apache Lisansı, 2.0 Sürümü ("Lisans") altında lisanslanmıştır;
# bu dosyayı, Lisansa uygun olarak kullanabilirsiniz.
# Lisansın bir kopyasını şu adresten edinebilirsiniz
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Uygulanabilir yasa gerektirmedikçe veya yazılı olarak anlaşılmadıkça, yazılım
# Lisans kapsamında dağıtılan, "OLDUĞU GİBİ" esasına göre dağıtılır,
# HİÇBİR TÜR AÇIK VEYA ZIMMİ GARANTİ VEYA ŞART İÇERMEZ.
# İzinleri ve
# lisans kapsamındaki kısıtlamalar. -->
# FLUX 3 Image Klein
FLUX 3 Image Klein, Black Forest Labs tarafından geliştirilen 5,6B parametreli bir görüntü üretim modelidir: tek bir transformer ([Flux3Transformer2DModel](/docs/diffusers/main/tr/api/models/flux3_transformer#diffusers.Flux3Transformer2DModel)), 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ı (`AutoencoderKLFlux2`) kullanır.
FLUX 3 Image Klein, [modüler bir pipeline](../../modular_diffusers/overview) olarak sunulur. Metinden görüntüye üretimle başlayın:
```python
import torch
from diffusers import ModularPipeline
pipe = ModularPipeline.from_pretrained("black-forest-labs/flux-3-image-klein-base")
pipe.load_components(dtype={"vae": torch.float32, "default": torch.bfloat16})
pipe.to("cuda")
image = pipe(
prompt="A red fox in a snow-covered forest clearing at golden hour",
generator=torch.Generator().manual_seed(0),
output="images",
)[0]
image.save("fox.png")
```
`prompt` 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 `num_images_per_prompt` parametresini kullanın.
Yukarıdaki örnekte de görebileceğiniz gibi, yükleme ve çalıştırma `DiffusionPipeline`'den biraz farklıdır. Yükleme tembel (lazy)dir: [from_pretrained()](/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline.from_pretrained) yalnızca hattı (pipeline) oluşturur ve ağırlıkları yüklemek için [load_components()](/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline.load_components) çağrısını yaparsınız. Bir çağrı hattın durumunu döndürür ve ihtiyacınız olanı `output` ile istersiniz: burada `output="images"` veya prompt upsampler'ın yazdığı başlığı da almak için `output=["images", "prompt"]`.
> [!TIP]
> `ModularPipeline` ile ilk kez çalışıyorsanız, [quickstart](../../modular_diffusers/quickstart) bölümünü okuyun ve standart pipeline'ları biliyorsanız [Coming from DiffusionPipeline](../../modular_diffusers/coming_from_diffusion_pipeline) bölümüne bakın. Yükleme ve çıktılar dışında birkaç farklı nokta daha var: [guidance](#guidance-scale), [callbacks](#per-step-callbacks) ve [offloading](#memory).
## Prompt örnekleme
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 ([black-forest-labs/flux-3-image-klein-pup](https://huggingface.co/black-forest-labs/flux-3-image-klein-pup)) ve metin kodlayıcıdan önce `prompt`'u böyle bir betimlemeye genişletir; bunun için kısa bir prompt yeterlidir.
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, `prompt` çıktısı olarak geri döner. Yukarıdaki örnekte, görsel modelinin ne aldığını görmek için görsellerle birlikte isten:
```python
out = pipe(
prompt="A red fox in a snow-covered forest clearing at golden hour",
generator=torch.Generator().manual_seed(0),
output=["images", "prompt"],
)
print(out["prompt"])
```
```
Full-color outdoor wildlife photograph taken from a low eye-level perspective in a snow-covered forest clearing at golden hour. In the center foreground, a red fox stands in profile facing left, its body turned toward the viewer and its head raised as it looks across the clearing. The fox has dense rust-red winter fur, a white throat and chest, black lower legs, pointed ears with dark tips, and a long bushy tail ending in white. ...
```
Tam açıklama yaklaşık 240 kelime uzunluğundadır; `max_new_tokens` uzunluğunu sınırlar (varsayılan olarak 3584).
Adımın `doc` değerini yazdırarak ne aldığını ve ne yazdığını görebilirsiniz:
```python
print(pipe.blocks.sub_blocks["prompt_upsampler"].doc)
```
```
Inputs:
prompt (`str`):
The edit instruction to expand into the full caption (one per call).
image (`Image | list`, *optional*):
The reference image(s) of the edit, at most 10; the same ones the pipeline receives.
boxes (`list`, *optional*):
Layout boxes, each {'id', 'desc', 'from', 'src_bbox', 'tgt_bbox'} with the boxes as [y_min, x_min, y_max, x_max] in
0-1: ...
max_new_tokens (`int`, *optional*, defaults to 3584):
The most tokens the upsampler may generate for the caption.
Outputs:
prompt (`str`):
The full caption, replacing the request.
```
Hattın diğer blokları gibi `prompt_upsampler` 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ığı `prompt` olarak alan bir hat oluşturur:
```python
blocks = ModularPipeline.from_pretrained("black-forest-labs/flux-3-image-klein-base").blocks
pup_block = blocks.sub_blocks.pop("prompt_upsampler")
pup = pup_block.init_pipeline("black-forest-labs/flux-3-image-klein-base")
pup.load_components(dtype=torch.bfloat16)
pup.to("cuda")
caption = pup(prompt="A red fox in a snow-covered forest clearing at golden hour", output="prompt")
pipe = blocks.init_pipeline("black-forest-labs/flux-3-image-klein-base")
pipe.load_components(dtype={"vae": torch.float32, "default": torch.bfloat16})
pipe.to("cuda")
image = pipe(prompt=caption, generator=torch.Generator().manual_seed(0), output="images")[0]
```
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 `system_prompts["t2i"]`’yi (veya referanslar kullanıcı mesajında önce gelecek şekilde `"i2i"`) sistem istemi olarak ve isteği kullanıcı mesajı olarak verin, ardından döndürdüğü başlığı `pipe`’e `prompt` olarak iletin.
## Görselden görseli
`image` 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 `height`/`width` değeri varsayılanı geçersiz kılar. *Hedef* 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 [prompt upsampler](#prompt-upsampling)'ın bunu talimattan ve referanslardan yazmasına izin verin:
```python
night = pipe(
prompt="the same scene at night under a full moon",
image=image,
generator=torch.Generator().manual_seed(0),
output=["images", "prompt"],
)
```
Birden fazla referans varsa, bunlara `image`'a iletildikleri sıraya göre ilk görsel, ikinci görsel, ... olarak atıfta bulunun; görsel modeli için başlık bunları `<ref_image_0>`, `<ref_image_1>`, ... olarak adlandırır:
```python
combined = pipe(
prompt="the fox from the first image sitting on the wooden bench from the second image",
image=[image, bench],
height=768,
width=1360,
output="images",
)[0]
```
Türetilen boyutu geçersiz kılmak için `height` ve/veya `width` parametrelerini iletin.
## Düzen kontrolü
İçeriği açıkça konumlandırmak için `boxes` parametresini iletin: her öğe için bir `id`, kısa bir `desc` ve 0-1 aralığında (orijin sol üst köşe) `[y_min, x_min, y_max, x_max]` biçiminde bir `bbox` verin; böylece çıktı boyutundan bağımsız olur. Upsampler, başlığı bu öğelerin etrafına yazar, her öğeyi `<id>` olarak atıf gösterir ve kutuların tablosunu ekler; sizinkiler aynen korunur:
```python
boxes = [
{"id": "balloon_1", "desc": "a red and yellow striped hot-air balloon", "bbox": [0.08, 0.06, 0.48, 0.38]},
{"id": "balloon_2", "desc": "a small blue hot-air balloon", "bbox": [0.20, 0.62, 0.42, 0.80]},
]
out = pipe(prompt="hot-air balloons over a green valley at sunrise", boxes=boxes, output=["images", "prompt"])
```
Düzenleme sırasında bir kutu, kaynağını `from` ile adlandırır: `tgt_bbox` içeren `"target"`, oraya yeni bir öğe ekler; `src_bbox` ve `tgt_bbox` içeren `"ref_image_0"`, o referansın bir öğesini taşır (eşit kutular öğeyi yerinde tutar):
```python
boxes = [{"id": "cactus", "desc": "a small potted cactus", "from": "target", "src_bbox": None, "tgt_bbox": [0.55, 0.62, 0.85, 0.85]}]
out = pipe(prompt="add a small potted cactus in the marked spot", image=mug, boxes=boxes, output=["images", "prompt"])
boxes = [{"id": "knight", "desc": "the knight figure", "from": "ref_image_0", "src_bbox": [0.50, 0.15, 0.85, 0.35], "tgt_bbox": [0.19, 0.06, 0.54, 0.26]}]
out = pipe(prompt="move the knight up and to the left, keep the rest unchanged", image=knight, boxes=boxes, output=["images", "prompt"])
```
Görsel modelin okuduğu başlık, metindeki `<id>` etiketli öğeleri ve 0-1000 tuvalinde kutularla JSON olarak eklenen tabloyu içerir; görmek için `prompt` çıktısını yazdırın. Bu formda elle yazılan bir başlık, [Prompt upsampling](#prompt-upsampling) örneğinde olduğu gibi, bu adım olmadan doğrudan pipeline'a gönderilir.
## Yönlendirme ölçeği
Pipeline, `guider` bileşeni aracılığıyla classifier-free guidance uygular ve çağrı sırasında `guidance_scale` argümanı almaz. Varsayılan guider, her iki iş akışı için önerilen ayar olan `guidance_scale=3.5` değerine sahip [ClassifierFreeGuidance](/docs/diffusers/main/tr/api/modular_diffusers/guiders#diffusers.ClassifierFreeGuidance)'dir. Değiştirmek için guider'ın güncellenmiş bir kopyasını oluşturun:
```python
pipe.guider = pipe.guider.new(guidance_scale=5.0)
```
Farklı bir yönlendirme yöntemine geçmek için [yönlendiriciler kılavuzuna](../../using-diffusers/guiders) bakın.
## Adım-distilled model
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 `modular_model_index.json` dosyası [Flux3DistilledModularPipeline](/docs/diffusers/main/tr/api/pipelines/flux3#diffusers.Flux3DistilledModularPipeline) ve [Flux3DistilledAutoBlocks](/docs/diffusers/main/tr/api/pipelines/flux3#diffusers.Flux3DistilledAutoBlocks) olarak çözümlenir); pipeline'da `guider` yoktur ve `negative_prompt` parametresini kabul etmez:
```python
pipe = ModularPipeline.from_pretrained("black-forest-labs/flux-3-image-klein")
pipe.load_components(dtype=torch.bfloat16)
pipe.to("cuda")
image = pipe(prompt=prompt, generator=torch.Generator().manual_seed(0), output="images")[0]
```
Temel modelle aynı iki iş akışını sunar. `num_inference_steps` varsayılan olarak 16'dır; model 4 ila 16 adım için eğitilmiştir.
## Tekrarlanabilir üretim
`generator`, hattın çektiği gürültüyü sabitler (bkz. [Tekrarlanabilirlik](../../using-diffusers/reusing_seeds)). Başka bir yerde çekilen gürültüyü yeniden kullanmak için, `(batch_size, 128, height // 16, width // 16)` biçiminde `latents` olarak iletin. Örneğin, [BFL uygulaması](https://github.com/black-forest-labs/flux-3) 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:
```python
height, width = 1024, 1024
h, w = height // 16, width // 16
noise = torch.randn((h * w, 128), generator=torch.Generator().manual_seed(0)).to(torch.bfloat16)
latents = noise.T.reshape(1, 128, h, w)
image = pipe(prompt=prompt, latents=latents, height=height, width=width, output="images")[0]
```
## İş Akışları
Pipeline iki iş akışına hizmet eder: `text2image` ve `image_conditioned`; çalıştırılacak olanı girdiler belirler (`image`, image-to-image iş akışını seçer). [from_pretrained()](/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline.from_pretrained), `workflow` 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:
```python
from diffusers.modular_pipelines import Flux3AutoBlocks
print(Flux3AutoBlocks().available_workflows)
# ["text2image", "image_conditioned"]
t2i = ModularPipeline.from_pretrained("black-forest-labs/flux-3-image-klein-base", workflow="text2image")
print(t2i.blocks.doc)
```
## Adım başına geri çağrılar
Mevcut bir geri çağırma işlevini kullanmak için, gürültü azaltma döngüsüne bir blok ekleyin. [geri çağırma kılavuzu](../../using-diffusers/callback#modular-pipelines), `CallbackOnStepEnd` bloğu ve `walk_denoise_loops` yardımcısıyla basit bir örnek içerir:
```python
blocks = Flux3AutoBlocks() # or Flux3DistilledAutoBlocks
for loop in walk_denoise_loops(blocks):
loop.sub_blocks["callback"] = CallbackOnStepEnd()
pipe = blocks.init_pipeline("black-forest-labs/flux-3-image-klein-base")
image = pipe(prompt=caption, callback_on_step_end=my_callback, output="images")[0]
```
Erken durdurmak için geri çağrıdan (callback) raise kullanın; `interrupt` bayrağı yoktur.
## Bellek
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 [prompt upsampler](#prompt-upsampling) 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:
```python
from diffusers import ComponentsManager, ModularPipeline
manager = ComponentsManager()
pipe = ModularPipeline.from_pretrained("black-forest-labs/flux-3-image-klein-base", components_manager=manager)
pipe.load_components(dtype={"vae": torch.float32, "default": torch.bfloat16})
manager.enable_auto_cpu_offload(device="cuda")
```
## Tek dosya yükleme
[Flux3Transformer2DModel](/docs/diffusers/main/tr/api/models/flux3_transformer#diffusers.Flux3Transformer2DModel), transformer'ı doğrudan bir Black Forest Labs model paketinden [from_single_file()](/docs/diffusers/main/tr/api/loaders/single_file#diffusers.loaders.FromOriginalModelMixin.from_single_file) ile yükler. Paketin `config.json` dosyası okunmaz; diffusers yapılandırmasını `config` ve `subfolder` ile iletin.
```python
import torch
from diffusers import Flux3Transformer2DModel, ModularPipeline
transformer = Flux3Transformer2DModel.from_single_file(
"https://huggingface.co/black-forest-labs/flux-3-image-klein-base/blob/main/model.safetensors",
config="black-forest-labs/flux-3-image-klein-base",
subfolder="transformer",
dtype=torch.bfloat16,
)
pipe = ModularPipeline.from_pretrained("black-forest-labs/flux-3-image-klein-base")
pipe.load_components(dtype={"vae": torch.float32, "default": torch.bfloat16})
pipe.update_components(transformer=transformer)
pipe.to("cuda")
```
Önce diğer bileşenleri adlarıyla yükleyin: `names` parametresi olmadan [load_components()](/docs/diffusers/main/tr/api/modular_diffusers/pipeline#diffusers.ModularPipeline.load_components) çağrısı, pipeline deposundan dönüştürücüyü de yükleyecektir.
FP8r ve NVFP4 tek dosyalık checkpoint'lerin yüklenmesi de desteklenir. İkisi de [BFLQuantizationConfig](/docs/diffusers/main/tr/api/quantization#diffusers.BFLQuantizationConfig) ile aynı çağrı üzerinden yüklenir. Her şema için çekirdek gereksinimlerini görmek için [BFL kuantizasyon kılavuzu](../../quantization/bfl)'na bakın.
```python
from diffusers import BFLQuantizationConfig
transformer = Flux3Transformer2DModel.from_single_file(
"https://huggingface.co/black-forest-labs/flux-3-image-klein-base/blob/main/variants/nvfp4/model.safetensors",
config="black-forest-labs/flux-3-image-klein-base",
subfolder="transformer",
quantization_config=BFLQuantizationConfig(compute_dtype=torch.bfloat16),
dtype=torch.bfloat16,
)
```
Adım damıtılmış denetim noktalarını yüklerken yapılandırmalarına (`flow_map=True`) ihtiyacımız var:
```python
transformer = Flux3Transformer2DModel.from_single_file(
"https://huggingface.co/black-forest-labs/flux-3-image-klein/blob/main/variants/nvfp4/model.safetensors",
config="black-forest-labs/flux-3-image-klein",
subfolder="transformer",
quantization_config=BFLQuantizationConfig(compute_dtype=torch.bfloat16),
dtype=torch.bfloat16,
)
```
## Flux3ModularPipeline[[diffusers.Flux3ModularPipeline]]
#### diffusers.Flux3ModularPipeline[[diffusers.Flux3ModularPipeline]]
```python
diffusers.Flux3ModularPipeline(blocks: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None, pretrained_model_name_or_path: str | os.PathLike | None = None, components_manager: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None, collection: str | None = None, workflow: str | None = None, modular_config_dict: dict[str, typing.Any] | None = None, config_dict: dict[str, typing.Any] | None = None, **kwargs)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/flux3/modular_pipeline.py#L24)
FLUX.3 için bir ModularPipeline.
## Flux3AutoBlocks[[diffusers.Flux3AutoBlocks]]
#### diffusers.Flux3AutoBlocks[[diffusers.Flux3AutoBlocks]]
```python
diffusers.Flux3AutoBlocks()
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/flux3/modular_blocks_flux3.py#L339)
FLUX.3 kullanarak metinden görüntüye ve görüntüden görüntüye üretim yapan Auto blokları. `prompt` önce prompt upsampler'dan geçer; `prompt_upsampler` adımını kaldırarak verildiği gibi kodlanmasını sağlayın.
Desteklenen iş akışları:
- `text2image`: `prompt` gerektirir
- `image_conditioned`: `prompt` ve `image` gerektirir
Bileşenler: prompt_upsampler (`Qwen3_5ForConditionalGeneration`): İstem yükseltici. prompt_upsampler_processor (`AutoProcessor`): İşleyicisi. text_encoder (`Qwen3VLForConditionalGeneration`) tokenizer (`AutoProcessor`) image_processor (`Flux3ImageProcessor`) vae (`AutoencoderKLFlux2`) transformer (`Flux3Transformer2DModel`) scheduler (`FlowMatchEulerDiscreteScheduler`) guider (`ClassifierFreeGuidance`)
Inputs: prompt (`str`): The edit instruction to expand into the full caption (one per call). image (`Image | list`, *optional*): The reference image(s) of the edit, at most 10; the same ones the pipeline receives. boxes (`list`, *optional*): Layout boxes, each {'id', 'desc', 'from', 'src_bbox', 'tgt_bbox'} with the boxes as [y_min, x_min, y_max, x_max] in 0-1: 'from': 'target' with `tgt_bbox` adds an element there, 'from': 'ref_image_0', ... with `src_bbox` and `tgt_bbox` moves one from a reference image. max_new_tokens (`int`, *optional*, defaults to 3584): The most tokens the upsampler may generate for the caption. negative_prompt (`str`, *optional*): The prompt not to guide the generation max_sequence_length (`int`, *optional*, defaults to 8192): Maximum number of prompt tokens; longer prompts are truncated. text_encoder_out_layers (`tuple`, *optional*, defaults to (4, 8, 12, 16, 20, 24, 28, 32)): Indices of the text-encoder hidden layers whose states are stacked to form the text embeddings num_images_per_prompt (`int`, *optional*, defaults to 1): The number of images to generate per prompt. image_cond_latents (`list`, *optional*): Normalized packed latents of the reference images, one tensor of shape (B, C, height_i//16, width_i//16) per image height (`int`, *optional*, defaults to None or 1024, depending on the workflow): The height in pixels of the generated image; defaults to the first reference image's own height width (`int`, *optional*, defaults to None or 1024, depending on the workflow): The width in pixels of the generated image; defaults to the first reference image's own width reference_crop (`list | NoneType`, *optional*): Per reference, the box of the reference inside its padded canvas or None, from the preprocess step latents (`Tensor`): Pre-generated noisy latents for image generation. generator (`Generator`, *optional*): Torch generator for deterministic generation. num_inference_steps (`int`): The number of denoising steps. timesteps (`Tensor`): Timesteps for the denoising process. (overrides `num_inference_steps` when provided) sigmas (`list`, *optional*): Custom sigmas for the denoising process. (overrides `num_inference_steps` when provided) **denoiser_input_fields (`None`, *optional*): conditional model inputs for the denoiser: e.g. prompt_embeds, negative_prompt_embeds, etc. attention_kwargs (`dict`, *optional*): Additional kwargs for attention processors. output_type (`str`, *optional*, defaults to pil): Output format: 'pil', 'np', 'pt'.
Çıktılar: images (`list`): Üretilen görüntüler. latents (`Tensor`): Gürültüsü azaltılmış latentler.
## Flux3DistilledAutoBlocks[[diffusers.Flux3DistilledAutoBlocks]]
#### diffusers.Flux3DistilledAutoBlocks[[diffusers.Flux3DistilledAutoBlocks]]
```python
diffusers.Flux3DistilledAutoBlocks()
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/flux3/modular_blocks_flux3_distilled.py#L258)
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. `prompt` önce istem yükselticisinden geçer; onu olduğu gibi kodlamak için `prompt_upsampler` adımını kaldırın.
Desteklenen iş akışları:
- `text2image`: `prompt` gerektirir
- `image_conditioned`: `prompt` ve `image` gerektirir
Bileşenler: prompt_upsampler (`Qwen3_5ForConditionalGeneration`): Prompt upsampler. prompt_upsampler_processor (`AutoProcessor`): İşleyicisi. text_encoder (`Qwen3VLForConditionalGeneration`) tokenizer (`AutoProcessor`) image_processor (`Flux3ImageProcessor`) vae (`AutoencoderKLFlux2`) transformer (`Flux3Transformer2DModel`) scheduler (`FlowMatchEulerDiscreteScheduler`)
Inputs: prompt (`str`): The edit instruction to expand into the full caption (one per call). image (`Image | list`, *optional*): The reference image(s) of the edit, at most 10; the same ones the pipeline receives. boxes (`list`, *optional*): Layout boxes, each {'id', 'desc', 'from', 'src_bbox', 'tgt_bbox'} with the boxes as [y_min, x_min, y_max, x_max] in 0-1: 'from': 'target' with `tgt_bbox` adds an element there, 'from': 'ref_image_0', ... with `src_bbox` and `tgt_bbox` moves one from a reference image. max_new_tokens (`int`, *optional*, defaults to 3584): The most tokens the upsampler may generate for the caption. max_sequence_length (`int`, *optional*, defaults to 8192): Maximum number of prompt tokens; longer prompts are truncated. text_encoder_out_layers (`tuple`, *optional*, defaults to (4, 8, 12, 16, 20, 24, 28, 32)): Indices of the text-encoder hidden layers whose states are stacked to form the text embeddings num_images_per_prompt (`int`, *optional*, defaults to 1): The number of images to generate per prompt. image_cond_latents (`list`, *optional*): Normalized packed latents of the reference images, one tensor of shape (B, C, height_i//16, width_i//16) per image height (`int`, *optional*, defaults to None or 1024, depending on the workflow): The height in pixels of the generated image; defaults to the first reference image's own height width (`int`, *optional*, defaults to None or 1024, depending on the workflow): The width in pixels of the generated image; defaults to the first reference image's own width reference_crop (`list | NoneType`, *optional*): Per reference, the box of the reference inside its padded canvas or None, from the preprocess step latents (`Tensor`): Pre-generated noisy latents for image generation. generator (`Generator`, *optional*): Torch generator for deterministic generation. num_inference_steps (`int`): The number of denoising steps. timesteps (`Tensor`): Timesteps for the denoising process. (overrides `num_inference_steps` when provided) sigmas (`list`, *optional*): Custom sigmas for the denoising process. (overrides `num_inference_steps` when provided) **denoiser_input_fields (`None`, *optional*): conditional model inputs for the denoiser: e.g. prompt_embeds, negative_prompt_embeds, etc. output_type (`str`, *optional*, defaults to pil): Output format: 'pil', 'np', 'pt'.
Çıktılar: images (`list`): Üretilen görüntüler. latents (`Tensor`): Gürültüsü azaltılmış latentler.
## Flux3DistilledModularPipeline[[diffusers.Flux3DistilledModularPipeline]]
#### diffusers.Flux3DistilledModularPipeline[[diffusers.Flux3DistilledModularPipeline]]
```python
diffusers.Flux3DistilledModularPipeline(blocks: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None, pretrained_model_name_or_path: str | os.PathLike | None = None, components_manager: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None, collection: str | None = None, workflow: str | None = None, modular_config_dict: dict[str, typing.Any] | None = None, config_dict: dict[str, typing.Any] | None = None, **kwargs)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/flux3/modular_pipeline.py#L52)
Adım-distilled FLUX.3 modeli için bir ModularPipeline (16 adım, classifier-free guidance yok).

Xet Storage Details

Size:
27.2 kB
·
Xet hash:
da5d21d9a1b72c1918f043350df0e6275d99a1e68b2a0bbb0bd4832d32d2e697

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