Merge edc9ef99adef0ad0bc98c39f7840529d5af1c8a7 into ea2d2a81667239d37615697e8f0056e35bab2db6

This commit is contained in:
EdgeInfinity 2026-04-19 14:16:06 +01:00 committed by GitHub
commit 8a4be8f805
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,
)
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)
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)
logits = self.ar_predict_layer(xy_dec[:, -1])
eos_penalty = 2.0
logits[:, self.EOS] -= eos_penalty
if idx == 0:
attn_mask = F.pad(attn_mask[:, :, -1].unsqueeze(-2), (0, 1), value=False)
else:
@ -895,6 +902,9 @@ class Text2SemanticDecoder(nn.Module):
logits = self.ar_predict_layer(xy_dec[:, -1])
eos_penalty = 2.0
logits[:, self.EOS] -= eos_penalty
if idx == 0:
xy_attn_mask = None
if idx < 11: ###至少预测出10个token不然不给停止0.4s