Skip to content

Commit e680cf7

Browse files
committed
Address minor review comments.
1 parent 253b2b1 commit e680cf7

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

invokeai/app/invocations/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class FieldDescriptions:
135135
vae_model = "VAE model to load"
136136
lora_model = "LoRA model to load"
137137
main_model = "Main model (UNet, VAE, CLIP) to load"
138-
flux_model = "Flux model (Transformer, VAE, CLIP) to load"
138+
flux_model = "Flux model (Transformer) to load"
139139
sdxl_main_model = "SDXL Main model (UNet, VAE, CLIP1, CLIP2) to load"
140140
sdxl_refiner_model = "SDXL Refiner Main Modde (UNet, VAE, CLIP2) to load"
141141
onnx_main_model = "ONNX Main model (UNet, VAE, CLIP) to load"

invokeai/app/invocations/flux_text_encoder.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
@invocation(
1616
"flux_text_encoder",
1717
title="FLUX Text Encoding",
18-
tags=["image", "flux"],
19-
category="image",
18+
tags=["prompt", "conditioning", "flux"],
19+
category="conditioning",
2020
version="1.0.0",
2121
)
2222
class FluxTextEncoderInvocation(BaseInvocation):
@@ -32,7 +32,9 @@ class FluxTextEncoderInvocation(BaseInvocation):
3232
description=FieldDescriptions.t5_encoder,
3333
input=Input.Connection,
3434
)
35-
max_seq_len: Literal[256, 512] = InputField(description="Max sequence length for the desired flux model")
35+
t5_max_seq_len: Literal[256, 512] = InputField(
36+
description="Max sequence length for the T5 encoder. Expected to be 256 for FLUX schnell models and 512 for FLUX dev models."
37+
)
3638
positive_prompt: str = InputField(description="Positive prompt for text-to-image generation.")
3739

3840
# TODO(ryand): Should we create a new return type for this invocation? This ConditioningOutput is clearly not
@@ -48,8 +50,6 @@ def invoke(self, context: InvocationContext) -> ConditioningOutput:
4850
return ConditioningOutput.build(conditioning_name)
4951

5052
def _encode_prompt(self, context: InvocationContext) -> tuple[torch.Tensor, torch.Tensor]:
51-
max_seq_len = self.max_seq_len
52-
5353
# Load CLIP.
5454
clip_tokenizer_info = context.models.load(self.clip.tokenizer)
5555
clip_text_encoder_info = context.models.load(self.clip.text_encoder)
@@ -70,7 +70,7 @@ def _encode_prompt(self, context: InvocationContext) -> tuple[torch.Tensor, torc
7070
assert isinstance(t5_tokenizer, T5Tokenizer)
7171

7272
clip_encoder = HFEncoder(clip_text_encoder, clip_tokenizer, True, 77)
73-
t5_encoder = HFEncoder(t5_text_encoder, t5_tokenizer, False, max_seq_len)
73+
t5_encoder = HFEncoder(t5_text_encoder, t5_tokenizer, False, self.t5_max_seq_len)
7474

7575
prompt = [self.positive_prompt]
7676
prompt_embeds = t5_encoder(prompt)

invokeai/app/invocations/flux_text_to_image.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class FluxTextToImageInvocation(BaseInvocation, WithMetadata, WithBoard):
3333
"""Text-to-image generation using a FLUX model."""
3434

3535
transformer: TransformerField = InputField(
36-
description=FieldDescriptions.unet,
36+
description=FieldDescriptions.flux_model,
3737
input=Input.Connection,
3838
title="Transformer",
3939
)
@@ -46,10 +46,12 @@ class FluxTextToImageInvocation(BaseInvocation, WithMetadata, WithBoard):
4646
)
4747
width: int = InputField(default=1024, multiple_of=16, description="Width of the generated image.")
4848
height: int = InputField(default=1024, multiple_of=16, description="Height of the generated image.")
49-
num_steps: int = InputField(default=4, description="Number of diffusion steps.")
49+
num_steps: int = InputField(
50+
default=4, description="Number of diffusion steps. Recommend values are schnell: 4, dev: 50."
51+
)
5052
guidance: float = InputField(
5153
default=4.0,
52-
description="The guidance strength. Higher values adhere more strictly to the prompt, and will produce less diverse images.",
54+
description="The guidance strength. Higher values adhere more strictly to the prompt, and will produce less diverse images. FLUX dev only, ignored for schnell.",
5355
)
5456
seed: int = InputField(default=0, description="Randomness seed for reproducibility.")
5557

0 commit comments

Comments
 (0)