route refmods per generated chunk

This commit is contained in:
2026-10-20 16:14:05 +00:00
parent bacc2db407
commit 4639ce05c0
4 changed files with 54 additions and 5 deletions
+19 -1
View File
@@ -185,7 +185,25 @@ def _add_direct_refmod_input(node_class):
scramble_mode="shuffle",
max_total_tokens=int(refmod_max_total_tokens),
)
kwargs["model"] = bridge.attach(model, blocks, enabled=True)
chunk_blocks = None
chunk_refs = getattr(refmods, "chunk_refs", None)
if chunk_refs:
# Build the per-chunk payloads from the same selected
# RefMods. Ordinary H3_REF_MODS lists have no routing
# metadata and retain the upstream all-chunks behavior.
chunk_blocks = []
for positions in chunk_refs:
chunk_mods = [refmods[index] for index in positions]
chunk_blocks.append(pack._ref_blocks(
chunk_mods,
refmod_retention,
seed=-1,
scramble_mode="shuffle",
max_total_tokens=int(refmod_max_total_tokens),
))
kwargs["model"] = bridge.attach(
model, blocks, enabled=True, chunk_blocks=chunk_blocks,
)
print(
"[DUMAS H3 Continuum Sampler V3.9] direct RefMods active "
f"({len(blocks)} block(s))"