[Refactor] Remove dead code in multiple files (#49745)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
@@ -257,25 +257,6 @@ class FunAudioChatAudioEncoder(nn.Module):
|
||||
def dtype(self) -> torch.dtype:
|
||||
return self.conv1.weight.dtype
|
||||
|
||||
def _prepare_attention_mask(
|
||||
self, inputs_tensor: torch.Tensor, cu_seqlens: torch.Tensor
|
||||
) -> torch.Tensor | None:
|
||||
if getattr(self.config, "_attn_implementation", "eager") == "flash_attention_2":
|
||||
return None
|
||||
|
||||
seq_length = inputs_tensor.shape[0]
|
||||
attention_mask = torch.full(
|
||||
(1, 1, seq_length, seq_length),
|
||||
torch.finfo(inputs_tensor.dtype).min,
|
||||
device=inputs_tensor.device,
|
||||
dtype=inputs_tensor.dtype,
|
||||
)
|
||||
for i in range(1, len(cu_seqlens)):
|
||||
start = int(cu_seqlens[i - 1].item())
|
||||
end = int(cu_seqlens[i].item())
|
||||
attention_mask[..., start:end, start:end] = 0
|
||||
return attention_mask
|
||||
|
||||
def forward(
|
||||
self,
|
||||
input_features: torch.Tensor,
|
||||
|
||||
Reference in New Issue
Block a user