from local

This commit is contained in:
dohe0342 2023-04-26 12:29:31 +09:00
parent d0fa4f0224
commit ae4be2ce1e
2 changed files with 14 additions and 14 deletions

View File

@ -490,20 +490,20 @@ class Data2VecAudioModel(BaseFairseqModel):
## for prompt tuning ## for prompt tuning
if prompt is not None: if prompt is not None:
conv_feat_all = torch.tensor([]).to(features.device) if 1:
length = 0 conv_feat_all = torch.tensor([]).to(features.device)
for i in range(padding_mask.size()[0]): length = 0
nonzero = padding_mask[i].nonzero() for i in range(padding_mask.size()[0]):
try: nonzero = padding_mask[i].nonzero()
length += nonzero[0] try:
conv_feat_all = torch.cat([conv_feat_all, features[i, :nonzero[0], :]]) length += nonzero[0]
except: conv_feat_all = torch.cat([conv_feat_all, features[i, :nonzero[0], :]])
length += features.size()[1] except:
conv_feat_all = torch.cat([conv_feat_all, features[i]]) length += features.size()[1]
conv_feat_all = torch.cat([conv_feat_all, features[i]])
randint = np.random.randint(10000)
np.save(f'/home/work/workspace/icefall/egs/librispeech/ASR/conv_feat/{randint}.npy', conv_feat_all.cpu().numpy()) randint = np.random.randint(10000)
exit() np.save(f'/home/work/workspace/icefall/egs/librispeech/ASR/conv_feat/{randint}.npy', conv_feat_all.cpu().numpy())
prompt = prompt.expand((features.size()[0], prompt.size()[0], prompt.size()[1])) prompt = prompt.expand((features.size()[0], prompt.size()[0], prompt.size()[1]))
features = torch.cat([prompt, features], dim=1) features = torch.cat([prompt, features], dim=1)