[Bug Fix] Hunyuan image cfg bugfix (#4752)
Signed-off-by: zhuhh97 <zhuhonghan@huawei.com> Signed-off-by: dph97 <nenbaying@163.com> Co-authored-by: zhuhh97 <z00806815@gmail.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: Gao Han <hgaoaf@connect.ust.hk> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
7 files changed
+132
-13
No files matched your search
@@ -1099,6 +1099,12 @@ class ImageKVCacheManager:
|
||||
|
||||
neg_kv = (key.reshape(-1, num_kv_heads, head_dim), value.reshape(-1, num_kv_heads, head_dim))
|
||||
self._injected_ar_kv = [self._injected_ar_kv[0], neg_kv]
|
||||
logger.debug(
|
||||
"[AR KV Reuse] neg branch: reused shared_prefix_len=%d, neg_kv_total_len=%d (q_len_actual=%d)",
|
||||
shared_prefix_len,
|
||||
key.shape[1],
|
||||
q_len_actual,
|
||||
)
|
||||
return key, value
|
||||
|
||||
def __call__(
|
||||
@@ -2919,6 +2925,10 @@ class HunyuanImage3Text2ImagePipeline(DiffusionPipeline):
|
||||
):
|
||||
ar_kv_data = model_kwargs.pop("ar_kv_data", None)
|
||||
if ar_kv_data is None:
|
||||
logger.debug(
|
||||
"[AR KV Reuse] cfg_rank=%s: no AR KV received, fallback to full recompute (reuse_len=0)",
|
||||
cfg_rank,
|
||||
)
|
||||
return input_ids, 0
|
||||
|
||||
# 1. positive prefix len
|
||||
|
||||
Reference in new issue
Block a user