FLUX.2 Klein 4B Qwen3 encoder: sharded safetensors cannot be auto-detected
Bug
InvokeAI 6.14.1 cannot automatically identify the FLUX.2 Klein 4B Qwen3 text encoder when installed from:
black-forest-labs/FLUX.2-klein-4B::text_encoder+tokenizer
Environment
- Invoke Community Edition: 1.8.4
- InvokeAI Python package: 6.14.1
- macOS
- Python 3.12
Reproduction
Install the Hugging Face source above. The files download successfully, but model identification fails with:
Multiple weight files found for this model: [.../text_encoder/model-00002-of-00002.safetensors, .../text_encoder/model-00001-of-00002.safetensors]. Please specify the intended file using the 'path' argument
Root cause observed
In backend/model_manager/model_on_disk.py, resolve_weight_file() raises whenever a model directory contains 2+ weight files.
The Qwen3 encoder matcher in backend/model_manager/configs/qwen3_encoder.py calls:
_has_sdnq_keys(mod.load_state_dict())
from _reject_if_sdnq_quantized(). load_state_dict() calls resolve_weight_file(), which assumes a single weight file.
The FLUX.2 Klein 4B Qwen3 encoder is a standard Hugging Face sharded checkpoint with:
model-00001-of-00002.safetensorsmodel-00002-of-00002.safetensors
Therefore model identification fails before the encoder can be registered.
Expected behavior
The Qwen3 encoder detector should recognize a standard Hugging Face sharded safetensors checkpoint and allow the two shards to be treated as one model. Detection should not require selecting one shard as the complete state dict.
Important detail
Simply choosing one shard is not a valid workaround because each shard contains only part of the model weights.
Could the Qwen3 encoder detection/loading path be updated to support sharded safetensors (or otherwise avoid loading the full state dict during SDNQ detection)?
The model files themselves download correctly; this appears to be an importer/model-detection issue.
Source: invoke-ai/InvokeAI