Merge edc9ef99adef0ad0bc98c39f7840529d5af1c8a7 into 2d9193b0d3c0eae0c3a14d8c68a839f1bae157dc

This commit is contained in:
EdgeInfinity 2026-02-09 15:14:50 +08:00 committed by GitHub
commit b2567cea96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -553,6 +553,10 @@ class Text2SemanticDecoder(nn.Module):
mask=xy_attn_mask, mask=xy_attn_mask,
) )
logits = self.ar_predict_layer(xy_dec[:, -1]) logits = self.ar_predict_layer(xy_dec[:, -1])
eos_penalty = 2.0
logits[:, self.EOS] -= eos_penalty
samples = topk_sampling(logits, top_k=top_k, top_p=1.0, temperature=temperature) samples = topk_sampling(logits, top_k=top_k, top_p=1.0, temperature=temperature)
if early_stop_num != -1 and (y.shape[1] - prefix_len) > early_stop_num: if early_stop_num != -1 and (y.shape[1] - prefix_len) > early_stop_num:
@ -705,6 +709,9 @@ class Text2SemanticDecoder(nn.Module):
xy_dec, k_cache, v_cache = self.t2s_transformer.decode_next_token(xy_pos, k_cache, v_cache, attn_mask) xy_dec, k_cache, v_cache = self.t2s_transformer.decode_next_token(xy_pos, k_cache, v_cache, attn_mask)
logits = self.ar_predict_layer(xy_dec[:, -1]) logits = self.ar_predict_layer(xy_dec[:, -1])
eos_penalty = 2.0
logits[:, self.EOS] -= eos_penalty
if idx == 0: if idx == 0:
attn_mask = F.pad(attn_mask[:, :, -1].unsqueeze(-2), (0, 1), value=False) attn_mask = F.pad(attn_mask[:, :, -1].unsqueeze(-2), (0, 1), value=False)
else: else:
@ -895,6 +902,9 @@ class Text2SemanticDecoder(nn.Module):
logits = self.ar_predict_layer(xy_dec[:, -1]) logits = self.ar_predict_layer(xy_dec[:, -1])
eos_penalty = 2.0
logits[:, self.EOS] -= eos_penalty
if idx == 0: if idx == 0:
xy_attn_mask = None xy_attn_mask = None
if idx < 11: ###至少预测出10个token不然不给停止0.4s if idx < 11: ###至少预测出10个token不然不给停止0.4s