Skip to content

Commit 29c0b60

Browse files
committed
Infer model architecture dimensions dynamically from HF config.json and clean up YAML configs
1 parent 955f431 commit 29c0b60

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/maxdiffusion/configs/base_flux2klein_9B.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,6 @@ width: 1024
270270
batch_size: 4
271271
interactive: False
272272

273-
# 9B Architecture Dimensions
274-
depth: 24 # num_single_layers
275-
num_double_layers: 8
276-
hidden_size: 4096
277-
num_attention_heads: 32
273+
# Note: Architecture dimensions (depth, num_double_layers, num_attention_heads) are
274+
# automatically inferred from pretrained_model_name_or_path (transformer/config.json).
278275

src/maxdiffusion/generate_flux2klein.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ def main(argv):
168168
pyconfig._config.keys["logical_axis_rules"] = tuple(new_rules)
169169

170170
# 3. Resolve weights repository snapshots
171-
is_9B = config.depth == 24
172171
repo_id = getattr(config, "pretrained_model_name_or_path", None)
173172
if not repo_id:
174-
repo_id = "black-forest-labs/FLUX.2-klein-9B" if is_9B else "black-forest-labs/FLUX.2-klein-4B"
173+
depth_val = getattr(config, "depth", None)
174+
repo_id = "black-forest-labs/FLUX.2-klein-9B" if depth_val == 24 else "black-forest-labs/FLUX.2-klein-4B"
175175
max_logging.log(f"Target model detected: {repo_id}")
176176

177177
from huggingface_hub import snapshot_download

0 commit comments

Comments
 (0)