Skip to content

FLUX and SD3 report the wrong discarded T5 prompt tokens #15495

Description

@M-Colley

Describe the bug

On f982295e2833b737f19b48de06cf1311aafb7462, FLUX and Stable Diffusion 3 truncate T5 input at max_sequence_length and decode the warning from the CLIP boundary. With an 8-token T5 limit and a 50-token input, FLUX reports [''] as the discarded text. The T5 tokenizer decodes the discarded suffix as o three four five six seven eight nine ten.

The same error reproduces in SD3 with its tiny test components. I propose using the T5 limit in both source methods, synchronizing their library copies, and adding regression tests. Would you welcome a PR for that change?

Reproduction

from diffusers import FluxPipeline

pipe = FluxPipeline.from_pretrained('hf-internal-testing/tiny-flux-pipe', revision='a98bc4ec6a80c47c477ed22d7e81c79872d9c723')
pipe.encode_prompt(prompt='forest', prompt_2='one two three four five six seven eight nine ten', max_sequence_length=8, device='cpu')

Context

No response

Logs

System Info

Diffusers 0.44.0.dev0 (f982295)
Windows 11, build 10.0.26300
Python 3.12.13
PyTorch 2.15.0+cpu
Transformers 5.26.0
huggingface_hub 2.6.0
Accelerate 1.16.0
Safetensors 0.8.0
Reproduction used one CPU process.

Who can help?

No response

Activity

  1. added
    bug
    on Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions