Skip to content

mayura-ai/sarika

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

def collate_fn(batch): X = [] Y = [] for item in batch: split_index = torch.where(item == SEP_TOKEN_ID)[0][0] X.append(item[: split_index + 1]) Y.append(item[split_index + 1 :]) fin_X = [] fin_Y = [] for x, y in zip(X, Y): for i in range(len(y) - 1): fin_X.append(torch.cat((x, y[:i]))) fin_Y.append(y[i:]) return torch.nn.utils.rnn.pad_sequence(fin_X), torch.nn.utils.rnn.pad_sequence( fin_Y )

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages