You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An officially supported task in the examples folder
My own task or dataset (give details below)
Reproduction
# Get the first column idx that is all zeros and remove every column after thatempty_cols=torch.sum(attention_mask, dim=0) ==0first_empty_col=torch.nonzero(empty_cols)[0].item() ifempty_cols.any() elseattention_mask.size(1) +1input_ids=input_ids[:, : first_empty_col-1]
attention_mask=attention_mask[:, : first_empty_col-1]
loss_mask=loss_mask[:, : first_empty_col-1]
Expected behavior
The returns of torch.nonzero is the index (starts from 0) of non-zero elements, so there is no need to add -1 to first_empty_col.
The correct code should be:
System Info
it is a tensor index error
Information
Tasks
examples
folderReproduction
Expected behavior
The returns of torch.nonzero is the index (starts from 0) of non-zero elements, so there is no need to add -1 to first_empty_col.
The correct code should be:
The text was updated successfully, but these errors were encountered: