kashif HF Staff commited on
Commit
01ac9c0
·
verified ·
1 Parent(s): fded1ba

Treat store_kv=None as use config default (upstream forwards thread None through)

Browse files
Files changed (1) hide show
  1. modeling_sdar.py +5 -1
modeling_sdar.py CHANGED
@@ -264,7 +264,11 @@ class SDARAttention(nn.Module):
264
  # I-DLM / strict-causal mode (`config.use_regular_causal=True`) uses the standard HF cache
265
  # convention: every cached forward commits its KVs. In SDAR block-diffusion mode, callers pass
266
  # `store_kv=True` for commit forwards and `store_kv=False` for retrieve-only denoising passes.
267
- store_kv = kwargs.get("store_kv", bool(getattr(self.config, "use_regular_causal", False)))
 
 
 
 
268
  if past_key_value is not None and store_kv:
269
  # Store new kv into the cache (and get concatenated result).
270
  key_states, value_states = past_key_value.update(
 
264
  # I-DLM / strict-causal mode (`config.use_regular_causal=True`) uses the standard HF cache
265
  # convention: every cached forward commits its KVs. In SDAR block-diffusion mode, callers pass
266
  # `store_kv=True` for commit forwards and `store_kv=False` for retrieve-only denoising passes.
267
+ # Upstream forwards thread `store_kv: Optional[bool] = None` through, so a missing caller kwarg
268
+ # still arrives here as `None` — treat that as "use config default" rather than False.
269
+ store_kv = kwargs.get("store_kv", None)
270
+ if store_kv is None:
271
+ store_kv = bool(getattr(self.config, "use_regular_causal", False))
272
  if past_key_value is not None and store_kv:
273
  # Store new kv into the cache (and get concatenated result).
274
  key_states, value_states = past_key_value.update(