Update modeling_minicpmv.py
Browse files294 unmodified lines2952962972982993003012 unmodified lines304305306307308309294 unmodified linespad_embedding_vector = embedding_layer.weight[0]vector_reshaped = pad_embedding_vector.view(1, 1, 4096)for tensor in batch:to_add = []for pl in range(tensor.shape[1]):to_add.append(1)2 unmodified linestensor = torch.cat((tensor, vector_reshaped), dim=1)to_add.append(0)print(tensor.shape, "UPDATED_SHAPE")attention_mask.append(to_add)attention_mask = torch.tensor(attention_mask)294 unmodified lines2952962972982993003012 unmodified lines304305306307308309310294 unmodified linespad_embedding_vector = embedding_layer.weight[0]vector_reshaped = pad_embedding_vector.view(1, 1, 4096)for place, tensor in enumerate(batch):to_add = []for pl in range(tensor.shape[1]):to_add.append(1)2 unmodified linestensor = torch.cat((tensor, vector_reshaped), dim=1)to_add.append(0)print(tensor.shape, "UPDATED_SHAPE")batch[place] = tensorattention_mask.append(to_add)attention_mask = torch.tensor(attention_mask)
modeling_minicpmv.py+2-1