Buckets:

mishig's picture
|
download
raw
28.7 kB

Apache License, Version 2.0("라이선스")에 따라 라이선스가 부여됩니다.

이 파일은 라이선스에 따라만 사용할 수 있습니다.

라이선스 사본은 다음에서 가져올 수 있습니다

http://www.apache.org/licenses/LICENSE-2.0

적용 가능한 법률에 의해 요구되거나 서면으로 합의되지 않는 한, 소프트웨어

라이선스에 따라 배포되는 본 소프트웨어는 "있는 그대로"

명시적이든 묵시적이든 어떠한 종류의 보증이나 조건도 없이 제공됩니다.

권한을 관리하는 특정 언어에 대한 라이선스를 참조하세요

라이선스 하의 제한 사항. -->

FLUX 3 Image Klein

FLUX 3 Image Klein은 Black Forest Labs의 5.6B 이미지 생성 모델입니다. 단일 트랜스포머(Flux3Transformer2DModel)가 텍스트 프롬프트로부터 이미지를 생성하며, 단독으로 또는 하나 이상의 참조 이미지와 함께 사용할 수 있습니다. 텍스트 조건부는 Qwen3-VL에서 제공되며, 이미지는 FLUX.2 packed autoencoder(AutoencoderKLFlux2)를 사용합니다.

FLUX 3 Image Klein은 모듈형 파이프라인으로 제공됩니다. 텍스트-이미지 생성으로 시작해 보세요:

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는 유일한 필수 입력값입니다. 파이프라인은 권장 샘플링 설정(50 steps, guidance scale 3.5, scheduler shift 6.93)을 적용하고 기본적으로 1024 x 1024 크기의 이미지를 생성합니다. 호출당 하나의 프롬프트만 처리하며, 동일한 프롬프트로 여러 이미지를 생성하려면 num_images_per_prompt를 사용하세요.

위 예시에서 볼 수 있듯이, 로딩 및 실행 방식이 DiffusionPipeline과 약간 다릅니다. 로딩은 지연됩니다: from_pretrained()는 파이프라인을 빌드할 뿐이며, 가중치를 로드하려면 load_components()를 호출해야 합니다. 호출 시 파이프라인 상태가 반환되며, 필요한 항목을 output으로 요청합니다. 여기서는 output="images"를 사용하거나, 프롬프트 업샘플러가 작성한 캡션도 함께 얻으려면 output=["images", "prompt"]를 사용할 수 있습니다.

ModularPipeline를 처음 사용하신다면 빠른 시작을 읽고, 표준 파이프라인에 익숙하시다면 DiffusionPipeline에서 넘어오신 분을 위한 안내를 참고하세요. 로딩과 출력 외에도 몇 가지 다른 부분이 있습니다: 가이던스, 콜백, 오프로딩.

프롬프트 업샘플링

프롬프팅이 중요합니다: FLUX 3 Image Klein은 짧은 프롬프트가 아니라 주제, 구도, 조명, 분위기를 설명하는 전체 장면 캡션을 사용합니다. 입력한 대로 요청을 보내면 범용적인 결과가 생성됩니다. 이 때문에 파이프라인은 텍스트-이미지 생성과 편집을 가리지 않고 모든 요청에 대해 먼저 프롬프트 업샘플러를 실행합니다. 이는 Black Forest Labs의 black-forest-labs/flux-3-image-klein-pup라는 별개의 9B 모델로, 텍스트 인코더에 전달하기 전에 prompt를 이러한 캡션으로 확장하며, 짧은 프롬프트만 있으면 충분합니다.

The prompt upsampler turns a short request, together with the reference images when editing, into the full scene caption the model takes: medium and style, scene, lighting and camera, each subject with its colors, materials and position in the frame. One model covers text-to-image, editing with reference images and layout with boxes. The caption it wrote comes back as the prompt output. In the example above, ask for it alongside the images to see what the image model received:

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. ...

전체 캡션은 약 240단어로 구성되며, max_new_tokens가 그 길이를 제한합니다(기본값은 3584).

단계의 doc을 출력하여 해당 단계가 어떤 값을 입력받고 어떤 값을 작성하는지 확인할 수 있습니다:

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.

파이프라인의 다른 블록과 마찬가지로 prompt_upsampler 블록도 독립적으로 실행됩니다. 권장되는 방법은 블록에서 해당 블록을 분리(pop)하는 것입니다. 분리된 블록은 독립적인 업샘플러가 되고, 나머지 블록은 확장된 캡션을 prompt로 받는 파이프라인이 됩니다:

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]

이렇게 하면 별도의 단계로, 자체 GPU에서 또는 자체 엔드포인트 뒤에 배치하여 서빙할 수 있으며, UI에서 생성된 캡션을 표시하고 생성 전에 사용자가 편집할 수 있습니다. 동일한 시스템 프롬프트를 사용하여 다른 LLM으로 업샘플러를 대체할 수 있습니다. 업샘플러 저장소의 system_prompts["t2i"](또는 "i2i", 이 경우 참조 이미지가 사용자 메시지에 먼저 위치해야 함)를 시스템 프롬프트로, 요청을 사용자 메시지로 전달하고, 반환된 캡션을 pipe의 prompt로 전달하면 됩니다.

이미지-이미지

image로 하나 이상의 참조 이미지를 전달합니다. 단일 참조 이미지는 그대로 유지되며, 4메가픽셀을 초과할 경우에만 축소되고 16픽셀 그리드에 패딩되며, 생성은 기본적으로 해당 이미지의 크기를 따르므로 편집 결과가 입력 이미지와 동일한 크기로 반환됩니다. 여러 참조 이미지는 각각 1메가픽셀 이하로 조정되고 그리드에 맞게 크롭되며, 생성은 기본적으로 첫 번째 이미지의 크기를 따릅니다. 지정된 height/width 값은 기본값을 덮어씁니다. 대상 이미지를 편집 지시문 한 줄이 아니라, 편집 내용을 참조 이미지의 캡션에 통합한 완전한 캡션으로 설명하거나, prompt upsampler가 지시문과 참조 이미지로부터 캡션을 작성하도록 하세요:

night = pipe(
    prompt="the same scene at night under a full moon",
    image=image,
    generator=torch.Generator().manual_seed(0),
    output=["images", "prompt"],
)

여러 개의 참조 이미지가 있는 경우, image에 전달된 순서대로 첫 번째 이미지, 두 번째 이미지, ...라고 지칭합니다. 이미지 모델에서는 캡션이 <ref_image_0>, <ref_image_1>, ...와 같이 이름을 붙입니다:

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]

파생된 크기를 재정의하려면 height 및/또는 width를 전달하세요.

레이아웃 제어

내용을 명시적으로 배치하려면 boxes를 전달합니다. 각 요소에 대해 id, 짧은 desc, 그리고 0-1 범위의 bbox인 [y_min, x_min, y_max, x_max]를 지정합니다(좌상단을 원점으로 하며, 출력 크기와 무관합니다). 업샘플러는 캡션을 해당 요소 주위에 작성하고 각 요소를 <id>로 인용하며, 제공된 박스 테이블을 그대로 유지하여 추가합니다:

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"])

편집 시, 박스는 from로 소스를 지정합니다. "target"에 tgt_bbox를 추가하면 해당 위치에 새 요소를 추가하고, "ref_image_0"에 src_bbox와 tgt_bbox를 지정하면 해당 참조 이미지의 요소를 이동합니다(상자 크기가 같으면 제자리에 유지):

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"])

이미지 모델이 읽는 캡션에는 텍스트에 <id>로 태그된 요소와 0-1000 캔버스에 박스가 매핑된 테이블이 JSON으로 추가되어 있습니다. prompt 출력을 출력하면 이를 확인할 수 있습니다. 해당 형식으로 수동으로 작성된 캡션은 Prompt upsampling의 예와 같이 해당 단계 없이 파이프라인으로 전달됩니다.

가이던스 스케일

pipeline은 guider 구성 요소를 통해 classifier-free guidance를 적용하며, 호출 시점에 guidance_scale 인수를 받지 않습니다. 기본 guider는 두 워크플로우 모두에 권장되는 설정인 guidance_scale=3.5를 가진 ClassifierFreeGuidance입니다. 이를 변경하려면 guider의 업데이트된 사본을 생성합니다:

pipe.guider = pipe.guider.new(guidance_scale=5.0)

다른 guidance 방식으로 전환하려면 guiders 가이드를 참조하세요.

Step-distilled model

Step-distilled 체크포인트는 classifier-free guidance 없이 16단계로 생성됩니다. 해당 transformer는 flow map입니다: 각 단계에서 현재 timestep과 해당 단계가 건너뛰는 대상 timestep을 전달받습니다. 베이스 모델과 동일한 방식으로 로드됩니다(리포지토리의 modular_model_index.json은 Flux3DistilledModularPipeline과 Flux3DistilledAutoBlocks로 해석됩니다). 파이프라인에는 guider가 없으며 negative_prompt를 받지 않습니다:

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]

기본 모델과 동일한 두 가지 워크플로를 제공합니다. num_inference_steps의 기본값은 16이며, 모델은 4~16단계로 학습됩니다.

재현 가능한 생성

generator는 파이프라인이 추출하는 노이즈를 고정합니다(재현성 참조). 다른 곳에서 추출한 노이즈를 재사용하려면 latents로 (batch_size, 128, height // 16, width // 16) 형상의 값을 전달하세요. 예를 들어, BFL 구현은 CPU에서 노이즈를 이미지 토큰으로 추출하고 이를 bf16으로 캐스팅합니다. 이를 통해 주어진 시드에서 해당 샘플을 재현할 수 있습니다:

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]

워크플로

The pipeline serves two workflows, text2image and image_conditioned; the one that runs is picked by the inputs (image selects image-to-image). from_pretrained() can also build a pipeline for one workflow with the workflow argument, which then only expects and loads the components that workflow needs:

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)

단계별 콜백

기존 콜백 함수를 사용하려면 디노이징 루프에 블록을 삽입합니다. 콜백 가이드에는 CallbackOnStepEnd 블록과 walk_denoise_loops 헬퍼를 사용한 간단한 예제가 있습니다:

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]

조기 종료를 하려면 콜백에서 예외를 발생시키세요. interrupt 플래그는 없습니다.

메모리

bf16로 모든 것을 로드하면 약 39 GB의 가중치가 필요합니다. 트랜스포머는 5.5B 파라미터, Qwen3-VL-4B 텍스트 인코더는 4B, prompt upsampler는 9B(약 19 GB)이며, 이미지 VAE는 fp32로 로드됩니다. upsampler 단계 없이 빌드된 파이프라인(해당 섹션 참조)은 약 20 GB를 로드합니다. 메모리가 적은 GPU의 경우 구성 요소 오프로딩을 활성화하세요. 매니저는 각 단계가 필요할 때 구성 요소를 CPU와 GPU 사이로 이동하며, upsampler도 포함됩니다:

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")

단일 파일 로딩

Flux3Transformer2DModel은 from_single_file()을 통해 Black Forest Labs 모델 패키지에서 transformer를 직접 로드합니다. 패키지 내의 config.json는 읽지 않으므로, config와 subfolder를 전달하여 diffusers 설정을 지정해야 합니다.

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")

names 없이 load_components()를 호출하면 파이프라인 저장소에서 transformer도 함께 로드되므로, 먼저 이름으로 다른 구성 요소를 로드하세요:

FP8r 및 NVFP4 단일 파일 체크포인트 로딩도 지원됩니다. 두 방식 모두 BFLQuantizationConfig를 사용하여 동일한 호출을 통해 로드됩니다. 각 스킴의 커널 요구 사항은 BFL 양자화 가이드를 참조하세요.

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,
)

step-distilled 체크포인트를 로드할 때, 해당 설정(flow_map=True)이 필요합니다:

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]]

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)

소스

FLUX.3용 ModularPipeline.

Flux3AutoBlocks[[diffusers.Flux3AutoBlocks]]

diffusers.Flux3AutoBlocks[[diffusers.Flux3AutoBlocks]]

diffusers.Flux3AutoBlocks()

소스

FLUX.3를 사용하여 텍스트-이미지 및 이미지-이미지 생성을 수행하는 Auto 블록입니다. prompt는 먼저 프롬프트 업샘플러를 통과합니다. prompt_upsampler 단계를 제거하면 주어진 그대로 인코딩됩니다.

지원되는 워크플로:

  • text2image: prompt 필수
  • image_conditioned: prompt, image 필수

Components: prompt_upsampler (Qwen3_5ForConditionalGeneration): 프롬프트 업샘플러. prompt_upsampler_processor (AutoProcessor): 해당 프로세서. text_encoder (Qwen3VLForConditionalGeneration) tokenizer (AutoProcessor) image_processor (Flux3ImageProcessor) vae (AutoencoderKLFlux2) transformer (Flux3Transformer2DModel) scheduler (FlowMatchEulerDiscreteScheduler) guider (ClassifierFreeGuidance)

Inputs: prompt (str): 전체 캡션으로 확장할 편집 지침(호출당 1개). image (Image | list, 선택 사항): 편집의 참조 이미지(최대 10개). 파이프라인이 받는 것과 동일한 이미지입니다. boxes (list, 선택 사항): 레이아웃 박스. 각 요소는 {'id', 'desc', 'from', 'src_bbox', 'tgt_bbox'}이며, 박스는 0-1 범위의 [y_min, x_min, y_max, x_max]입니다. 'from': 'target'이고 tgt_bbox가 있으면 해당 위치에 요소를 추가하고, 'from': 'ref_image_0', ...이고 src_bbox 및 tgt_bbox가 있으면 참조 이미지에서 요소를 이동합니다. max_new_tokens (int, 선택 사항, 기본값 3584): 업샘플러가 캡션을 생성할 때 사용할 수 있는 최대 토큰 수. negative_prompt (str, 선택 사항): 생성을 유도하지 않을 프롬프트. max_sequence_length (int, 선택 사항, 기본값 8192): 프롬프트 토큰의 최대 수. 더 긴 프롬프트는 잘립니다. text_encoder_out_layers (tuple, 선택 사항, 기본값 (4, 8, 12, 16, 20, 24, 28, 32)): 텍스트 임베딩을 형성하기 위해 상태가 스택되는 텍스트 인코더의 숨겨진 레이어 인덱스. num_images_per_prompt (int, 선택 사항, 기본값 1): 프롬프트당 생성할 이미지 수. image_cond_latents (list, 선택 사항): 참조 이미지의 정규화된 패킹된 잠재 변수. 이미지당 (B, C, height_i//16, width_i//16) 모양의 텐서 1개. height (int, 선택 사항, 워크플로에 따라 기본값 None 또는 1024): 생성된 이미지의 픽셀 단위 높이. 기본값은 첫 번째 참조 이미지의 자체 높이입니다. width (int, 선택 사항, 워크플로에 따라 기본값 None 또는 1024): 생성된 이미지의 픽셀 단위 너비. 기본값은 첫 번째 참조 이미지의 자체 너비입니다. reference_crop (list | NoneType, 선택 사항): 참조별로 패딩된 캔버스 안의 참조 박스 또는 None. 전처리 단계에서 가져온 값입니다. latents (Tensor): 이미지 생성을 위한 사전 생성된 노이즈 잠재 변수. generator (Generator, 선택 사항): 결정론적 생성을 위한 Torch 생성기. num_inference_steps (int): 디노이징 단계 수. timesteps (Tensor): 디노이징 과정의 타임스텝. (지정되면 num_inference_steps를 덮어씀) sigmas (list, 선택 사항): 디노이징 과정의 사용자 지정 시그마. (지정되면 num_inference_steps를 덮어씀) **denoiser_input_fields (None, 선택 사항): 디노이저의 조건부 모델 입력. 예: prompt_embeds, negative_prompt_embeds 등. attention_kwargs (dict, 선택 사항): 어텐션 프로세서용 추가 kwargs. output_type (str, 선택 사항, 기본값 pil): 출력 형식: 'pil', 'np', 'pt'.

Outputs: 이미지 (list): 생성된 이미지. latents (Tensor): 노이즈가 제거된 latents.

Flux3DistilledAutoBlocks[[diffusers.Flux3DistilledAutoBlocks]]

diffusers.Flux3DistilledAutoBlocks[[diffusers.Flux3DistilledAutoBlocks]]

diffusers.Flux3DistilledAutoBlocks()

소스

prompt를 프롬프트 업샘플러를 먼저 통과시킨 후, prompt_upsampler 단계를 제거하면 주어진 그대로 인코딩합니다.

지원되는 워크플로:

  • text2image: prompt 필수
  • image_conditioned: prompt, image 필수

Components: prompt_upsampler (Qwen3_5ForConditionalGeneration): 프롬프트 업샘플러. prompt_upsampler_processor (AutoProcessor): 해당 프로세서. text_encoder (Qwen3VLForConditionalGeneration) tokenizer (AutoProcessor) image_processor (Flux3ImageProcessor) vae (AutoencoderKLFlux2) transformer (Flux3Transformer2DModel) scheduler (FlowMatchEulerDiscreteScheduler)

Inputs: prompt (str): 전체 캡션으로 확장할 편집 지침(호출당 1개). image (Image | list, 선택 사항): 편집의 참조 이미지(최대 10개). 파이프라인이 받는 것과 동일한 이미지입니다. boxes (list, 선택 사항): 레이아웃 박스. 각 요소는 {'id', 'desc', 'from', 'src_bbox', 'tgt_bbox'}이며, 박스는 0-1 범위의 [y_min, x_min, y_max, x_max]입니다. 'from': 'target'이고 tgt_bbox가 있으면 해당 위치에 요소를 추가하고, 'from': 'ref_image_0', ...이고 src_bbox 및 tgt_bbox가 있으면 참조 이미지에서 요소를 이동합니다. max_new_tokens (int, 선택 사항, 기본값 3584): 업샘플러가 캡션을 생성할 수 있는 최대 토큰 수. max_sequence_length (int, 선택 사항, 기본값 8192): 프롬프트 토큰의 최대 수. 더 긴 프롬프트는 잘립니다. text_encoder_out_layers (tuple, 선택 사항, 기본값 (4, 8, 12, 16, 20, 24, 28, 32)): 텍스트 임베딩을 형성하기 위해 상태가 스택되는 텍스트 인코더 히든 레이어의 인덱스. num_images_per_prompt (int, 선택 사항, 기본값 1): 프롬프트당 생성할 이미지 수. image_cond_latents (list, 선택 사항): 참조 이미지의 정규화된 패킹된 잠재 변수. 이미지당 (B, C, height_i//16, width_i//16) 모양의 텐서 1개. height (int, 선택 사항, 워크플로에 따라 기본값 None 또는 1024): 생성된 이미지의 픽셀 단위 높이. 기본값은 첫 번째 참조 이미지의 자체 높이입니다. width (int, 선택 사항, 워크플로에 따라 기본값 None 또는 1024): 생성된 이미지의 픽셀 단위 너비. 기본값은 첫 번째 참조 이미지의 자체 너비입니다. reference_crop (list | NoneType, 선택 사항): 참조별로 패딩된 캔버스 안의 참조 박스 또는 None. 전처리 단계에서 가져온 값입니다. latents (Tensor): 이미지 생성을 위한 사전 생성된 노이즈 잠재 변수. generator (Generator, 선택 사항): 결정론적 생성을 위한 Torch 생성기. num_inference_steps (int): 디노이징 단계 수. timesteps (Tensor): 디노이징 과정의 타임스텝. (지정되면 num_inference_steps를 덮어씀) sigmas (list, 선택 사항): 디노이징 과정의 사용자 지정 시그마. (지정되면 num_inference_steps를 덮어씀) **denoiser_input_fields (None, 선택 사항): 디노이저의 조건부 모델 입력. 예: prompt_embeds, negative_prompt_embeds 등. output_type (str, 선택 사항, 기본값 pil): 출력 형식: 'pil', 'np', 'pt'.

Outputs: 이미지 (list): 생성된 이미지. latents (Tensor): 노이즈가 제거된 latents.

Flux3DistilledModularPipeline[[diffusers.Flux3DistilledModularPipeline]]

diffusers.Flux3DistilledModularPipeline[[diffusers.Flux3DistilledModularPipeline]]

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)

소스

ModularPipeline는 단계 증류된 FLUX.3 모델(16단계, classifier-free guidance 없음)을 위한 것입니다.

Xet Storage Details

Size:
28.7 kB
·
Xet hash:
d74984719f712fbafb93a2ea473d1cf3774982c37f7172f50d1825305087e78f

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