RElbers / info-nce-pytorch

PyTorch implementation of the InfoNCE loss for self-supervised learning.
MIT License
445 stars 37 forks source link

Question about input data #18

Open irowberryFS opened 3 months ago

irowberryFS commented 3 months ago

I have a quick question. My data is (data1, data2, label), where the label indicates if the pair of data points represent the same thing. 0 being not the same and 1 being the same. My objective is contrastive learning/loss. I take batches of the data, so I may have multiple positive pairs in each batch. What would be the optimal way to use this loss function with this data? Any help would be appreciated. Thanks.